diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-09-20 15:50:11 -0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-10-19 14:58:24 -0200 |
commit | 32c663ff248f6ad2f2fa10fd2e81d6535fb88fd6 (patch) | |
tree | dfa2dbe7044f47b1d3f80979e12364f25308c7ef /app/policies | |
parent | 701544fb48a5add0cc7cbba729e6438d7a040385 (diff) | |
download | gitlab-ce-32c663ff248f6ad2f2fa10fd2e81d6535fb88fd6.tar.gz |
Use policies to handle with global/project label permissions
Diffstat (limited to 'app/policies')
-rw-r--r-- | app/policies/group_label_policy.rb | 5 | ||||
-rw-r--r-- | app/policies/label_policy.rb | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/app/policies/group_label_policy.rb b/app/policies/group_label_policy.rb new file mode 100644 index 00000000000..4d4052c5800 --- /dev/null +++ b/app/policies/group_label_policy.rb @@ -0,0 +1,5 @@ +class GroupLabelPolicy < BasePolicy + def rules + can! :admin_label if Ability.allowed?(@user, :admin_label, @subject.group) + end +end diff --git a/app/policies/label_policy.rb b/app/policies/label_policy.rb new file mode 100644 index 00000000000..1677ad7f1bb --- /dev/null +++ b/app/policies/label_policy.rb @@ -0,0 +1,7 @@ +class LabelPolicy < BasePolicy + def rules + return unless @user + + can! :admin_label if Ability.allowed?(@user, :admin_label, @subject.project) + end +end |