Sha256: f51b821166eefe33cf2ef169c8378cbf89508361a87b49d24519854fd6296bf8
Contents?: true
Size: 953 Bytes
Versions: 1
Compression:
Stored size: 953 Bytes
Contents
#************************************************************************************* # Insert methods in the Action Controller of a Rails project. #************************************************************************************* module Portier::Implants::ActionControllerImplant extend ActiveSupport::Concern included do helper_method :access_denied_message, :can?, :can_view? rescue_from Portier::AccessDenied, with: :render_access_denied end def access_denied_message @portier.access_denied_message end def can?(action, object, options={}) @portier.can? action, object, options end def can_view?(tag, options={}) @portier.can_view? tag, options end def permitted_params @portier.permitted_params end def protect_app @portier = Portier::Base.new(self, current_user) @portier.authorize_action end def render_access_denied render text: "access_denied", status: 401 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
portier-1.0.3 | lib/portier/implants/action_controller_implant.rb |