From 746fae4efedd0e51909e8238e80a7d9c8b972612 Mon Sep 17 00:00:00 2001 From: Jakub Kadlčík Date: Jun 10 2019 09:46:50 +0000 Subject: [frontend] allow group members to delete all projects in the group See #779 Another possiblity would be to print an error message like this "This project is owned by who has exclusive permissions to delete it." But I feel like everybody in a group should be able to do whatever action for their group projects. --- diff --git a/frontend/coprs_frontend/coprs/logic/coprs_logic.py b/frontend/coprs_frontend/coprs/logic/coprs_logic.py index 8c446ad..729de11 100644 --- a/frontend/coprs_frontend/coprs/logic/coprs_logic.py +++ b/frontend/coprs_frontend/coprs/logic/coprs_logic.py @@ -368,10 +368,15 @@ class CoprsLogic(object): Raise InsufficientRightsException if given copr cant be deleted by given user. Return None otherwise. """ + if user.admin or user == copr.user: + return + + if copr.group: + return UsersLogic.raise_if_not_in_group(user, copr.group) + + raise exceptions.InsufficientRightsException( + "Only owners may delete their projects.") - if not user.admin and user != copr.user: - raise exceptions.InsufficientRightsException( - "Only owners may delete their projects.") class CoprPermissionsLogic(object): @classmethod