Sha256: b1fdb91a3df02ab8589277744fd091812bb66ffdcae48a7b931a2c711fba973e
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
Contents
module CanTango module PermitEngine class UserPermit < CanTango::PermitEngine::Permit autoload_modules :Builder, :Finder # fx for User user class, becomes simply UserPermit def user_type self.class.name.demodulize.gsub(/(.*)(Permit)/, '\1').underscore.to_sym end # creates the permit # @param [Permits::Ability] the ability # @param [Hash] the options def initialize ability super end # In a specific Role based Permit you can use # def permit? user, options = {} # ... permission logic follows # # This will call the Permit::Base#permit? instance method (the method below) # It will only return true if the user matches the role of the Permit class and the # # If these confitions are not met, it will return false and thus the outer permit # will not run the permission logic to follow # # Normally super for #permit? should not be called except for this case, # or if subclassing another Permit than Permit::Base # def permit? super end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cantango-0.8.0 | lib/cantango/permit_engine/user_permit.rb |