#1952 Accept admin permissions for Copr build
Merged 9 months ago by praiskup. Opened 9 months ago by mfocko.
copr/ mfocko/copr build-permissions  into  main

@@ -136,10 +136,10 @@ 

                  return True

          elif copr.user_id == self.id:

              return True

-         if (self.permissions_for_copr(copr) and

-                 self.permissions_for_copr(copr).copr_builder ==

-                 helpers.PermissionEnum("approved")):

-             return True

+         if permissions := self.permissions_for_copr(copr):

+             builder, admin = permissions.copr_builder, permissions.copr_admin

+             if helpers.PermissionEnum("approved") in (builder, admin):

+                 return True

          return False

  

      @property

As discussed in https://github.com/packit/packit-service/issues/1136,
admins of Copr repositories still need to have approved builder
permissions for submitting Copr builds.

Change the behavior to accept admin privileges too without a need to
explicitly grant the permissions either manually or automatically.

Signed-off-by: Matej Focko mfocko@redhat.com

Build succeeded.

LGTM +1
Although I had to look it up what := is
https://www.python.org/dev/peps/pep-0572
This is available since 3.8 and we have right now on server 3.9.5. So it is fine.

It seems to be isolated to that function, cause if I give packit the admin permissions, frontend is adjusted to it and automatically hides builder (e.g. https://i.imgur.com/HdjXVH2.png).

Also requesting builder while having admin doesn't affect the already approved permissions.

rebased onto 34356b709190ecc63eb52fb6fec40a5df3ce50fe

9 months ago

Build succeeded.

rebased onto 571c0ae

9 months ago

Build succeeded.

Pull-Request has been merged by praiskup

9 months ago
Metadata