|
@@ -100,15 +100,13 @@ const Username = () => {
|
|
|
<Pref labelId={labelId} title={t("account_basics_username_title")} description={t("account_basics_username_description")}>
|
|
<Pref labelId={labelId} title={t("account_basics_username_title")} description={t("account_basics_username_description")}>
|
|
|
<div aria-labelledby={labelId}>
|
|
<div aria-labelledby={labelId}>
|
|
|
{session.username()}
|
|
{session.username()}
|
|
|
- {account?.role === Role.ADMIN ? (
|
|
|
|
|
|
|
+ {account?.role === Role.ADMIN && (
|
|
|
<>
|
|
<>
|
|
|
{" "}
|
|
{" "}
|
|
|
<Tooltip title={t("account_basics_username_admin_tooltip")}>
|
|
<Tooltip title={t("account_basics_username_admin_tooltip")}>
|
|
|
<span style={{ cursor: "default" }}>👑</span>
|
|
<span style={{ cursor: "default" }}>👑</span>
|
|
|
</Tooltip>
|
|
</Tooltip>
|
|
|
</>
|
|
</>
|
|
|
- ) : (
|
|
|
|
|
- ""
|
|
|
|
|
)}
|
|
)}
|
|
|
</div>
|
|
</div>
|
|
|
</Pref>
|
|
</Pref>
|
|
@@ -119,6 +117,7 @@ const ChangePassword = () => {
|
|
|
const { t } = useTranslation();
|
|
const { t } = useTranslation();
|
|
|
const [dialogKey, setDialogKey] = useState(0);
|
|
const [dialogKey, setDialogKey] = useState(0);
|
|
|
const [dialogOpen, setDialogOpen] = useState(false);
|
|
const [dialogOpen, setDialogOpen] = useState(false);
|
|
|
|
|
+ const { account } = useContext(AccountContext);
|
|
|
const labelId = "prefChangePassword";
|
|
const labelId = "prefChangePassword";
|
|
|
|
|
|
|
|
const handleDialogOpen = () => {
|
|
const handleDialogOpen = () => {
|
|
@@ -136,9 +135,19 @@ const ChangePassword = () => {
|
|
|
<Typography color="gray" sx={{ float: "left", fontSize: "0.7rem", lineHeight: "3.5" }}>
|
|
<Typography color="gray" sx={{ float: "left", fontSize: "0.7rem", lineHeight: "3.5" }}>
|
|
|
⬤⬤⬤⬤⬤⬤⬤⬤⬤⬤
|
|
⬤⬤⬤⬤⬤⬤⬤⬤⬤⬤
|
|
|
</Typography>
|
|
</Typography>
|
|
|
- <IconButton onClick={handleDialogOpen} aria-label={t("account_basics_password_description")}>
|
|
|
|
|
- <EditIcon />
|
|
|
|
|
- </IconButton>
|
|
|
|
|
|
|
+ {!account?.provisioned ? (
|
|
|
|
|
+ <IconButton onClick={handleDialogOpen} aria-label={t("account_basics_password_description")}>
|
|
|
|
|
+ <EditIcon />
|
|
|
|
|
+ </IconButton>
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <Tooltip title={t("account_basics_cannot_edit_or_delete_provisioned_user")}>
|
|
|
|
|
+ <span>
|
|
|
|
|
+ <IconButton disabled>
|
|
|
|
|
+ <EditIcon />
|
|
|
|
|
+ </IconButton>
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </Tooltip>
|
|
|
|
|
+ )}
|
|
|
</div>
|
|
</div>
|
|
|
<ChangePasswordDialog key={`changePasswordDialog${dialogKey}`} open={dialogOpen} onClose={handleDialogClose} />
|
|
<ChangePasswordDialog key={`changePasswordDialog${dialogKey}`} open={dialogOpen} onClose={handleDialogClose} />
|
|
|
</Pref>
|
|
</Pref>
|
|
@@ -888,7 +897,7 @@ const TokensTable = (props) => {
|
|
|
</div>
|
|
</div>
|
|
|
</TableCell>
|
|
</TableCell>
|
|
|
<TableCell align="right" sx={{ whiteSpace: "nowrap" }}>
|
|
<TableCell align="right" sx={{ whiteSpace: "nowrap" }}>
|
|
|
- {token.token !== session.token() && (
|
|
|
|
|
|
|
+ {token.token !== session.token() && !token.provisioned && (
|
|
|
<>
|
|
<>
|
|
|
<IconButton onClick={() => handleEditClick(token)} aria-label={t("account_tokens_dialog_title_edit")}>
|
|
<IconButton onClick={() => handleEditClick(token)} aria-label={t("account_tokens_dialog_title_edit")}>
|
|
|
<EditIcon />
|
|
<EditIcon />
|
|
@@ -910,6 +919,18 @@ const TokensTable = (props) => {
|
|
|
</span>
|
|
</span>
|
|
|
</Tooltip>
|
|
</Tooltip>
|
|
|
)}
|
|
)}
|
|
|
|
|
+ {token.provisioned && (
|
|
|
|
|
+ <Tooltip title={t("account_tokens_table_cannot_delete_or_edit_provisioned_token")}>
|
|
|
|
|
+ <span>
|
|
|
|
|
+ <IconButton disabled>
|
|
|
|
|
+ <EditIcon />
|
|
|
|
|
+ </IconButton>
|
|
|
|
|
+ <IconButton disabled>
|
|
|
|
|
+ <CloseIcon />
|
|
|
|
|
+ </IconButton>
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </Tooltip>
|
|
|
|
|
+ )}
|
|
|
</TableCell>
|
|
</TableCell>
|
|
|
</TableRow>
|
|
</TableRow>
|
|
|
))}
|
|
))}
|
|
@@ -1048,6 +1069,7 @@ const DeleteAccount = () => {
|
|
|
const { t } = useTranslation();
|
|
const { t } = useTranslation();
|
|
|
const [dialogKey, setDialogKey] = useState(0);
|
|
const [dialogKey, setDialogKey] = useState(0);
|
|
|
const [dialogOpen, setDialogOpen] = useState(false);
|
|
const [dialogOpen, setDialogOpen] = useState(false);
|
|
|
|
|
+ const { account } = useContext(AccountContext);
|
|
|
|
|
|
|
|
const handleDialogOpen = () => {
|
|
const handleDialogOpen = () => {
|
|
|
setDialogKey((prev) => prev + 1);
|
|
setDialogKey((prev) => prev + 1);
|
|
@@ -1061,9 +1083,19 @@ const DeleteAccount = () => {
|
|
|
return (
|
|
return (
|
|
|
<Pref title={t("account_delete_title")} description={t("account_delete_description")}>
|
|
<Pref title={t("account_delete_title")} description={t("account_delete_description")}>
|
|
|
<div>
|
|
<div>
|
|
|
- <Button fullWidth={false} variant="outlined" color="error" startIcon={<DeleteOutlineIcon />} onClick={handleDialogOpen}>
|
|
|
|
|
- {t("account_delete_title")}
|
|
|
|
|
- </Button>
|
|
|
|
|
|
|
+ {!account?.provisioned ? (
|
|
|
|
|
+ <Button fullWidth={false} variant="outlined" color="error" startIcon={<DeleteOutlineIcon />} onClick={handleDialogOpen}>
|
|
|
|
|
+ {t("account_delete_title")}
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <Tooltip title={t("account_basics_cannot_edit_or_delete_provisioned_user")}>
|
|
|
|
|
+ <span>
|
|
|
|
|
+ <Button fullWidth={false} variant="outlined" color="error" startIcon={<DeleteOutlineIcon />} disabled>
|
|
|
|
|
+ {t("account_delete_title")}
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </Tooltip>
|
|
|
|
|
+ )}
|
|
|
</div>
|
|
</div>
|
|
|
<DeleteAccountDialog key={`deleteAccountDialog${dialogKey}`} open={dialogOpen} onClose={handleDialogClose} />
|
|
<DeleteAccountDialog key={`deleteAccountDialog${dialogKey}`} open={dialogOpen} onClose={handleDialogClose} />
|
|
|
</Pref>
|
|
</Pref>
|