lib/authz/controllers/authorization_manager.rb
# Use as `around_action` filter to ensure all controller actions either perform authorization
# or explicitly skip it.
# Rollbacks changes in db if authorization was not performed.
# @raise [AuthorizationNotPerformedError] if authorization has not been performed or skipped
# @return [void]
# @see #authorize
# @see #skip_authorization
# @see http://guides.rubyonrails.org/action_controller_overview.html#after-filters-and-around-filters
# @api public
# @!visibility public
Use as `around_action` filter to ensure all controller actions either perform authorization
or explicitly skip it.
Rollbacks changes in db if authorization was not performed.
Use as ` around_action ` filter to ensure all controller actions either perform authorization or explicitly skip it . Rollbacks changes in db if authorization was not performed .
def verify_authorized
        ActiveRecord::Base.transaction do
          yield
          unless authorization_performed?
            raise AuthorizationNotPerformedError, controller: self.class,
                                                  action: self.action_name
          end
        end
      end
def verify_authorized ActiveRecord :: Base . transaction do yield unless authorization_performed? raise AuthorizationNotPerformedError , controller : self . class , action : self . action_name end end end
Use as `around_action` filter to ensure all controller actions either perform authorization
or explicitly skip it.
Use as ` around_action ` filter to ensure all controller actions either perform authorization or explicitly skip it .
# Yield gets replaced by the controller action performed: E.g. #show # http://stackoverflow.com/questions/27932270/how-does-an-around-action-callback-work-an-explanation-is-needed
None
void
[AuthorizationNotPerformedError] if authorization has not been performed or skipped
[ AuthorizationNotPerformedError ] if authorization has not been performed or skipped
see
None
see
None
see
None
api
None
!visibility
None