blob: f2f18406bd35b178f368c1526fd87877749a34fc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# frozen_string_literal: true
class ProjectMemberPolicy < BasePolicy
delegate { @subject.project }
condition(:target_is_owner, scope: :subject) { @subject.user == @subject.project.owner }
condition(:target_is_self) { @user && @subject.user == @user }
rule { anonymous }.prevent_all
rule { target_is_owner }.prevent_all
rule { can?(:admin_project_member) }.policy do
enable :update_project_member
enable :destroy_project_member
end
rule { target_is_self }.enable :destroy_project_member
end
|