Sha256: 7c6ca66f6b3f79924d6d50f04769c1273987c41661b3d88b0d1e18b4b6f0cc53
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
RoleAuthorization::Rules.define :all do true end RoleAuthorization::Rules.define :role do if controller_instance.current_user.blank? false else scope = if options[:scope] if options[:scope].is_a?(Proc) controller_instance.instance_eval(&options[:scope]) else options[:scope] end else :global end controller_instance.current_user.roles(options[:scope] || :global).include?(role) end end RoleAuthorization::Rules.define :user do if controller_instance.current_user.blank? false else if options[:resource] check_method = options[:check] || :id resource_instance = controller_instance.instance_eval(&options[:resource]) controller_instance.current_user.id == resource_instance.try(check_method) else false end end end RoleAuthorization::Rules.define :custom do unless options[:block].nil? true if controller_instance.instance_eval(&options[:block]) == true else false end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
role_authorization-0.3.4 | lib/role_authorization/rules/defaults.rb |