diff options
author | Douwe Maan <douwe@selenight.nl> | 2016-07-28 16:57:42 -0600 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2016-07-28 16:57:42 -0600 |
commit | ce1843b7dea3b63cfced7800612098a766c68e13 (patch) | |
tree | 3340c4b5aca30047c2e22986c15f355bf3f845fe /app/models/ability.rb | |
parent | 8b1a2e4d0b635c6040cd7e4a7a5870ffae516cb0 (diff) | |
parent | b9b0c0283a001010370741c2683e2fe400bf7599 (diff) | |
download | gitlab-ce-ce1843b7dea3b63cfced7800612098a766c68e13.tar.gz |
Merge branch 'master' into diff-line-comment-vuejs
# Conflicts:
# db/schema.rb
Diffstat (limited to 'app/models/ability.rb')
-rw-r--r-- | app/models/ability.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/models/ability.rb b/app/models/ability.rb index ac3bf441c32..5075076c27b 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -389,6 +389,18 @@ class Ability GroupProjectsFinder.new(group).execute(user).any? end + def can_edit_note?(user, note) + return false if !note.editable? || !user.present? + return true if note.author == user || user.admin? + + if note.project + max_access_level = note.project.team.max_member_access(user.id) + max_access_level >= Gitlab::Access::MASTER + else + false + end + end + def namespace_abilities(user, namespace) rules = [] |