Exception: Administrate::NotAuthorizedError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/administrate/not_authorized_error.rb

Instance Method Summary collapse

Constructor Details

#initialize(action:, resource:) ⇒ NotAuthorizedError

Returns a new instance of NotAuthorizedError.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/administrate/not_authorized_error.rb', line 3

def initialize(action:, resource:)
  @action = action
  @resource = resource

  case resource
  when String, Symbol
    super("Not allowed to perform #{action.inspect} on #{resource.inspect}")
  when Module
    super("Not allowed to perform #{action.inspect} on #{resource.name}")
  else
    super(
      "Not allowed to perform #{action.inspect} on the given " +
        resource.class.name
    )
  end
end