Class: JSONAPI::Authorization::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/jsonapi/authorization/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



10
11
12
13
# File 'lib/jsonapi/authorization/configuration.rb', line 10

def initialize
  self.authorizer  = ::JSONAPI::Authorization::DefaultPunditAuthorizer
  self.pundit_user = :user
end

Instance Attribute Details

#authorizerObject

Returns the value of attribute authorizer.



8
9
10
# File 'lib/jsonapi/authorization/configuration.rb', line 8

def authorizer
  @authorizer
end

#pundit_userObject

Returns the value of attribute pundit_user.



8
9
10
# File 'lib/jsonapi/authorization/configuration.rb', line 8

def pundit_user
  @pundit_user
end

Instance Method Details

#user_context(context) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/jsonapi/authorization/configuration.rb', line 15

def user_context(context)
  if pundit_user.is_a?(Symbol)
    context[pundit_user]
  else
    pundit_user.call(context)
  end
end