-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add Role-based restriction to backend mutations #594
Add Role-based restriction to backend mutations #594
Conversation
e227b4c
to
e4c8fde
Compare
@@ -1,4 +1,5 @@ | |||
using System; | |||
using System.Linq; |
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.
probably don't need linq here
public Note EditNote(string noteId, string text) | ||
{ | ||
Note note = _noteService.GetNote(noteId); | ||
return _noteService.EditNote(note, text); |
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 guess we are not using, nor want to have the possibility to edit Notes?
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.
That's my so-far conclusion, yes.
This mutation is unused and there are currently no UI support for
editing notes - nor is any such feature planned.
Updating and maintaining this mutation without any current or future planned use-case for it seams like unnecessary work. If we ever need it, we can revert this commit
79b3e48
to
55afd45
Compare
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
The goal is to implement restrictions for which roles can do what mutations in the backend. To that end the AssertIsFacilitator is replaced by the more general AssertCanPerformMutation. To avoid having to replicate AssertCanPerformMutation in the mocked version of the AuthService, the method is also moved to the Mutation class.
Extend the functionallity of the MockAuthService class to allow setting different "signed-in"-users.
This commit implements role-based restrictions on the CreateParticipant mutation. Only Facilitator and OrganizationLead can use this mutation. As a consequence, the seeding logic in the cypress test needs to be updated to ensure that the mutation is only performed by a Facilitator.
This commit implements role-based restrictions on the SetAnswer mutation. This effectively excludes Read-Only participants and non-participating users from using this mutation.
This commit implements role-based restrictions on the CreateAction mutation. This effectively excludes Read-Only participants and non-participating users from using this mutation. Whether Role.Participant should be able to create actions is currently up for debate, so this might be subject to change.
This commit implements role-based restrictions on the EditAction mutation. This effectively excludes Read-Only participants and non-participating users from using this mutation. Whether Role.Participant should be able to create actions is currently up for debate, so this might be subject to change.
This commit implements role-based restrictions on the DeleteAction mutation. Only Facilitators are permitted to use this mutation.
This commit implements role-based restrictions on the CreateNote mutation. This effectively excludes Read-Only participants and non-participating users from using this mutation.
This mutation is unused and there are currently no UI support for editing notes - nor is any such feature planned.
This commit implements role-based restrictions on the CreateClosingRemark mutation. This effectively excludes Read-Only participants and non-participating users from using this mutation. Whether Role.Participant should be able to create closing remarks is currently up for debate, so this might be subject to change.
This commit implements role-based restrictions on the DeleteParticipant mutation. Only Facilitator and OrganizationLead are permitted to use this mutation.
This commit implements role-based restrictions on the ProgressParticipant mutation. This effectively excludes Read-Only participants and non-participating users from using this mutation
55afd45
to
53e42d7
Compare
This PR adds role-based restrictions to all exposed mutations. Additionally it extends the current test-framework to test the new restrictions.
The test framework for Mutation testing in the backend only implements access-based tests at the moment, but it is intended to be used for further correctness testing of the mutations. However that is out of scope of this PR.
Closes #537
Closes #512