From: Michael Tremer Date: Tue, 5 Jul 2022 14:44:58 +0000 (+0000) Subject: builds: Rework permissions model X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=186d0f9e234db65b98d0c8f11245052e9ef8c4aa;p=pbs.git builds: Rework permissions model Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/builds.py b/src/buildservice/builds.py index 51e62626..4263a291 100644 --- a/src/buildservice/builds.py +++ b/src/buildservice/builds.py @@ -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