mirror of
https://github.com/bitwarden/browser
synced 2026-01-20 09:23:23 +00:00
AC-1115 Modify AC Vault/Collections (#6789)
* Permissions Column added to Org Vault. Other updates to filter section and Can Manage Permission added and put behind feature flag --------- Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com>
This commit is contained in:
@@ -18,6 +18,8 @@ import {
|
||||
AccessItemValue,
|
||||
AccessItemView,
|
||||
CollectionPermission,
|
||||
getPermissionList,
|
||||
Permission,
|
||||
} from "./access-selector.models";
|
||||
|
||||
export enum PermissionMode {
|
||||
@@ -116,16 +118,7 @@ export class AccessSelectorComponent implements ControlValueAccessor, OnInit, On
|
||||
});
|
||||
|
||||
protected itemType = AccessItemType;
|
||||
protected permissionList = [
|
||||
{ perm: CollectionPermission.View, labelId: "canView" },
|
||||
{ perm: CollectionPermission.ViewExceptPass, labelId: "canViewExceptPass" },
|
||||
{ perm: CollectionPermission.Edit, labelId: "canEdit" },
|
||||
{ perm: CollectionPermission.EditExceptPass, labelId: "canEditExceptPass" },
|
||||
];
|
||||
private canManagePermissionListItem = {
|
||||
perm: CollectionPermission.Manage,
|
||||
labelId: "canManage",
|
||||
};
|
||||
protected permissionList: Permission[];
|
||||
protected initialPermission = CollectionPermission.View;
|
||||
|
||||
disabled: boolean;
|
||||
@@ -264,6 +257,7 @@ export class AccessSelectorComponent implements ControlValueAccessor, OnInit, On
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
this.permissionList = getPermissionList(this.flexibleCollectionsEnabled);
|
||||
// Watch the internal formArray for changes and propagate them
|
||||
this.selectionList.formArray.valueChanges.pipe(takeUntil(this.destroy$)).subscribe((v) => {
|
||||
if (!this.notifyOnChange || this.pauseChangeNotification) {
|
||||
@@ -277,10 +271,6 @@ export class AccessSelectorComponent implements ControlValueAccessor, OnInit, On
|
||||
}
|
||||
this.notifyOnChange(v);
|
||||
});
|
||||
|
||||
if (this.flexibleCollectionsEnabled) {
|
||||
this.permissionList.push(this.canManagePermissionListItem);
|
||||
}
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
|
||||
@@ -77,6 +77,25 @@ export type AccessItemValue = {
|
||||
type: AccessItemType;
|
||||
};
|
||||
|
||||
export type Permission = {
|
||||
perm: CollectionPermission;
|
||||
labelId: string;
|
||||
};
|
||||
|
||||
export const getPermissionList = (flexibleCollectionsEnabled: boolean): Permission[] => {
|
||||
const permissions = [
|
||||
{ perm: CollectionPermission.View, labelId: "canView" },
|
||||
{ perm: CollectionPermission.ViewExceptPass, labelId: "canViewExceptPass" },
|
||||
{ perm: CollectionPermission.Edit, labelId: "canEdit" },
|
||||
{ perm: CollectionPermission.EditExceptPass, labelId: "canEditExceptPass" },
|
||||
];
|
||||
if (flexibleCollectionsEnabled) {
|
||||
permissions.push({ perm: CollectionPermission.Manage, labelId: "canManage" });
|
||||
}
|
||||
|
||||
return permissions;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts the CollectionAccessSelectionView interface to one of the new CollectionPermission values
|
||||
* for the dropdown in the AccessSelectorComponent
|
||||
|
||||
Reference in New Issue
Block a user