Module: Pathway::Plugins::Authorization::InstanceMethods

Defined in:
lib/pathway/plugins/authorization.rb

Instance Method Summary collapse

Instance Method Details

#authorize(state, using: nil) ⇒ Object



11
12
13
# File 'lib/pathway/plugins/authorization.rb', line 11

def authorize(state, using: nil)
  authorize_with(state[using || result_key]).then { state }
end

#authorize_with(*objs) ⇒ Object



15
16
17
18
# File 'lib/pathway/plugins/authorization.rb', line 15

def authorize_with(*objs)
  objs = objs.first if objs.size <= 1
  authorized?(*objs) ? wrap(objs) : error(:forbidden)
end

#authorized?(*_) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/pathway/plugins/authorization.rb', line 20

def authorized?(*_)
  true
end