#2322 Side tags: allow admin ops and misc fixes
Merged 3 years ago by tkopecek. Opened 3 years ago by nphilipp.

file modified
+6 -1
@@ -34,14 +34,19 @@ 

      if not result and raise_error:

          raise koji.GenericError("Not a sidetag: %(name)s" % taginfo)

  

+     return result

+ 

  

  def is_sidetag_owner(taginfo, user, raise_error=False):

      """Check, that given user is owner of the sidetag"""

      result = (taginfo['extra'].get('sidetag') and

-               taginfo['extra'].get('sidetag_user_id') == user['id'])

+               (taginfo['extra'].get('sidetag_user_id') == user['id'] or

+                context.session.hasPerm('admin'))))

      if not result and raise_error:

          raise koji.ActionNotAllowed("This is not your sidetag")

  

+     return result

+ 

  

  # Policy tests

  class SidetagTest(koji.policy.MatchTest):

  • Allow users with admin perms to operate on side tags not their own
  • Actually return results from is_sidetag(), is_sidetag_owner() functions

Fixes #2321

Metadata Update from @tkopecek:
- Pull-request tagged with: bug, testing-ready

3 years ago

Commit 474f346 fixes this pull-request

Pull-Request has been merged by tkopecek

3 years ago

Metadata Update from @jcupova:
- Pull-request tagged with: testing-done

3 years ago