Design view: relax permissions for updateImageDiffNote mutation
Problem to solve
We scope updateImageDiffNote
mutation to users with admin_note
permission for individual notes.
On the frontend at GitLab, we currently only use this mutation to update the notes position
.
The current behaviour is that most users are unable to move another user's note's position
. The desired behaviour is that all users of design management are able to move all pins (even those that are not their own).
Intended users
All users of design management
Backend Proposal
- Add a new permission on
Note
called:reposition_note
. This would be the same as:admin_note
but would additionally betrue
ifnoteable
is aDesign
and user can:create_note
on theDesign
. - Expose new
:reposition_note
permission in GraphQLNotePermissions
type. - Add a new
repositionImageDiffNote
mutation, that takesnote_id
,x
,y
,width
,height
args.note_id
must be the Global ID of aDiffNote
. User must have:reposition_note
permission on the note. (The name of the mutation has been chosen to be consistent with the existing note mutation naming conventions)
Frontend Proposal
frontend will need to update note-moving logic to cater for the new mutation and/or scope
Availability & Testing
-
frontend will need to update jest specs that check for inability to move a note without
adminNote
permission. - Unit tests of new mutation (including authorization, error messages, and what happens when not passed a note global id)
Links / references
- This was originally discussed in #34353 (comment 279883816)
Testing Activity
- Yes, at the service, mutation and feature level
- Unit tests + request test of mutation, including authorization
MR Breakdown
- The issue is well specified. The intent is to add a new mutation solely for repositioning notes given the
:create_note
permission. This will require a new mutation, possibly a new service and new request and feature specs- Could be done in one, but it will be on the chunky side. May grow to two if splitting is necessary
- Based on #207334 (closed)
Documentation
- FE docs will be required
Edited by Luke Duncalfe