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