diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-17 18:08:41 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-17 18:08:41 +0000 |
commit | 22a0d312ae82e7dda3073d5d1a5a766d7641738d (patch) | |
tree | 41a677a7212f24e2f29c2fbd5623430f92fb2b45 /app/policies | |
parent | 37eff29d5ce44899e34c7c2ac319b314f2f26d15 (diff) | |
download | gitlab-ce-22a0d312ae82e7dda3073d5d1a5a766d7641738d.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/policies')
-rw-r--r-- | app/policies/project_policy.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb index 7b0297ea81b..ca193acb21c 100644 --- a/app/policies/project_policy.rb +++ b/app/policies/project_policy.rb @@ -83,6 +83,11 @@ class ProjectPolicy < BasePolicy project.merge_requests_allowing_push_to_user(user).any? end + with_scope :subject + condition(:forking_allowed) do + @subject.feature_available?(:forking, @user) + end + with_scope :global condition(:mirror_available, score: 0) do ::Gitlab::CurrentSettings.current_application_settings.mirror_available @@ -203,7 +208,6 @@ class ProjectPolicy < BasePolicy enable :download_code enable :read_statistics enable :download_wiki_code - enable :fork_project enable :create_project_snippet enable :update_issue enable :reopen_issue @@ -232,12 +236,15 @@ class ProjectPolicy < BasePolicy enable :public_access enable :guest_access - enable :fork_project enable :build_download_code enable :build_read_container_image enable :request_access end + rule { can?(:download_code) & forking_allowed }.policy do + enable :fork_project + end + rule { owner | admin | guest | group_member }.prevent :request_access rule { ~request_access_enabled }.prevent :request_access |