Commit 5710c1aa authored by Vinnie Okada's avatar Vinnie Okada

Update snippet authorization

Allow authors and admins to update the visibility level of personal and
project snippets.
parent 9623b71a
...@@ -225,13 +225,15 @@ class Ability ...@@ -225,13 +225,15 @@ class Ability
[:issue, :note, :project_snippet, :personal_snippet, :merge_request].each do |name| [:issue, :note, :project_snippet, :personal_snippet, :merge_request].each do |name|
define_method "#{name}_abilities" do |user, subject| define_method "#{name}_abilities" do |user, subject|
if subject.author == user if subject.author == user || user.is_admin?
[ rules = [
:"read_#{name}", :"read_#{name}",
:"write_#{name}", :"write_#{name}",
:"modify_#{name}", :"modify_#{name}",
:"admin_#{name}" :"admin_#{name}"
] ]
rules.push(:change_visibility_level) if subject.is_a?(Snippet)
rules
elsif subject.respond_to?(:assignee) && subject.assignee == user elsif subject.respond_to?(:assignee) && subject.assignee == user
[ [
:"read_#{name}", :"read_#{name}",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment