aboutsummaryrefslogtreecommitdiff
path: root/modern/src/settings
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/settings
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/settings')
-rw-r--r--modern/src/settings/ServerPage.js4
-rw-r--r--modern/src/settings/UserPage.js9
-rw-r--r--modern/src/settings/components/CollectionFab.js4
-rw-r--r--modern/src/settings/components/SettingsMenu.js4
4 files changed, 16 insertions, 5 deletions
diff --git a/modern/src/settings/ServerPage.js b/modern/src/settings/ServerPage.js
index 22dd66af..e51c002c 100644
--- a/modern/src/settings/ServerPage.js
+++ b/modern/src/settings/ServerPage.js
@@ -238,6 +238,10 @@ const ServerPage = () => {
control={<Checkbox checked={item.disableReports} onChange={(event) => setItem({ ...item, disableReports: event.target.checked })} />}
label={t('userDisableReports')}
/>
+ <FormControlLabel
+ control={<Checkbox checked={item.fixedEmail} onChange={(e) => setItem({ ...item, fixedEmail: e.target.checked })} />}
+ label={t('userFixedEmail')}
+ />
</FormGroup>
</AccordionDetails>
</Accordion>
diff --git a/modern/src/settings/UserPage.js b/modern/src/settings/UserPage.js
index 863bb0b7..61fdd412 100644
--- a/modern/src/settings/UserPage.js
+++ b/modern/src/settings/UserPage.js
@@ -33,7 +33,7 @@ import { sessionActions } from '../store';
import SelectField from '../common/components/SelectField';
import SettingsMenu from './components/SettingsMenu';
import useCommonUserAttributes from '../common/attributes/useCommonUserAttributes';
-import { useAdministrator, useManager } from '../common/util/permissions';
+import { useAdministrator, useRestriction, useManager } from '../common/util/permissions';
import { prefixString } from '../common/util/stringUtils';
import useQuery from '../common/util/useQuery';
import { useCatch } from '../reactHelper';
@@ -55,6 +55,7 @@ const UserPage = () => {
const admin = useAdministrator();
const manager = useManager();
+ const fixedEmail = useRestriction('fixedEmail');
const currentUser = useSelector((state) => state.session.user);
@@ -134,6 +135,7 @@ const UserPage = () => {
value={item.email || ''}
onChange={(event) => setItem({ ...item, email: event.target.value })}
label={t('userEmail')}
+ disabled={fixedEmail}
/>
<TextField
type="password"
@@ -333,6 +335,11 @@ const UserPage = () => {
label={t('userDisableReports')}
disabled={!manager}
/>
+ <FormControlLabel
+ control={<Checkbox checked={item.fixedEmail} onChange={(e) => setItem({ ...item, fixedEmail: e.target.checked })} />}
+ label={t('userFixedEmail')}
+ disabled={!manager}
+ />
</FormGroup>
</AccordionDetails>
</Accordion>
diff --git a/modern/src/settings/components/CollectionFab.js b/modern/src/settings/components/CollectionFab.js
index b1230733..3c1fa783 100644
--- a/modern/src/settings/components/CollectionFab.js
+++ b/modern/src/settings/components/CollectionFab.js
@@ -3,7 +3,7 @@ import { Fab } from '@mui/material';
import makeStyles from '@mui/styles/makeStyles';
import AddIcon from '@mui/icons-material/Add';
import { useNavigate } from 'react-router-dom';
-import { useReadonly } from '../../common/util/permissions';
+import { useRestriction } from '../../common/util/permissions';
const useStyles = makeStyles((theme) => ({
fab: {
@@ -20,7 +20,7 @@ const CollectionFab = ({ editPath, disabled }) => {
const classes = useStyles();
const navigate = useNavigate();
- const readonly = useReadonly();
+ const readonly = useRestriction('readonly');
if (!readonly && !disabled) {
return (
diff --git a/modern/src/settings/components/SettingsMenu.js b/modern/src/settings/components/SettingsMenu.js
index 51d9b8fc..7a1bf1b3 100644
--- a/modern/src/settings/components/SettingsMenu.js
+++ b/modern/src/settings/components/SettingsMenu.js
@@ -15,7 +15,7 @@ import PublishIcon from '@mui/icons-material/Publish';
import { Link, useLocation } from 'react-router-dom';
import { useSelector } from 'react-redux';
import { useTranslation } from '../../common/components/LocalizationProvider';
-import { useAdministrator, useManager, useReadonly } from '../../common/util/permissions';
+import { useAdministrator, useManager, useRestriction } from '../../common/util/permissions';
import useFeatures from '../../common/util/useFeatures';
const MenuItem = ({
@@ -31,7 +31,7 @@ const SettingsMenu = () => {
const t = useTranslation();
const location = useLocation();
- const readonly = useReadonly();
+ const readonly = useRestriction('readonly');
const admin = useAdministrator();
const manager = useManager();
const userId = useSelector((state) => state.session.user.id);