Module: Dynamican::Authorization
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/dynamican/authorization.rb
Defined Under Namespace
Classes: UnauthorizedResource
Instance Method Summary
collapse
Instance Method Details
#authorize!(action, item = nil) ⇒ Object
11
12
13
|
# File 'lib/dynamican/authorization.rb', line 11
def authorize!(action, item = nil)
raise UnauthorizedResource unless @current_user.can? action, item
end
|
#unauthorized ⇒ Object
15
16
17
|
# File 'lib/dynamican/authorization.rb', line 15
def unauthorized
render status: :unauthorized
end
|