permission handling
parent
7300a0e107
commit
cc743395f3
|
@ -370,8 +370,9 @@ function Role({ treeData, role, webSocketContext, notificationApi }) {
|
|||
{hasPermission(
|
||||
webSocketContext.User.Permissions,
|
||||
Constants.PERMISSIONS.ADMIN_AREA.ROLES.DELETE_ROLE
|
||||
) ? (
|
||||
role.Master || getUsersInRole().length > 0 ? (
|
||||
) && (
|
||||
<>
|
||||
{role.Master || getUsersInRole().length > 0 ? (
|
||||
<DeleteOutlined
|
||||
style={{
|
||||
color: "rgba(0, 0, 0, 0.25)",
|
||||
|
@ -389,13 +390,14 @@ function Role({ treeData, role, webSocketContext, notificationApi }) {
|
|||
<DeleteOutlined />
|
||||
</Tooltip>
|
||||
</Popconfirm>
|
||||
)
|
||||
) : null}
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
{hasPermission(
|
||||
webSocketContext.User.Permissions,
|
||||
Constants.PERMISSIONS.ADMIN_AREA.ROLES.MOVE_ROLE_UP_DOWN
|
||||
) ? (
|
||||
) && (
|
||||
<>
|
||||
{role.SortingOrder === 0 ? (
|
||||
<ArrowUpOutlined
|
||||
|
@ -422,7 +424,7 @@ function Role({ treeData, role, webSocketContext, notificationApi }) {
|
|||
</Tooltip>
|
||||
)}
|
||||
</>
|
||||
) : null}
|
||||
)}
|
||||
|
||||
{hasPermission(
|
||||
webSocketContext.User.Permissions,
|
||||
|
@ -432,6 +434,7 @@ function Role({ treeData, role, webSocketContext, notificationApi }) {
|
|||
<SaveOutlined onClick={() => onSaveClick()} />
|
||||
</Tooltip>
|
||||
)}
|
||||
|
||||
<Tooltip title="Close">
|
||||
<CloseOutlined onClick={() => onCloseClick()} />
|
||||
</Tooltip>
|
||||
|
|
|
@ -113,7 +113,9 @@ export default function AllUsers() {
|
|||
let items = [];
|
||||
|
||||
webSocketContext.AllUsers.sort(
|
||||
(a, b) => b.ConnectionStatus - a.ConnectionStatus
|
||||
(a, b) =>
|
||||
webSocketContext.AllRoles.find((r) => r.Id === a.RoleId).SortingOrder -
|
||||
webSocketContext.AllRoles.find((r) => r.Id === b.RoleId).SortingOrder
|
||||
);
|
||||
|
||||
webSocketContext.AllUsers.forEach((user) => {
|
||||
|
|
|
@ -41,6 +41,17 @@ export default function GroupTasks({ isGroupTasksViewModalOpen }) {
|
|||
}
|
||||
});
|
||||
|
||||
if (items.length === 0) {
|
||||
items.push(
|
||||
<Result
|
||||
key="result"
|
||||
status="403"
|
||||
title="You were not assigned to any group tasks"
|
||||
subTitle="Please contact an administrator"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return items;
|
||||
};
|
||||
|
||||
|
|
11
src/utils.js
11
src/utils.js
|
@ -172,6 +172,7 @@ const ReceivedMessagesCommands = {
|
|||
AdminAreaRoleDeleted: 22,
|
||||
UserRoleUpdated: 23,
|
||||
RolePermissionsUpdated: 24,
|
||||
ErrorNoPermissions: 25,
|
||||
};
|
||||
|
||||
// commands sent to the backend server
|
||||
|
@ -736,8 +737,6 @@ export function WebSocketProvider({
|
|||
setUser((user) => {
|
||||
const updatedUser = { ...user };
|
||||
|
||||
console.log("before update", updatedUser.Permissions);
|
||||
|
||||
if (body.AddedPermissions !== undefined) {
|
||||
updatedUser.Permissions = updatedUser.Permissions.concat(
|
||||
body.AddedPermissions
|
||||
|
@ -750,12 +749,16 @@ export function WebSocketProvider({
|
|||
);
|
||||
}
|
||||
|
||||
console.log("updatedUser", updatedUser.Permissions);
|
||||
|
||||
return updatedUser;
|
||||
});
|
||||
}
|
||||
break;
|
||||
case ReceivedMessagesCommands.ErrorNoPermissions:
|
||||
notificationApi["error"]({
|
||||
message: `No permissions`,
|
||||
description: `Please contact the administrator`,
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
console.error("unknown command", cmd);
|
||||
|
|
Loading…
Reference in New Issue