Skip to content

Commit 096c48f

Browse files
refactor
1 parent 5507d40 commit 096c48f

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/handlers/http/modal/query/querier_rbac.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,17 +172,17 @@ pub async fn add_roles_to_user(
172172
return Err(RBACError::UserDoesNotExist);
173173
};
174174

175-
let mut non_existant_roles = Vec::new();
175+
let mut non_existent_roles = Vec::new();
176176

177177
// check if the role exists
178178
roles_to_add.iter().for_each(|r| {
179179
if roles().get(r).is_none() {
180-
non_existant_roles.push(r.clone());
180+
non_existent_roles.push(r.clone());
181181
}
182182
});
183183

184-
if !non_existant_roles.is_empty() {
185-
return Err(RBACError::RolesDoNotExist(non_existant_roles));
184+
if !non_existent_roles.is_empty() {
185+
return Err(RBACError::RolesDoNotExist(non_existent_roles));
186186
}
187187

188188
// update parseable.json first
@@ -228,17 +228,17 @@ pub async fn remove_roles_from_user(
228228
return Err(RBACError::UserDoesNotExist);
229229
};
230230

231-
let mut non_existant_roles = Vec::new();
231+
let mut non_existent_roles = Vec::new();
232232

233233
// check if the role exists
234234
roles_to_remove.iter().for_each(|r| {
235235
if roles().get(r).is_none() {
236-
non_existant_roles.push(r.clone());
236+
non_existent_roles.push(r.clone());
237237
}
238238
});
239239

240-
if !non_existant_roles.is_empty() {
241-
return Err(RBACError::RolesDoNotExist(non_existant_roles));
240+
if !non_existent_roles.is_empty() {
241+
return Err(RBACError::RolesDoNotExist(non_existent_roles));
242242
}
243243

244244
// check for role not present with user

src/handlers/http/rbac.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ pub async fn post_user(
120120
return Err(RBACError::RolesDoNotExist(non_existent_roles));
121121
}
122122
let _guard = UPDATE_LOCK.lock().await;
123-
if Users.contains(&username) && Users.contains(&username)
123+
if Users.contains(&username)
124124
|| metadata.users.iter().any(|user| match &user.ty {
125125
UserType::Native(basic) => basic.username == username,
126126
UserType::OAuth(_) => false, // OAuth users should be created differently

src/validator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ pub mod error {
192192
#[error("Username should be between 3 and 64 chars long")]
193193
InvalidLength,
194194
#[error(
195-
"Username contains invalid characters. Please use lowercase, alphanumeric or underscore"
195+
"Username contains invalid characters. Only alphanumeric characters and _, -, ., , are allowed"
196196
)]
197197
SpecialChar,
198198
#[error("Username should start with an alphanumeric character")]

0 commit comments

Comments
 (0)