Sha256: cd5a22ce346a6b96af6973a14cc383b1bf97ccbdd5c095fcafcb7288d46292c0
Contents?: true
Size: 1.07 KB
Versions: 4
Compression:
Stored size: 1.07 KB
Contents
module Zuul module ActiveRecord module Context def self.included(base) base.send :extend, ClassMethods base.send :include, InstanceMethods end module ClassMethods def self.extended(base) base.send :extend, RoleMethods base.send :extend, PermissionMethods if base.auth_scope.config.with_permissions end end module InstanceMethods def self.included(base) base.send :include, RoleMethods base.send :include, PermissionMethods if base.auth_scope.config.with_permissions end end module RoleMethods # Checks whether the subject possesses the specified role within the context of self def allowed?(subject, role) subject.has_role?(role, self) end end module PermissionMethods # Checks whether the subject possesses the specified permission within the context of self def allowed_to?(subject, permission) subject.has_permission?(permission, self) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
zuul-0.2.3 | lib/zuul/active_record/context.rb |
zuul-0.2.2 | lib/zuul/active_record/context.rb |
zuul-0.2.1 | lib/zuul/active_record/context.rb |
zuul-0.2.0 | lib/zuul/active_record/context.rb |