]> git.ipfire.org Git - pbs.git/commitdiff
builds: Rework permissions model
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 5 Jul 2022 14:44:58 +0000 (14:44 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 5 Jul 2022 14:44:58 +0000 (14:44 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/builds.py

index 51e62626b11492ea1c8c4caaaf866e1905d6c508..4263a29131fb1e5a3c05ebee72a9137893b8f4f0 100644 (file)
@@ -460,28 +460,15 @@ class Build(base.DataObject):
                if user is None:
                        return False
 
+               # Admins always have permission
                if user.is_admin():
                        return True
 
-               # Check if the user is allowed to manage packages from the critical path.
-               if self.critical_path and not user.has_perm("manage_critical_path"):
-                       return False
-
-               # Search for maintainers...
-
-               # Scratch builds.
-               if self.type == "scratch":
-                       # The owner of a scratch build has the right to do anything with it.
-                       if self.owner_id == user.id:
-                               return True
-
-               # Release builds.
-               elif self.type == "release":
-                       # The maintainer also is allowed to manage the build.
-                       if self.pkg.maintainer == user:
-                               return True
+               # Owners have permission
+               if self.owner == user:
+                       return True
 
-               # Deny permission for all other cases.
+               # No permission
                return False
 
        @property