diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-17 15:17:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-17 15:17:11 +0300 |
commit | dd33e917374b611cd5a596c7fa51b47af6e153f6 (patch) | |
tree | 7e853f9843f01a2f328f334622645f53e3bb11ff /app/policies/group_member_policy.rb | |
parent | 82b0338672c8f39245fe5f317a84f45ae387d319 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/policies/group_member_policy.rb')
-rw-r--r-- | app/policies/group_member_policy.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/policies/group_member_policy.rb b/app/policies/group_member_policy.rb index f7a7286aba7..a394b63fc8e 100644 --- a/app/policies/group_member_policy.rb +++ b/app/policies/group_member_policy.rb @@ -5,6 +5,7 @@ class GroupMemberPolicy < BasePolicy with_scope :subject condition(:last_owner) { @subject.group.member_last_owner?(@subject) || @subject.group.member_last_blocked_owner?(@subject) } + condition(:project_bot) { @subject.user&.project_bot? && @subject.group.member?(@subject.user) } desc "Membership is users' own" with_score 0 @@ -20,11 +21,13 @@ class GroupMemberPolicy < BasePolicy prevent :destroy_group_member end - rule { can?(:admin_group_member) }.policy do + rule { ~project_bot & can?(:admin_group_member) }.policy do enable :update_group_member enable :destroy_group_member end + rule { project_bot & can?(:admin_group_member) }.enable :destroy_project_bot_member + rule { is_target_user }.policy do enable :destroy_group_member end |