aboutsummaryrefslogtreecommitdiff
path: root/modern/src/common/util/permissions.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-05-15 14:58:38 -0700
committerAnton Tananaev <anton@traccar.org>2022-05-15 14:58:38 -0700
commit06dd04d074a79a082a51d37bb84a19d49b29fc05 (patch)
tree09acff88dbbb0a468db17c4f2508790825a1b709 /modern/src/common/util/permissions.js
parent6af8b218a1d9be4d8dcf6a8398b08c874d8a12dc (diff)
downloadtrackermap-web-06dd04d074a79a082a51d37bb84a19d49b29fc05.tar.gz
trackermap-web-06dd04d074a79a082a51d37bb84a19d49b29fc05.tar.bz2
trackermap-web-06dd04d074a79a082a51d37bb84a19d49b29fc05.zip
Add missing user details
Diffstat (limited to 'modern/src/common/util/permissions.js')
-rw-r--r--modern/src/common/util/permissions.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/modern/src/common/util/permissions.js b/modern/src/common/util/permissions.js
index 72ca0b08..27a9ba4f 100644
--- a/modern/src/common/util/permissions.js
+++ b/modern/src/common/util/permissions.js
@@ -2,6 +2,8 @@ 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