diff options
author | http://jneen.net/ <jneen@jneen.net> | 2016-08-30 11:10:33 -0700 |
---|---|---|
committer | http://jneen.net/ <jneen@jneen.net> | 2016-08-30 11:39:22 -0700 |
commit | 71765536d0c29e64eb24ce50da9d5fdfc63f9e78 (patch) | |
tree | c6de3bd37af2f988db68c576c5352bff77c487e8 /app/policies | |
parent | 57def53c84091a56f3a2443d214fe80f2c026d00 (diff) | |
download | gitlab-ce-71765536d0c29e64eb24ce50da9d5fdfc63f9e78.tar.gz |
move the rules method to the top #cosmetic
Diffstat (limited to 'app/policies')
-rw-r--r-- | app/policies/project_policy.rb | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb index 4380b00d962..8a1148dece4 100644 --- a/app/policies/project_policy.rb +++ b/app/policies/project_policy.rb @@ -1,4 +1,31 @@ class ProjectPolicy < BasePolicy + def rules + team_access!(user) + + owner = user.admin? || + project.owner == user || + (project.group && project.group.has_owner?(user)) + + owner_access! if owner + + if project.public? || (project.internal? && !user.external?) + guest_access! + public_access! + + # Allow to read builds for internal projects + can! :read_build if project.public_builds? + + if project.request_access_enabled && + !(owner || project.team.member?(user) || project_group_member?(user)) + can! :request_access + end + end + + archived_access! if project.archived? + + disabled_features! + end + def project @subject end @@ -158,33 +185,6 @@ class ProjectPolicy < BasePolicy end end - def rules - team_access!(user) - - owner = user.admin? || - project.owner == user || - (project.group && project.group.has_owner?(user)) - - owner_access! if owner - - if project.public? || (project.internal? && !user.external?) - guest_access! - public_access! - - # Allow to read builds for internal projects - can! :read_build if project.public_builds? - - if project.request_access_enabled && - !(owner || project.team.member?(user) || project_group_member?(user)) - can! :request_access - end - end - - archived_access! if project.archived? - - disabled_features! - end - def anonymous_rules return unless project.public? |