lib/shamu/security/support.rb in shamu-0.0.18 vs lib/shamu/security/support.rb in shamu-0.0.19

- old
+ new

@@ -21,11 +21,11 @@ # # @!endgroup Dependencies included do attr_dependency :security_principal, Security::Principal unless method_defined? :security_principal - attr_dependency :roles_service, Security::RolesService unless method_defined? :roles_service + attr_dependency :roles_service, Security::RolesService end # @return [Policy] the security {Policy} for the service. def policy @policy ||= _policy_class.new( @@ -77,8 +77,22 @@ # policy checks to the upstream service and def service_policy_delegation? security_principal.service_delegate? end + + class_methods do + + # Define the {Policy} class to use when enforcing policy on the service + # methods. + def policy_class( klass ) + define_method :policy_class do + klass + end + + private :policy_class + end + end + end end -end \ No newline at end of file +end