The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/client/hooks/usePermissions.js

13 lines
692 B

import { useReactiveValue } from './useReactiveValue';
import { hasAtLeastOnePermission, hasAllPermission } from '../../app/authorization/client/hasPermission';
export const useAtLeastOnePermission = (permissions, scope) =>
useReactiveValue(() => hasAtLeastOnePermission(permissions, scope), [permissions, scope]);
export const useAllPermissions = (permissions, scope) =>
useReactiveValue(() => hasAllPermission(permissions, scope), [permissions, scope]);
export const usePermission = (permission, scope) =>
useReactiveValue(() => hasAllPermission(permission, scope), [permission, scope]);
export const useViewStatisticsPermission = (scope) => usePermission('view-statistics', scope);