Stefan Melmuk
3 weeks ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
6 additions and
5 deletions
-
src/api/core/organizations.rs
-
src/db/models/organization.rs
|
|
|
@ -485,6 +485,10 @@ async fn post_organization_collections( |
|
|
|
err!("Can't find organization details") |
|
|
|
}; |
|
|
|
|
|
|
|
if headers.membership.atype == MembershipType::Manager && !headers.membership.access_all { |
|
|
|
err!("You don't have permission to create collections") |
|
|
|
} |
|
|
|
|
|
|
|
let collection = Collection::new(org.uuid, data.name, data.external_id); |
|
|
|
collection.save(&conn).await?; |
|
|
|
|
|
|
|
@ -525,10 +529,6 @@ 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)) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -514,7 +514,8 @@ impl Membership { |
|
|
|
"familySponsorshipValidUntil": null, |
|
|
|
"familySponsorshipToDelete": null, |
|
|
|
"accessSecretsManager": false, |
|
|
|
"limitCollectionCreation": self.atype < MembershipType::Manager, // If less then a manager return true, to limit collection creations
|
|
|
|
// limit collection creation to managers with access_all permission to prevent issues
|
|
|
|
"limitCollectionCreation": self.atype < MembershipType::Manager || !self.access_all, |
|
|
|
"limitCollectionDeletion": true, |
|
|
|
"limitItemDeletion": false, |
|
|
|
"allowAdminAccessToAllCollectionItems": true, |
|
|
|
|