From 6bb3df9960e9c607a83af619eaf5a041a452ee34 Mon Sep 17 00:00:00 2001 From: anna Date: Fri, 26 Apr 2024 15:35:58 +0800 Subject: [PATCH] update user auth --- src/pages/User/SearchPage/UserSearchForm.js | 190 ++++++++++---------- src/pages/User/SearchPage/UserTable.js | 3 +- 2 files changed, 99 insertions(+), 94 deletions(-) diff --git a/src/pages/User/SearchPage/UserSearchForm.js b/src/pages/User/SearchPage/UserSearchForm.js index 137e3db..7cf1dd6 100644 --- a/src/pages/User/SearchPage/UserSearchForm.js +++ b/src/pages/User/SearchPage/UserSearchForm.js @@ -9,18 +9,18 @@ import MainCard from "../../../components/MainCard"; import { useForm } from "react-hook-form"; import { - // useEffect, useState } from "react"; import Checkbox from "@mui/material/Checkbox"; -import * as React from "react"; import AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline'; import { useNavigate } from "react-router"; import axios from "axios"; import { GET_EMAIL_LIST } from 'utils/ApiPathConst'; -import {PNSPS_BUTTON_THEME} from "../../../themes/buttonConst"; -import {ThemeProvider} from "@emotion/react"; +import { PNSPS_BUTTON_THEME } from "../../../themes/buttonConst"; +import { ThemeProvider } from "@emotion/react"; + +import { isGrantedAny } from "auth/utils"; // ==============================|| DASHBOARD - DEFAULT ||============================== // @@ -57,12 +57,12 @@ const UserSearchForm = ({ applySearch }) => { setLocked(false); reset(); axios.get(`${GET_EMAIL_LIST}`) - .then(r => { - console.log(r) - }) - .catch(err => { - console.log(err) - }) + .then(r => { + console.log(r) + }) + .catch(err => { + console.log(err) + }) } const handleNewUserClick = () => { @@ -77,9 +77,9 @@ const UserSearchForm = ({ applySearch }) => { content={false}>
- + {/*row 1*/} - + Search @@ -87,69 +87,69 @@ const UserSearchForm = ({ applySearch }) => { {/*row 2*/} - - - + + + - - - + + + - - - + + + - - - + + + - - setLocked(event.target.checked)} - name="checked" - color="primary" - size="small" - /> - } - label={Locked} - /> + + setLocked(event.target.checked)} + name="checked" + color="primary" + size="small" + /> + } + label={Locked} + /> + - {/*last row*/} { alignItems="center"> - - - - - - + {isGrantedAny(["MAINTAIN_USER"]) ? + + : + } - - + + + + + + + + + - diff --git a/src/pages/User/SearchPage/UserTable.js b/src/pages/User/SearchPage/UserTable.js index 0fcee0c..47df44f 100644 --- a/src/pages/User/SearchPage/UserTable.js +++ b/src/pages/User/SearchPage/UserTable.js @@ -8,6 +8,7 @@ import Checkbox from '@mui/material/Checkbox'; import * as HttpUtils from 'utils/HttpUtils'; import { GLD_USER_PATH, GET_USER_LOCK, GET_USER_UNLOCK } from "utils/ApiPathConst"; import { notifyLockSuccess, notifyUnlockSuccess , clickableLink} from 'utils/CommonFunction'; +import { isGrantedAny } from "auth/utils"; // ==============================|| EVENT TABLE ||============================== // @@ -28,7 +29,7 @@ export default function UserTable({searchCriteria}) { }, [reloadTime]); const handleLock = (params) => () => { - // setChangeLocked(false) + if(!isGrantedAny(["MAINTAIN_USER"])) return; if (params.row.locked==true){ doUnlock(params.id) }else{