Closed Bug 1256051 Opened 8 years ago Closed 8 years ago

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

Categories

(bugzilla.mozilla.org Graveyard :: Extensions: MozReview Integration, defect)

Production
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mcote, Assigned: dylan)

References

Details

Attachments

(1 file, 1 obsolete file)

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
Attached 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)
Attached patch 1256051_2.patchSplinter Review
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: 8 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.

Attachment

General

Created:
Updated:
Size: