2024-07-04 11:26:18: merge [main:50175f6fa5ae6d41dfbbfa36fd0563c0908b3009];
This commit is contained in:
1 parent
5f4a3c55cc
commit
83a1cd2205
9 files changed
+45
-29
No files matched your search
@@ -42,9 +42,9 @@ const RolesPage = () => {
|
||||
const [updateRole] = roleApi.useUpdateRoleMutation()
|
||||
const [removeRole] = roleApi.useRemoveRoleMutation()
|
||||
|
||||
const isPageAvailable = hasPermission(PermissionKeysType.read)
|
||||
const isAddRolePermissions = hasPermission(PermissionKeysType.write)
|
||||
const isRemoveRolePermissions = hasPermission(PermissionKeysType.write)
|
||||
const isPageAvailable = hasPermission(PermissionKeysType.role_view)
|
||||
const isAddRolePermissions = hasPermission(PermissionKeysType.role_add)
|
||||
const isRemoveRolePermissions = hasPermission(PermissionKeysType.role_delete)
|
||||
const isLoading = isPermissionLoading || isRolesLoading
|
||||
|
||||
const isNew = selectedItemId === 'new'
|
||||
|
||||
@@ -33,7 +33,7 @@ const SecurityLogPage = () => {
|
||||
const [currentPage, setCurrentPage] = useState(1)
|
||||
|
||||
const isLoading = isUsersLoading || isLoadingLogs
|
||||
const isPageAvailable = hasPermission(PermissionKeysType.read)
|
||||
const isPageAvailable = hasPermission(PermissionKeysType.security_log_view)
|
||||
|
||||
useEffect(() => {
|
||||
getAllLogs({ limit, offset: 0 })
|
||||
|
||||
@@ -14,8 +14,6 @@ import { useNavigate } from 'react-router-dom'
|
||||
|
||||
import { SessionStatusKeysType, sessionStatuses } from '@constants/statuses'
|
||||
|
||||
import CanEdit from '@components/CanEdit'
|
||||
|
||||
import { getUserFullName } from '@utils/userUtils/getFullNameUtil'
|
||||
|
||||
import useRole from '@hooks/useRole'
|
||||
@@ -47,7 +45,8 @@ const SessionsPage = () => {
|
||||
|
||||
const isLoading = isUsersLoading || isLoadingSession
|
||||
|
||||
const isPageAvailable = hasPermission(PermissionKeysType.read)
|
||||
const isPageAvailable = hasPermission(PermissionKeysType.session_view)
|
||||
const hasRevokePermission = hasPermission(PermissionKeysType.session_revoke)
|
||||
|
||||
useEffect(() => {
|
||||
if (!isPageAvailable) {
|
||||
@@ -124,7 +123,7 @@ const SessionsPage = () => {
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<CanEdit>
|
||||
{hasRevokePermission && (
|
||||
<Popconfirm
|
||||
title="Закончить эту сессию?"
|
||||
onConfirm={() => handleRevokeSessions(record.id)}
|
||||
@@ -136,7 +135,7 @@ const SessionsPage = () => {
|
||||
/>
|
||||
</Tooltip>
|
||||
</Popconfirm>
|
||||
</CanEdit>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -13,8 +13,6 @@ import { useNavigate } from 'react-router-dom'
|
||||
|
||||
import { dateFormats } from '@constants/date.ts'
|
||||
|
||||
import CanEdit from '@components/CanEdit'
|
||||
|
||||
import { getUserFullName } from '@utils/userUtils/getFullNameUtil.ts'
|
||||
|
||||
import useRole from '@hooks/useRole.tsx'
|
||||
@@ -42,8 +40,11 @@ const UsersPage = () => {
|
||||
|
||||
const isLoading = isRolesLoading || isUsersLoading
|
||||
|
||||
const isPageAvailable = hasPermission(PermissionKeysType.read)
|
||||
const hasCreateUserPermission = hasPermission(PermissionKeysType.write)
|
||||
const isPageAvailable = hasPermission(PermissionKeysType.user_view)
|
||||
const hasBlockUserPermission = hasPermission(PermissionKeysType.user_block)
|
||||
const hasDeleteUserPermission = hasPermission(PermissionKeysType.user_delete)
|
||||
const hasUpdateUserPermission = hasPermission(PermissionKeysType.user_update)
|
||||
const hasCreateUserPermission = hasPermission(PermissionKeysType.user_create)
|
||||
|
||||
useEffect(() => {
|
||||
if (!isPageAvailable) {
|
||||
@@ -169,9 +170,9 @@ const UsersPage = () => {
|
||||
render: (_, record) => {
|
||||
return (
|
||||
<div className="users-page__content__table__actions">
|
||||
<CanEdit>
|
||||
<Button.Group className="button_group">
|
||||
{renderBlockButton(record)}
|
||||
{hasBlockUserPermission && renderBlockButton(record)}
|
||||
{hasUpdateUserPermission && (
|
||||
<Tooltip key="EditOutlined" title="Редактировать пользователя">
|
||||
<Button
|
||||
data-cy={`users-page__content__table__actions__edit-btn ${record.id}`}
|
||||
@@ -184,7 +185,8 @@ const UsersPage = () => {
|
||||
}}
|
||||
/>
|
||||
</Tooltip>
|
||||
|
||||
)}
|
||||
{hasDeleteUserPermission && (
|
||||
<Popconfirm
|
||||
title="Вы действительно хотите удалить этого пользователя?"
|
||||
onConfirm={() => handleDeleteUser(record.id)}
|
||||
@@ -197,8 +199,8 @@ const UsersPage = () => {
|
||||
/>
|
||||
</Tooltip>
|
||||
</Popconfirm>
|
||||
)}
|
||||
</Button.Group>
|
||||
</CanEdit>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user