Commit 9c5f3446 authored by James Lopez's avatar James Lopez

Merge branch 'sy-organize-dashboard-service-permissions' into 'master'

Move cluster permissions check to dashboard service subclass

See merge request gitlab-org/gitlab!23361
parents 7da363cc 540a3dd7
......@@ -38,13 +38,9 @@ module Metrics
# Determines whether users should be able to view
# dashboards at all.
def allowed?
if params[:environment]
Ability.allowed?(current_user, :read_environment, project)
elsif params[:cluster]
true # Authorization handled at controller level
else
false
end
return false unless params[:environment]
Ability.allowed?(current_user, :read_environment, project)
end
# Returns a new dashboard Hash, supplemented with DB info
......
......@@ -13,6 +13,11 @@ module Metrics
STAGES::ClusterEndpointInserter,
STAGES::Sorter
].freeze
# Permissions are handled at the controller level
def allowed?
true
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment