Allow MozReview.attachments() to post mozreview-* tags without requiring editbugs

RESOLVED FIXED

Status

defect
RESOLVED FIXED
4 years ago
10 months ago

People

(Reporter: mcote, Assigned: dylan)

Tracking

Production
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

Since editbugs is not required for MozReview usage (which only creates & updates attachments & flags and posts comments), in order to tag comments from MozReview (bug 1226080) the custom MozReview.attachments() API should bypass that permission check but *only* for tags beginning with "mozreview-".  It will still be up to the caller to specify the exact tag.
Assignee: nobody → dylan
Component: Review Board: Extension → Extensions: MozReview Integration
Product: MozReview → bugzilla.mozilla.org
Posted patch 1256051_1.patch (obsolete) — Splinter Review
Alright, this should allow mozreview api keys to set comment tags using the MozReview.attachments() API.

The logic is: "if all tags match /^mozreview-?/ or the user can_tag_comments, let them set comments".

To test this I recommend setting the mozreview_app_id to deadbeefcafe and creating a new API key, and setting that API key's app_id to deadbeefcafe.

Some notes here:

At some point we really need to consider some internal API for mocking group membership. We do this in several places in the code.

Doing this by hand is fraught with difficulty, as methods like "can_tag_comments" cache the result of $user->in_group(), so overloading the list of groups *isn't* enough sometimes.

For this patch, I'm using the "local" directive to temporarily set the $user->{can_tag_comment} to a true value.

Unrelated to this, every time I see the scalar grep in $user->in_group() I sigh a little bit, so I've declared war on scalar/boolean grep upstream.
Attachment #8744547 - Flags: review?(dkl)
without my debugging module
Attachment #8744547 - Attachment is obsolete: true
Attachment #8744547 - Flags: review?(dkl)
Attachment #8746105 - Flags: review?(dkl)
Comment on attachment 8746105 [details] [diff] [review]
1256051_2.patch

Review of attachment 8746105 [details] [diff] [review]:
-----------------------------------------------------------------

r=dkl
Attachment #8746105 - Flags: review?(dkl) → review+
To ssh://gitolite3@git.mozilla.org/webtools/bmo/bugzilla.git
   6b76c8f..977dfb5  master -> master
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Product: bugzilla.mozilla.org → bugzilla.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.