Ensure user/db prefix has a `_` behind it
This commit is contained in:
parent
cd0b2c3e6d
commit
a6f00d4313
|
@ -76,6 +76,7 @@ impl OwnerValidationError {
|
||||||
indoc! {r#"
|
indoc! {r#"
|
||||||
Invalid {} name prefix: '{}' does not match your username or any of your groups.
|
Invalid {} name prefix: '{}' does not match your username or any of your groups.
|
||||||
Are you sure you are allowed to create {} names with this prefix?
|
Are you sure you are allowed to create {} names with this prefix?
|
||||||
|
The format should be: <prefix>_<{} name>
|
||||||
|
|
||||||
Allowed prefixes:
|
Allowed prefixes:
|
||||||
- {}
|
- {}
|
||||||
|
@ -84,6 +85,7 @@ impl OwnerValidationError {
|
||||||
db_or_user.lowercased(),
|
db_or_user.lowercased(),
|
||||||
name,
|
name,
|
||||||
db_or_user.lowercased(),
|
db_or_user.lowercased(),
|
||||||
|
db_or_user.lowercased(),
|
||||||
user.as_ref()
|
user.as_ref()
|
||||||
.map(|u| u.username.clone())
|
.map(|u| u.username.clone())
|
||||||
.unwrap_or("???".to_string()),
|
.unwrap_or("???".to_string()),
|
||||||
|
|
|
@ -45,7 +45,7 @@ pub fn validate_ownership_by_prefixes(
|
||||||
|
|
||||||
if prefixes
|
if prefixes
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|p| name.starts_with(*p))
|
.filter(|p| name.starts_with(&(p.to_string() + "_")))
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.is_empty()
|
.is_empty()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue