mirror of
https://github.com/dani-garcia/vaultwarden.wiki.git
synced 2026-11-06 13:38:36 +02:00
[PR 1] Add experimental Custom Roles foundation (#7847)
This commit is contained in:
20 files changed
+621
-68
No files matched your search
@@ -25,7 +25,7 @@ use macros::UuidFromParam;
|
||||
|
||||
use super::{
|
||||
Archive, Attachment, CollectionCipher, CollectionId, Favorite, FolderCipher, FolderId, Group, Membership,
|
||||
MembershipStatus, MembershipType, OrganizationId, User, UserId,
|
||||
MembershipStatus, OrganizationId, User, UserId, organization::ORG_ADMIN_ATYPES,
|
||||
};
|
||||
|
||||
#[derive(Identifiable, Queryable, Insertable, AsChangeset)]
|
||||
@@ -872,7 +872,7 @@ impl Cipher {
|
||||
|
||||
if !visible_only {
|
||||
query = query.or_filter(
|
||||
users_organizations::atype.le(MembershipType::Admin as i32), // Org admin/owner
|
||||
users_organizations::atype.eq_any(ORG_ADMIN_ATYPES), // Org admin/owner
|
||||
);
|
||||
}
|
||||
|
||||
@@ -907,7 +907,7 @@ impl Cipher {
|
||||
|
||||
if !visible_only {
|
||||
query = query.or_filter(
|
||||
users_organizations::atype.le(MembershipType::Admin as i32), // Org admin/owner
|
||||
users_organizations::atype.eq_any(ORG_ADMIN_ATYPES), // Org admin/owner
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1111,7 +1111,7 @@ impl Cipher {
|
||||
.or(collections_groups::collections_uuid
|
||||
.is_not_null() // Access via groups
|
||||
.and(collections_groups::read_only.eq(false)))
|
||||
.or(users_organizations::atype.le(MembershipType::Admin as i32)), // User is admin or owner
|
||||
.or(users_organizations::atype.eq_any(ORG_ADMIN_ATYPES)), // User is admin or owner
|
||||
)
|
||||
.select(ciphers_collections::collection_uuid)
|
||||
.load::<CollectionId>(conn)
|
||||
@@ -1140,7 +1140,7 @@ impl Cipher {
|
||||
.or(users_collections::user_uuid
|
||||
.eq(user_uuid) // User has access to collection
|
||||
.and(users_collections::read_only.eq(false)))
|
||||
.or(users_organizations::atype.le(MembershipType::Admin as i32)), // User is admin or owner
|
||||
.or(users_organizations::atype.eq_any(ORG_ADMIN_ATYPES)), // User is admin or owner
|
||||
)
|
||||
.select(ciphers_collections::collection_uuid)
|
||||
.load::<CollectionId>(conn)
|
||||
@@ -1182,7 +1182,7 @@ impl Cipher {
|
||||
)
|
||||
.or_filter(users_collections::user_uuid.eq(user_uuid)) // User has access to collection
|
||||
.or_filter(users_organizations::access_all.eq(true)) // User has access all
|
||||
.or_filter(users_organizations::atype.le(MembershipType::Admin as i32)) // User is admin or owner
|
||||
.or_filter(users_organizations::atype.eq_any(ORG_ADMIN_ATYPES)) // User is admin or owner
|
||||
.or_filter(groups::access_all.eq(true)) //Access via group
|
||||
.or_filter(collections_groups::collections_uuid.is_not_null()) //Access via group
|
||||
.filter(users_organizations::status.eq(MembershipStatus::Confirmed as i32))
|
||||
|
||||
Reference in new issue
Block a user