Browse Source

fix: grant manage permission to Manager on collection creation

When a Manager without `access_all` creates a new collection, the
CollectionUser record was saved with `manage=false`. This caused
the ManagerHeaders guard to reject subsequent edit requests with
"The current user isn't a manager for this collection".

Set manage=true so the creating Manager can manage their own collection.

Fixes #6871
pull/6878/head
Rafael Farias 3 months ago
parent
commit
541ea01416
  1. 2
      src/api/core/organizations.rs

2
src/api/core/organizations.rs

@ -521,7 +521,7 @@ async fn post_organization_collections(
}
if headers.membership.atype == MembershipType::Manager && !headers.membership.access_all {
CollectionUser::save(&headers.membership.user_uuid, &collection.uuid, false, false, false, &conn).await?;
CollectionUser::save(&headers.membership.user_uuid, &collection.uuid, false, false, true, &conn).await?;
}
Ok(Json(collection.to_json_details(&headers.membership.user_uuid, None, &conn).await))

Loading…
Cancel
Save