MSP-3542 update permissions in SessionsPage and SecurityLogPage
This commit is contained in:
1 parent
3b129d4c52
commit
f27e0ff5a9
2 files changed
+5
-6
No files matched your search
@@ -33,7 +33,7 @@ const SecurityLogPage = () => {
|
|||||||
const [currentPage, setCurrentPage] = useState(1)
|
const [currentPage, setCurrentPage] = useState(1)
|
||||||
|
|
||||||
const isLoading = isUsersLoading || isLoadingLogs
|
const isLoading = isUsersLoading || isLoadingLogs
|
||||||
const isPageAvailable = hasPermission(PermissionKeysType.read)
|
const isPageAvailable = hasPermission(PermissionKeysType.security_log_view)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getAllLogs({ limit, offset: 0 })
|
getAllLogs({ limit, offset: 0 })
|
||||||
|
|||||||
@@ -14,8 +14,6 @@ import { useNavigate } from 'react-router-dom'
|
|||||||
|
|
||||||
import { SessionStatusKeysType, sessionStatuses } from '@constants/statuses'
|
import { SessionStatusKeysType, sessionStatuses } from '@constants/statuses'
|
||||||
|
|
||||||
import CanEdit from '@components/CanEdit'
|
|
||||||
|
|
||||||
import { getUserFullName } from '@utils/userUtils/getFullNameUtil'
|
import { getUserFullName } from '@utils/userUtils/getFullNameUtil'
|
||||||
|
|
||||||
import useRole from '@hooks/useRole'
|
import useRole from '@hooks/useRole'
|
||||||
@@ -47,7 +45,8 @@ const SessionsPage = () => {
|
|||||||
|
|
||||||
const isLoading = isUsersLoading || isLoadingSession
|
const isLoading = isUsersLoading || isLoadingSession
|
||||||
|
|
||||||
const isPageAvailable = hasPermission(PermissionKeysType.read)
|
const isPageAvailable = hasPermission(PermissionKeysType.session_view)
|
||||||
|
const hasRevokePermission = hasPermission(PermissionKeysType.session_revoke)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isPageAvailable) {
|
if (!isPageAvailable) {
|
||||||
@@ -124,7 +123,7 @@ const SessionsPage = () => {
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<CanEdit>
|
{hasRevokePermission && (
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title="Закончить эту сессию?"
|
title="Закончить эту сессию?"
|
||||||
onConfirm={() => handleRevokeSessions(record.id)}
|
onConfirm={() => handleRevokeSessions(record.id)}
|
||||||
@@ -136,7 +135,7 @@ const SessionsPage = () => {
|
|||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Popconfirm>
|
</Popconfirm>
|
||||||
</CanEdit>
|
)}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user