diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-10-03 23:44:06 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-10-03 23:44:06 +0900 |
commit | 6b7889f750c56962c0674467c3fbfd7976b9b44f (patch) | |
tree | 1491f42c332465194630417afc138010e23fc163 /app/policies | |
parent | fd6776214abb2603ce2fb5dfb078229f0a0195e5 (diff) | |
download | gitlab-ce-6b7889f750c56962c0674467c3fbfd7976b9b44f.tar.gz |
Implement Policy. Use show instead of edit. Chnage db column. fix comments. dry up workers
Diffstat (limited to 'app/policies')
-rw-r--r-- | app/policies/gcp/cluster_policy.rb | 16 | ||||
-rw-r--r-- | app/policies/project_policy.rb | 3 |
2 files changed, 18 insertions, 1 deletions
diff --git a/app/policies/gcp/cluster_policy.rb b/app/policies/gcp/cluster_policy.rb new file mode 100644 index 00000000000..dd0a5bff146 --- /dev/null +++ b/app/policies/gcp/cluster_policy.rb @@ -0,0 +1,16 @@ +module Gcp + class ClusterPolicy < BasePolicy + alias_method :cluster, :subject + + delegate { @subject.project } + + condition(:safe_to_change) do + can?(:master_access) && !cluster.on_creation? + end + + rule { safe_to_change }.policy do + enable :update_cluster + enable :admin_cluster + end + end +end diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb index 279b19eb576..b9894284226 100644 --- a/app/policies/project_policy.rb +++ b/app/policies/project_policy.rb @@ -164,6 +164,7 @@ class ProjectPolicy < BasePolicy enable :create_pipeline enable :update_pipeline enable :create_pipeline_schedule + enable :read_cluster enable :create_merge_request enable :create_wiki enable :push_code @@ -188,7 +189,7 @@ class ProjectPolicy < BasePolicy enable :admin_build enable :admin_container_image enable :admin_pipeline - enable :admin_cluster + enable :create_cluster enable :admin_environment enable :admin_deployment enable :admin_pages |