Class: Wallaby::AuthorizerFinder

Inherits:
DecoratorFinder show all
Defined in:
lib/services/wallaby/authorizer_finder.rb

Instance Attribute Summary

Attributes inherited from ClassFinder

#current_controller_class, #model_class, #script_name

Instance Method Summary collapse

Instance Method Details

#executeClass

Find authorizer class by script name and model class from the following places:

  • #controller_class‘s #model_authorizer

  • possible authorizer class built from script name and model class, e.g. /admin and Order::Item will give us the possible authorizers:

    • Admin::Order::ItemAuthorizer

    • Order::ItemAuthorizer

    • ItemAuthorizer

  • #controller_class‘s default #application_authorizer

Returns:

  • (Class)

    authorizer class



17
18
19
20
21
# File 'lib/services/wallaby/authorizer_finder.rb', line 17

def execute
  controller_class.model_authorizer ||
    possible_default_class ||
    controller_class.application_authorizer
end