theforeman/foreman · error · GraphQL::ExecutionError

Unauthorized. You do not have the required permission %s.

Error message

Unauthorized. You do not have the required permission %s.

What it means

Error "Unauthorized. You do not have the required permission %s." thrown in theforeman/foreman.

Source

Thrown at app/graphql/mutations/base_mutation.rb:39

      end
    end

    object_class Types::BaseObject
    input_object_class Types::BaseInputObject

    private

    delegate :resource_class, to: :class

    def authorize!(resource, action)
      user = context[:current_user]
      authorizer = Authorizer.new(user)
      permission_name = resource.permission_name(action)

      return if action == :create && authorizer.can?(permission_name)
      return if action != :create && authorizer.can?(permission_name, resource)

      raise GraphQL::ExecutionError.new(
        _('Unauthorized. You do not have the required permission %s.') % permission_name
      )
    end

    def validate_object(resource)
      unless resource.is_a?(resource_class)
        raise GraphQL::ExecutionError.new("Resource mismatch, expected #{resource_class.name}, got #{resource.class.name}")
      end
    end

    def load_object_by(id:)
      object = GraphQL::Batch.batch { ForemanGraphqlSchema.object_from_id(id, context) }

      raise GraphQL::ExecutionError.new(_('Could not resolve ID.')) unless object

      validate_object(object)

      object

View on GitHub (pinned to 6b05625475)

When it happens

Trigger: Thrown at app/graphql/mutations/base_mutation.rb:39 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of theforeman/foreman@6b05625475 (2026-08-23). Data as JSON: /api/errors/aeaa3504bf950bfb. Report an issue: GitHub.