Use same lock values as mobile clients
[ProtonMail-WebClient.git] / packages / shared / lib / drive / permissions.ts
blob27d1dc0595a40db5b78c0a321dab74ca6ae54ca2
1 import { SHARE_MEMBER_PERMISSIONS } from '@proton/shared/lib/drive/constants';
2 import { hasBit } from '@proton/shared/lib/helpers/bitset';
4 const { ADMIN, OWNER, WRITE, READ, SUPER_ADMIN } = SHARE_MEMBER_PERMISSIONS;
6 // This is deprecated, so we don't put it in enum SHARE_MEMBER_PERMISSIONS
7 const EXEC = 1;
9 export const MEMBER_PERMISSIONS = {
10     OWNS: EXEC + READ + WRITE + ADMIN + SUPER_ADMIN,
11     VIEWER: READ,
12     EDITOR: WRITE + READ,
13     ADMIN_EDITOR: WRITE + READ + ADMIN,
16 export const getCanWrite = (permissions: SHARE_MEMBER_PERMISSIONS) => {
17     return hasBit(permissions, WRITE);
20 export const getCanAdmin = (permissions: SHARE_MEMBER_PERMISSIONS) => {
21     return hasBit(permissions, ADMIN);
24 export const getIsOwner = (permissions: SHARE_MEMBER_PERMISSIONS) => {
25     return hasBit(permissions, OWNER);