mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 00:33:44 +00:00
Feature/split manage collections permission (#1211)
* Update guard services and routing * Add depenent checkbox to handle sub permissions * Present new collections premissions * Use new split permissions * Rename to nested-checkbox.component * Clarify css class name * update jslib
This commit is contained in:
@@ -48,6 +48,48 @@ export class UserAddEditComponent implements OnInit {
|
||||
deletePromise: Promise<any>;
|
||||
organizationUserType = OrganizationUserType;
|
||||
|
||||
manageAllCollectionsCheckboxes = [
|
||||
{
|
||||
id: 'createNewCollections',
|
||||
get: () => this.permissions.createNewCollections,
|
||||
set: (v: boolean) => this.permissions.createNewCollections = v,
|
||||
},
|
||||
{
|
||||
id: 'editAnyCollection',
|
||||
get: () => this.permissions.editAnyCollection,
|
||||
set: (v: boolean) => this.permissions.editAnyCollection = v,
|
||||
},
|
||||
{
|
||||
id: 'deleteAnyCollection',
|
||||
get: () => this.permissions.deleteAnyCollection,
|
||||
set: (v: boolean) => this.permissions.deleteAnyCollection = v,
|
||||
},
|
||||
];
|
||||
|
||||
manageAssignedCollectionsCheckboxes = [
|
||||
{
|
||||
id: 'editAssignedCollections',
|
||||
get: () => this.permissions.editAssignedCollections,
|
||||
set: (v: boolean) => this.permissions.editAssignedCollections = v,
|
||||
},
|
||||
{
|
||||
id: 'deleteAssignedCollections',
|
||||
get: () => this.permissions.deleteAssignedCollections,
|
||||
set: (v: boolean) => this.permissions.deleteAssignedCollections = v,
|
||||
},
|
||||
];
|
||||
|
||||
get fallbackToManageAllCollections() {
|
||||
return this.permissions.createNewCollections == null &&
|
||||
this.permissions.editAnyCollection == null &&
|
||||
this.permissions.deleteAnyCollection == null;
|
||||
}
|
||||
|
||||
get fallbackToManageAssignedCollections() {
|
||||
return this.permissions.editAssignedCollections == null &&
|
||||
this.permissions.deleteAssignedCollections == null;
|
||||
}
|
||||
|
||||
get customUserTypeSelected(): boolean {
|
||||
return this.type === OrganizationUserType.Custom;
|
||||
}
|
||||
@@ -107,39 +149,7 @@ export class UserAddEditComponent implements OnInit {
|
||||
}
|
||||
|
||||
setRequestPermissions(p: PermissionsApi, clearPermissions: boolean) {
|
||||
p.accessBusinessPortal = clearPermissions ?
|
||||
false :
|
||||
this.permissions.accessBusinessPortal;
|
||||
p.accessEventLogs = this.permissions.accessEventLogs = clearPermissions ?
|
||||
false :
|
||||
this.permissions.accessEventLogs;
|
||||
p.accessImportExport = clearPermissions ?
|
||||
false :
|
||||
this.permissions.accessImportExport;
|
||||
p.accessReports = clearPermissions ?
|
||||
false :
|
||||
this.permissions.accessReports;
|
||||
p.manageAllCollections = clearPermissions ?
|
||||
false :
|
||||
this.permissions.manageAllCollections;
|
||||
p.manageAssignedCollections = clearPermissions ?
|
||||
false :
|
||||
this.permissions.manageAssignedCollections;
|
||||
p.manageGroups = clearPermissions ?
|
||||
false :
|
||||
this.permissions.manageGroups;
|
||||
p.manageSso = clearPermissions ?
|
||||
false :
|
||||
this.permissions.manageSso;
|
||||
p.managePolicies = clearPermissions ?
|
||||
false :
|
||||
this.permissions.managePolicies;
|
||||
p.manageUsers = clearPermissions ?
|
||||
false :
|
||||
this.permissions.manageUsers;
|
||||
p.manageResetPassword = clearPermissions ?
|
||||
false :
|
||||
this.permissions.manageResetPassword;
|
||||
Object.assign(p, clearPermissions ? new PermissionsApi() : this.permissions);
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -203,5 +213,4 @@ export class UserAddEditComponent implements OnInit {
|
||||
this.onDeletedUser.emit();
|
||||
} catch { }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user