1 import { hasBit } from '@proton/shared/lib/helpers/bitset';
3 // This is deprecated, so we don't put it in enum SHARE_MEMBER_PERMISSIONS
6 export enum DRIVE_PERMISSIONS {
13 const { READ, WRITE, ADMIN, SUPER_ADMIN } = DRIVE_PERMISSIONS;
15 export enum SHARE_URL_PERMISSIONS {
17 EDITOR = WRITE + READ,
20 export enum SHARE_MEMBER_PERMISSIONS {
21 OWNER = EXEC + READ + WRITE + ADMIN + SUPER_ADMIN,
23 EDITOR = WRITE + READ,
24 ADMIN_EDITOR = WRITE + READ + ADMIN,
27 export const getCanWrite = (permissions: SHARE_MEMBER_PERMISSIONS | SHARE_URL_PERMISSIONS) => {
28 return hasBit(permissions, DRIVE_PERMISSIONS.WRITE);
31 export const getCanAdmin = (permissions: SHARE_MEMBER_PERMISSIONS) => {
32 return hasBit(permissions, DRIVE_PERMISSIONS.ADMIN);
35 export const getIsOwner = (permissions: SHARE_MEMBER_PERMISSIONS) => {
36 return permissions === SHARE_MEMBER_PERMISSIONS.OWNER;