Skip to content

Commit

Permalink
Fix bug in role verification -- it should work now.
Browse files Browse the repository at this point in the history
  • Loading branch information
vcfxb committed Dec 23, 2021
1 parent 1e39f36 commit 9c3dbe3
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/web/services/user/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,7 @@ async fn save_changes(
// First get the json version of the role as a string.
let role_json: String = json!(role).as_str().expect("Role serialized to JSON string").to_string();
// Then index into the available roles on the context with the selected role to check availability.
// If the selected role does not exist, or is malformed, default to false.
if form.template["context"]["roles"].get(&role_json).and_then(Value::as_bool).unwrap_or(false) {
if form.template["roles"][&role_json] != json!(true) {
return Err(TelescopeError::BadRequest {
header: "Invalid Role Selection".into(),
message: "The selected role is not available at this time".into(),
Expand Down

0 comments on commit 9c3dbe3

Please sign in to comment.