diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/models/ability.rb | 8 | ||||
-rw-r--r-- | app/models/project_team.rb | 16 |
2 files changed, 20 insertions, 4 deletions
diff --git a/app/models/ability.rb b/app/models/ability.rb index 70c26caded8..df9b210dfca 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -71,16 +71,16 @@ class Ability team = project.team # Rules based on role in project - if team.masters.include?(user) + if team.master?(user) rules += project_master_rules - elsif team.developers.include?(user) + elsif team.developer?(user) rules += project_dev_rules - elsif team.reporters.include?(user) + elsif team.reporter?(user) rules += project_report_rules - elsif team.guests.include?(user) + elsif team.guest?(user) rules += project_guest_rules end diff --git a/app/models/project_team.rb b/app/models/project_team.rb index eca13e56061..cc8bb60aac4 100644 --- a/app/models/project_team.rb +++ b/app/models/project_team.rb @@ -117,6 +117,22 @@ class ProjectTeam false end + def guest?(user) + find_tm(user.id).try(:access_field) == Gitlab::Access::GUEST + end + + def reporter?(user) + find_tm(user.id).try(:access_field) == Gitlab::Access::REPORTER + end + + def developer?(user) + find_tm(user.id).try(:access_field) == Gitlab::Access::DEVELOPER + end + + def master?(user) + find_tm(user.id).try(:access_field) == Gitlab::Access::MASTER + end + private def fetch_members(level = nil) |