blob: 27a9ba4fe4b58f1fbcf166e349a3a5c8e398fef2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
import { useSelector } from 'react-redux';
export const useAdministrator = () => useSelector((state) => state.session.user?.administrator);
export const useManager = () => useSelector((state) => state.session.user?.administrator || (state.session.user?.userLimit || 0) > 0);
export const useReadonly = () => useSelector((state) => state.session.server?.readonly || state.session.user?.readonly);
export const useDeviceReadonly = () => useSelector((state) => state.session.server?.readonly || state.session.user?.readonly
|| state.session.server?.deviceReadonly || state.session.user?.deviceReadonly);
export const useEditable = () => useSelector((state) => state.session.user?.administrator
|| (!state.session.server?.readonly && !state.session.user?.readonly));
|