Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/extensions/rbac/RBACManagementModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ export const RBACManagementModal = ({ open, handleClose, currentRole, createNoti

const handleSave = async () => {
createNotification('Updating', `Access for role '${currentRole}' is being updated, please wait...`);
console.log(selectedUsers);
updateUsers(
driver,
currentRole,
Expand Down
46 changes: 24 additions & 22 deletions src/extensions/rbac/RBACUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,34 +265,36 @@ export async function updateUsers(driver, currentRole, allUsers, selectedUsers,
`REVOKE ROLE ${currentRole} FROM ${escapedAllUsers}`,
{},
1000,
(status) => {
async (status) => {
globalStatus = status;
if (globalStatus == QueryStatus.NO_DATA || globalStatus == QueryStatus.COMPLETE) {
// TODO: Neo4j is very slow in updating after the previous query, even though it is technically a finished query.
// We build in an artificial delay... This must be improved the future.
setTimeout(async () => {
if (selectedUsers.length > 0) {
const escapedSelectedUsers = selectedUsers.map((user) => `\`${user}\``).join(',');
await runCypherQuery(
driver,
'system',
`GRANT ROLE ${currentRole} TO ${escapedSelectedUsers};`,
{},
1000,
(status) => {
if (status == QueryStatus.NO_DATA || QueryStatus.COMPLETE) {
onSuccess();
}
}
);
} else {
onSuccess();
}
}, 2000);
}
},
(records) => {
if (records && records[0] && records[0].error) {
onFail(records[0].error);
}
}
);
if (globalStatus == QueryStatus.NO_DATA || globalStatus == QueryStatus.COMPLETE) {
// TODO: Neo4j is very slow in updating after the previous query, even though it is technically a finished query.
// We build in an artificial delay...
if (selectedUsers.length > 0) {
const escapedSelectedUsers = selectedUsers.map((user) => `\`${user}\``).join(',');
await runCypherQuery(
driver,
'system',
`GRANT ROLE ${currentRole} TO ${escapedSelectedUsers}`,
{},
1000,
(status) => {
if (status == QueryStatus.NO_DATA || QueryStatus.COMPLETE) {
onSuccess();
}
}
);
} else {
onSuccess();
}
}
}