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
Notecalled:reposition_note. This would be the same as:admin_notebut would additionally betrueifnoteableis aDesignand user can:create_noteon theDesign. - Expose new
:reposition_notepermission in GraphQLNotePermissionstype. - Add a new
repositionImageDiffNotemutation, that takesnote_id,x,y,width,heightargs.note_idmust be the Global ID of aDiffNote. User must have:reposition_notepermission 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
adminNotepermission. - 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_notepermission. 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