class FastCqrs::Authorizer
A base Authorizer
class used to validate the access to the given resource an easy to use hash. Usage: Inherit and override the authorize
method
Public Class Methods
inherited(klass)
click to toggle source
Calls superclass method
# File lib/fast_cqrs/authorizer.rb, line 11 def self.inherited(klass) super klass.class_eval do include Dry::Monads[:result, :do] end end
Public Instance Methods
call(subject: nil, auth: nil)
click to toggle source
# File lib/fast_cqrs/authorizer.rb, line 18 def call(subject: nil, auth: nil) return Success() if authorize(subject, auth) fail! end
Protected Instance Methods
Private Instance Methods
fail!()
click to toggle source
# File lib/fast_cqrs/authorizer.rb, line 33 def fail! Failure(:authorize) end