diff options
author | http://jneen.net/ <jneen@jneen.net> | 2016-08-16 23:08:14 +0300 |
---|---|---|
committer | http://jneen.net/ <jneen@jneen.net> | 2016-08-30 21:39:22 +0300 |
commit | d87c1d550f4870275432698e3cb19033c6855a15 (patch) | |
tree | ecc6559dd15a53e4ca4f0ce353479db6d5a573fb /app/policies/note_policy.rb | |
parent | 3656d3b88a01a50a5eaf66a16b6ac47d3c58352c (diff) |
port notes and project snippets
Diffstat (limited to 'app/policies/note_policy.rb')
-rw-r--r-- | app/policies/note_policy.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/app/policies/note_policy.rb b/app/policies/note_policy.rb new file mode 100644 index 00000000000..83847466ee2 --- /dev/null +++ b/app/policies/note_policy.rb @@ -0,0 +1,19 @@ +class NotePolicy < BasePolicy + def rules + delegate! @subject.project + + return unless @user + + if @subject.author == @user + can! :read_note + can! :update_note + can! :admin_note + can! :resolve_note + end + + if @subject.for_merge_request? && + @subject.noteable.author == @user + can! :resolve_note + end + end +end |