diff options
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 = [] |