Class: ApplicationAuthorizer

Inherits:
Authority::Authorizer
  • Object
show all
Defined in:
app/authorizers/application_authorizer.rb

Overview

Other authorizers should subclass this one

Class Method Summary collapse

Class Method Details

.default(adjective, user) ⇒ Boolean

Any class method from Authority::Authorizer that isn’t overridden will call its authorizer’s default method.

Parameters:

  • adjective; (Symbol)

    example: ‘:creatable`

  • user (Object)
    • whatever represents the current user in your app

Returns:

  • (Boolean)


10
11
12
13
14
15
16
# File 'app/authorizers/application_authorizer.rb', line 10

def self.default(adjective, user)
  # 'Whitelist' strategy for security: anything not explicitly allowed is
  # considered forbidden.
  
  # default was false
  user.has_role? :admin
end