summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-10-17 17:23:51 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-11-01 09:37:20 +0100
commit517dd4a3f38ff36feadf5cacf88ce0fdd30be2fe (patch)
tree72e21251a4216068b0c7270935c18824f7db4495 /app
parentb328c7885532ccff70e1f9f7dc970a8dde0c52d6 (diff)
downloadgitlab-ce-517dd4a3f38ff36feadf5cacf88ce0fdd30be2fe.tar.gz
Allow owners to fetch source code in CI buildsallow-owner-to-run-ci-builds
Due to different way of handling owners of a project, they were not allowed to fetch CI sources for project.
Diffstat (limited to 'app')
-rw-r--r--app/policies/project_policy.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb
index fbb3d4507d6..1ee31023e26 100644
--- a/app/policies/project_policy.rb
+++ b/app/policies/project_policy.rb
@@ -2,11 +2,11 @@ class ProjectPolicy < BasePolicy
def rules
team_access!(user)
- owner = user.admin? ||
- project.owner == user ||
+ owner = project.owner == user ||
(project.group && project.group.has_owner?(user))
- owner_access! if owner
+ owner_access! if user.admin? || owner
+ team_member_owner_access! if owner
if project.public? || (project.internal? && !user.external?)
guest_access!
@@ -16,7 +16,7 @@ class ProjectPolicy < BasePolicy
can! :read_build if project.public_builds?
if project.request_access_enabled &&
- !(owner || project.team.member?(user) || project_group_member?(user))
+ !(owner || user.admin? || project.team.member?(user) || project_group_member?(user))
can! :request_access
end
end
@@ -135,6 +135,10 @@ class ProjectPolicy < BasePolicy
can! :destroy_issue
end
+ def team_member_owner_access!
+ team_member_reporter_access!
+ end
+
# Push abilities on the users team role
def team_access!(user)
access = project.team.max_member_access(user.id)