-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UI: Fix new bugs from disable/enable feature #537
Conversation
Generated by E2E-Test |
19ff5d0
to
a4bc67f
Compare
Remaining:
|
9db3e7d
to
6b8fd60
Compare
@@ -86,7 +86,7 @@ export function addHttpHandler(server: FastifyInstance, urlPrefix: string, servi | |||
const userPermissionsResult = await service.getUserPermissions(ctx, user, userId); | |||
|
|||
if (Result.isErr(userPermissionsResult)) { | |||
throw new VError(userPermissionsResult, "user.intent.revokePermission failed"); | |||
throw new VError(userPermissionsResult, "user.intent.listPermission failed"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correction of previous refactor PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is an own endpoint for listAssigments needed?
Suggestion: Open up the confirmation dialog when the disableUser saga is called. After confirmation the frontend tries to disable the user, but get an error which leads to a filled assignments table in the confirmation dialog.
When the new endpoint should be kept the permission for the intent listAssignments should be the intent global.listAssignments not global.disableUser. If the issuer has the global.listAssignments permission but cannot view the projects, subproject or workflowitem the api cannot give information about where the user is assigned to.
Use the existing ConfirmationDialog.
userId: UserDisable.RequestData, | ||
issuer: ServiceUser, | ||
issuerOrganization: string, | ||
user: UserAssignmentsGet.RequestData, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
user: UserAssignmentsGet.RequestData, | |
requestData: UserAssignmentsGet.RequestData, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -13,7 +13,11 @@ const styles = { | |||
paperRoot: { | |||
width: "100%", | |||
overflow: "scrollable" | |||
} | |||
}, | |||
container: {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove empty styles
@@ -0,0 +1,241 @@ | |||
import { Typography } from "@material-ui/core"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the ConfirmationDialog component
@@ -0,0 +1,79 @@ | |||
import { Typography } from "@material-ui/core"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the ConfirmationDialog component
@@ -18,7 +18,11 @@ const styles = { | |||
paperRoot: { | |||
width: "100%", | |||
overflow: "scrollable" | |||
} | |||
}, | |||
container: {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove empty styles
infoIcon: { | ||
fontSize: 20, | ||
marginRight: "10px" | ||
}, | ||
info: { | ||
display: "flex", | ||
paddingRight: 20 | ||
} | ||
}, | ||
customWidth: {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove empty styles
frontend/src/pages/Users/actions.js
Outdated
@@ -70,6 +70,15 @@ export const ENABLE_USER_SUCCESS = "ENABLE_USER_SUCCESS"; | |||
export const DISABLE_USER = " DISABLE_USER"; | |||
export const DISABLE_USER_SUCCESS = " DISABLE_USER_SUCCESS"; | |||
|
|||
export const SHOW_ENABLE_DIALOG = "SHOW_ENABLE_DIALOG"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed if using the existing confirmation dialog
d3b7798
to
9b26018
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a console warning in frontend when creating a new group.
when canceling the createUser/createGroup dialog listpermissions are fetched and the site is rerendered. If the dialog is canceled nothing should be fetched
); | ||
}); | ||
|
||
it("A user can view user assignments of worklfowitems with view permissions", async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
workflowitems
for await (const subproject of subprojects) { | ||
if (subproject.status === "closed") continue; | ||
if (subproject.assignee === userId) { | ||
assignedSubprojects.push(subproject); | ||
if (!isRoot && !Subproject.permits(subproject, issuer, subprojectIntents)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cannot be root because a root user cannot be assigned to a subproject
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, this checks if the issuer is the root-user
for await (const workflowitem of workflowitems) { | ||
if (workflowitem.status === "closed") continue; | ||
if (workflowitem.assignee === userId) { | ||
assignedWorkflowitems.push(workflowitem); | ||
if (!isRoot && !Workflowitem.permits(workflowitem, issuer, workflowitemIntents)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cannot be root because a root user cannot be assigned to a workflowitem
for await (const project of projects) { | ||
if (project.status === "closed") continue; | ||
if (project.assignee === userId) { | ||
assignedProjects.push(project); | ||
if (!isRoot && !Project.permits(project, issuer, projectIntents)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cannot be root because a root user cannot be assigned to a project
expect(xhr.response.body.error.code).to.eql(412); | ||
}); | ||
cy.get(`[data-test=confirmation-dialog-confirm]`).should("be.disabled"); | ||
cy.wait("@fetchAssignments"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why wait for that call? It's the end of the test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I change the position
expect(xhr.response.body.error.code).to.eql(412); | ||
}); | ||
cy.get(`[data-test=confirmation-dialog-confirm]`).should("be.disabled"); | ||
cy.wait("@fetchAssignments"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why wait for that call? It's the end of the test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I change the position
@@ -34,6 +34,9 @@ import { applyOriginalActions, createAdditionalActions } from "./createAdditiona | |||
import { executeOriginalActions } from "./executeOriginalActions"; | |||
|
|||
class ConfirmationContainer extends React.Component { | |||
componentDidMount() { | |||
this.props.cancelConfirmation(undefined); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this is needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed to reset the redux state of Confirmation Dialog component. Bugs occurred after pressing the submit button and the API rejects the request - in this case, the submit-state remains true in redux store, hence the dialog is not showing up anymore (and the request are send immediately - without confirmation)
Solution: cancelConfirmation()
only sets defaultState. For better readability, I should create another function called resetConfirmation()
that also set the redux state to defaultState.
Another solution: Add action CONFIRMATION_UNSUCESSFULL
and yield it on every API error related to confirmation dialog. This action resets redux state of confirmation dialog like this state.set("confirmed", defaultState.get("confirmed"));
<a href={url} target="_blank" rel="noopener noreferrer"> | ||
{assignment.displayName} | ||
</a> | ||
<br /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use css styles instead of br tags
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
When a user is fetching assignments, he only gets data from projects, subprojects and workflowitems when he has view permissions, respectively.
Refactored the Dialogs for enabling/disabling users.
e4cc957
to
7e2e902
Compare
Closes #536