Browse Source

make access_all optional

pull/4812/head
Stefan Melmuk 9 months ago
parent
commit
0faebb69b4
No known key found for this signature in database GPG Key ID: 817020C608FE9C09
  1. 6
      src/api/core/organizations.rs

6
src/api/core/organizations.rs

@ -1297,7 +1297,7 @@ struct EditUserData {
r#type: NumberOrString, r#type: NumberOrString,
collections: Option<Vec<CollectionData>>, collections: Option<Vec<CollectionData>>,
groups: Option<Vec<String>>, groups: Option<Vec<String>>,
access_all: bool, access_all: Option<bool>,
} }
#[put("/organizations/<org_id>/users/<org_user_id>", data = "<data>", rank = 1)] #[put("/organizations/<org_id>/users/<org_user_id>", data = "<data>", rank = 1)]
@ -1370,7 +1370,7 @@ async fn edit_user(
} }
} }
user_to_edit.access_all = data.access_all; user_to_edit.access_all = data.access_all.unwrap_or(false);
user_to_edit.atype = new_type as i32; user_to_edit.atype = new_type as i32;
// Delete all the odd collections // Delete all the odd collections
@ -1379,7 +1379,7 @@ async fn edit_user(
} }
// If no accessAll, add the collections received // If no accessAll, add the collections received
if !data.access_all { if !data.access_all.unwrap_or(false) {
for col in data.collections.iter().flatten() { for col in data.collections.iter().flatten() {
match Collection::find_by_uuid_and_org(&col.id, org_id, &mut conn).await { match Collection::find_by_uuid_and_org(&col.id, org_id, &mut conn).await {
None => err!("Collection not found in Organization"), None => err!("Collection not found in Organization"),

Loading…
Cancel
Save