summaryrefslogtreecommitdiff
path: root/app/policies
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-07 18:09:19 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-07 18:09:19 +0000
commit3290d46655f07d7ae3dca788d6df9f326972ffd8 (patch)
tree0d24713e1592cdd3583257f14a52d46a22539ed1 /app/policies
parentc6b3ec3f56fa32a0e0ed3de0d0878d25f1adaddf (diff)
downloadgitlab-ce-3290d46655f07d7ae3dca788d6df9f326972ffd8.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/policies')
-rw-r--r--app/policies/group_policy.rb4
-rw-r--r--app/policies/metrics/dashboard/annotation_policy.rb9
-rw-r--r--app/policies/project_policy.rb4
3 files changed, 17 insertions, 0 deletions
diff --git a/app/policies/group_policy.rb b/app/policies/group_policy.rb
index abd63753908..5e252c8e564 100644
--- a/app/policies/group_policy.rb
+++ b/app/policies/group_policy.rb
@@ -75,6 +75,9 @@ class GroupPolicy < BasePolicy
rule { developer }.policy do
enable :admin_milestone
enable :read_package
+ enable :create_metrics_dashboard_annotation
+ enable :delete_metrics_dashboard_annotation
+ enable :update_metrics_dashboard_annotation
end
rule { reporter }.policy do
@@ -82,6 +85,7 @@ class GroupPolicy < BasePolicy
enable :admin_label
enable :admin_list
enable :admin_issue
+ enable :read_metrics_dashboard_annotation
end
rule { maintainer }.policy do
diff --git a/app/policies/metrics/dashboard/annotation_policy.rb b/app/policies/metrics/dashboard/annotation_policy.rb
new file mode 100644
index 00000000000..25b78e104c4
--- /dev/null
+++ b/app/policies/metrics/dashboard/annotation_policy.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+module Metrics
+ module Dashboard
+ class AnnotationPolicy < BasePolicy
+ delegate { @subject.cluster }
+ delegate { @subject.environment }
+ end
+ end
+end
diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb
index e694963eac0..0f5e4ac378e 100644
--- a/app/policies/project_policy.rb
+++ b/app/policies/project_policy.rb
@@ -224,6 +224,7 @@ class ProjectPolicy < BasePolicy
enable :read_sentry_issue
enable :update_sentry_issue
enable :read_prometheus
+ enable :read_metrics_dashboard_annotation
end
# We define `:public_user_access` separately because there are cases in gitlab-ee
@@ -276,6 +277,9 @@ class ProjectPolicy < BasePolicy
enable :update_deployment
enable :create_release
enable :update_release
+ enable :create_metrics_dashboard_annotation
+ enable :delete_metrics_dashboard_annotation
+ enable :update_metrics_dashboard_annotation
end
rule { can?(:developer_access) & user_confirmed? }.policy do