diff --git a/src/api/core/organizations.rs b/src/api/core/organizations.rs index 989ca47d..f25f0b7c 100644 --- a/src/api/core/organizations.rs +++ b/src/api/core/organizations.rs @@ -506,10 +506,6 @@ async fn post_organization_collections( let data: FullCollectionData = data.into_inner(); data.validate(&org_id, &conn).await?; - if headers.membership.atype == MembershipType::Manager && !headers.membership.access_all { - err!("You don't have permission to create collections") - } - let collection = Collection::new(org_id.clone(), data.name, data.external_id); collection.save(&conn).await?; @@ -550,6 +546,10 @@ async fn post_organization_collections( .await?; } + if headers.membership.atype == MembershipType::Manager && !headers.membership.access_all { + CollectionUser::save(&headers.membership.user_uuid, &collection.uuid, false, false, false, &conn).await?; + } + Ok(Json(collection.to_json_details(&headers.membership.user_uuid, None, &conn).await)) } diff --git a/src/db/models/organization.rs b/src/db/models/organization.rs index bdb69864..4646c0cc 100644 --- a/src/db/models/organization.rs +++ b/src/db/models/organization.rs @@ -522,8 +522,7 @@ impl Membership { "familySponsorshipValidUntil": null, "familySponsorshipToDelete": null, "accessSecretsManager": false, - // limit collection creation to managers with access_all permission to prevent issues - "limitCollectionCreation": self.atype < MembershipType::Manager || !self.access_all, + "limitCollectionCreation": self.atype < MembershipType::Manager, // If less then a manager return true, to limit collection creations "limitCollectionDeletion": true, "limitItemDeletion": false, "allowAdminAccessToAllCollectionItems": true,