Module: Rolypoly::ControllerRoleDSL
- Defined in:
- lib/rolypoly/controller_role_dsl.rb
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Class Method Summary collapse
Class Method Details
.included(sub) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rolypoly/controller_role_dsl.rb', line 7 def self.included(sub) sub.before_filter(:rolypoly_check_role_access!) if sub.respond_to? :before_filter if sub.respond_to? :rescue_from sub.rescue_from(FailedRoleCheckError) do respond_to do |f| f.html { render text: "Not Authorized", status: 401 } f.json { render json: { error: "Not Authorized" }, status: 401 } f.xml { render xml: { error: "Not Authorized" }, status: 401 } end end end sub.send(:include, RoleDSL) sub.extend(ClassMethods) sub.send(:include, InstanceMethods) end |