summaryrefslogtreecommitdiff
path: root/app/graphql/mutations/base_mutation.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/mutations/base_mutation.rb')
-rw-r--r--app/graphql/mutations/base_mutation.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/graphql/mutations/base_mutation.rb b/app/graphql/mutations/base_mutation.rb
index ac5ddc5bd4c..a53cc72d904 100644
--- a/app/graphql/mutations/base_mutation.rb
+++ b/app/graphql/mutations/base_mutation.rb
@@ -28,8 +28,12 @@ module Mutations
end
def ready?(**args)
+ auth = ::Gitlab::Graphql::Authorize::ObjectAuthorization.new(:execute_graphql_mutation, :api)
+
if Gitlab::Database.read_only?
raise Gitlab::Graphql::Errors::ResourceNotAvailable, ERROR_MESSAGE
+ elsif !auth.ok?(:global, current_user, scope_validator: context[:scope_validator])
+ raise_resource_not_available_error!
else
true
end