aboutsummaryrefslogtreecommitdiff
path: root/modern/src/common/util
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-07-18 16:51:46 -0700
committerAnton Tananaev <anton@traccar.org>2022-07-18 16:51:46 -0700
commit4993f83ad1a5ad78a0b076503ab8c0b8f1bbf073 (patch)
treec5e4ce57cca3aad35e1869f21faa99b930871d51 /modern/src/common/util
parentb88aa76538f8cebfa64d7f0d6b1cba8608432068 (diff)
downloadtrackermap-web-4993f83ad1a5ad78a0b076503ab8c0b8f1bbf073.tar.gz
trackermap-web-4993f83ad1a5ad78a0b076503ab8c0b8f1bbf073.tar.bz2
trackermap-web-4993f83ad1a5ad78a0b076503ab8c0b8f1bbf073.zip
Option to disable email change
Diffstat (limited to 'modern/src/common/util')
-rw-r--r--modern/src/common/util/permissions.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/modern/src/common/util/permissions.js b/modern/src/common/util/permissions.js
index c866c41e..76e0aa58 100644
--- a/modern/src/common/util/permissions.js
+++ b/modern/src/common/util/permissions.js
@@ -11,13 +11,6 @@ export const useManager = () => useSelector((state) => {
return admin || manager;
});
-export const useReadonly = () => useSelector((state) => {
- const admin = state.session.user.administrator;
- const serverReadonly = state.session.server.readonly;
- const userReadonly = state.session.user.readonly;
- return !admin && (serverReadonly || userReadonly);
-});
-
export const useDeviceReadonly = () => useSelector((state) => {
const admin = state.session.user.administrator;
const serverReadonly = state.session.server.readonly;
@@ -26,3 +19,10 @@ export const useDeviceReadonly = () => useSelector((state) => {
const userDeviceReadonly = state.session.user.deviceReadonly;
return !admin && (serverReadonly || userReadonly || serverDeviceReadonly || userDeviceReadonly);
});
+
+export const useRestriction = (key) => useSelector((state) => {
+ const admin = state.session.user.administrator;
+ const serverValue = state.session.server[key];
+ const userValue = state.session.user[key];
+ return !admin && (serverValue || userValue);
+});