diff options
author | Gosia Ksionek <mksionek@gitlab.com> | 2019-04-05 18:49:46 +0000 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-04-05 18:49:46 +0000 |
commit | 64858317adc4f017fe589342155faba9df31f093 (patch) | |
tree | 79a7db7e36ca4c6cd5b2b9090030e4a397e94ab4 /app/policies | |
parent | 8cdda8f79a1f747e2f8e393ca505d3142a958033 (diff) | |
download | gitlab-ce-64858317adc4f017fe589342155faba9df31f093.tar.gz |
Add part of needed code
Add columns to store project creation settings
Add project creation level column in groups
and default project creation column in application settings
Remove obsolete line from schema
Update migration with project_creation_level column existence check
Rename migrations to avoid conflicts
Update migration methods
Update migration method
Diffstat (limited to 'app/policies')
-rw-r--r-- | app/policies/group_policy.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/policies/group_policy.rb b/app/policies/group_policy.rb index db49d3bed9c..eb2e536e8e9 100644 --- a/app/policies/group_policy.rb +++ b/app/policies/group_policy.rb @@ -35,6 +35,14 @@ class GroupPolicy < BasePolicy with_options scope: :subject, score: 0 condition(:request_access_enabled) { @subject.request_access_enabled } + condition(:create_projects_disabled) do + @subject.project_creation_level == ::Gitlab::Access::NO_ONE_PROJECT_ACCESS + end + + condition(:developer_maintainer_access) do + @subject.project_creation_level == ::Gitlab::Access::DEVELOPER_MAINTAINER_PROJECT_ACCESS + end + rule { public_group }.policy do enable :read_group enable :read_list @@ -115,6 +123,9 @@ class GroupPolicy < BasePolicy rule { ~can_have_multiple_clusters & has_clusters }.prevent :add_cluster + rule { developer & developer_maintainer_access }.enable :create_projects + rule { create_projects_disabled }.prevent :create_projects + def access_level return GroupMember::NO_ACCESS if @user.nil? |