aboutsummaryrefslogtreecommitdiff
path: root/modern/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/common')
-rw-r--r--modern/src/common/attributes/useCommonUserAttributes.js4
-rw-r--r--modern/src/common/attributes/useServerAttributes.js8
-rw-r--r--modern/src/common/components/BottomMenu.js2
-rw-r--r--modern/src/common/util/permissions.js22
4 files changed, 20 insertions, 16 deletions
diff --git a/modern/src/common/attributes/useCommonUserAttributes.js b/modern/src/common/attributes/useCommonUserAttributes.js
index 1409c5ac..ddd5d970 100644
--- a/modern/src/common/attributes/useCommonUserAttributes.js
+++ b/modern/src/common/attributes/useCommonUserAttributes.js
@@ -69,8 +69,4 @@ export default (t) => useMemo(() => ({
name: t('attributeWebMaxZoom'),
type: 'number',
},
- /* 'ui.hidePositionAttributes': {
- name: t('attributeUiHidePositionAttributes'),
- type: 'string',
- }, */
}), [t]);
diff --git a/modern/src/common/attributes/useServerAttributes.js b/modern/src/common/attributes/useServerAttributes.js
new file mode 100644
index 00000000..ba49e44d
--- /dev/null
+++ b/modern/src/common/attributes/useServerAttributes.js
@@ -0,0 +1,8 @@
+import { useMemo } from 'react';
+
+export default (t) => useMemo(() => ({
+ 'ui.disableLoginLanguage': {
+ name: t('attributeUiDisableLoginLanguage'),
+ type: 'boolean',
+ },
+}), [t]);
diff --git a/modern/src/common/components/BottomMenu.js b/modern/src/common/components/BottomMenu.js
index 282ae69e..37bdcf10 100644
--- a/modern/src/common/components/BottomMenu.js
+++ b/modern/src/common/components/BottomMenu.js
@@ -22,7 +22,7 @@ const BottomMenu = () => {
const t = useTranslation();
const readonly = useReadonly();
- const userId = useSelector((state) => state.session.user?.id);
+ const userId = useSelector((state) => state.session.user.id);
const socket = useSelector((state) => state.session.socket);
const [anchorEl, setAnchorEl] = useState(null);
diff --git a/modern/src/common/util/permissions.js b/modern/src/common/util/permissions.js
index 34aeb89d..c866c41e 100644
--- a/modern/src/common/util/permissions.js
+++ b/modern/src/common/util/permissions.js
@@ -1,28 +1,28 @@
import { useSelector } from 'react-redux';
export const useAdministrator = () => useSelector((state) => {
- const admin = state.session.user?.administrator;
+ const admin = state.session.user.administrator;
return admin;
});
export const useManager = () => useSelector((state) => {
- const admin = state.session.user?.administrator;
- const manager = (state.session.user?.userLimit || 0) > 0;
+ const admin = state.session.user.administrator;
+ const manager = (state.session.user.userLimit || 0) > 0;
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;
+ 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;
- const userReadonly = state.session.user?.readonly;
- const serverDeviceReadonly = state.session.server?.deviceReadonly;
- const userDeviceReadonly = state.session.user?.deviceReadonly;
+ const admin = state.session.user.administrator;
+ const serverReadonly = state.session.server.readonly;
+ const userReadonly = state.session.user.readonly;
+ const serverDeviceReadonly = state.session.server.deviceReadonly;
+ const userDeviceReadonly = state.session.user.deviceReadonly;
return !admin && (serverReadonly || userReadonly || serverDeviceReadonly || userDeviceReadonly);
});