Skip to content
Snippets Groups Projects
Commit 9a0ea135 authored by http://jneen.net/'s avatar http://jneen.net/
Browse files

factor in global permissions

parent 29440228
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -4,6 +4,8 @@ class BasePolicy
end
 
def self.class_for(subject)
return GlobalPolicy if subject.nil?
subject.class.ancestors.each do |klass|
next unless klass.name
 
Loading
Loading
@@ -59,8 +61,6 @@ class BasePolicy
private
 
def collect_rules(&b)
return Set.new if @subject.nil?
@can = Set.new
@cannot = Set.new
yield
Loading
Loading
class GlobalPolicy < BasePolicy
def rules
return unless @user
can! :create_group if @user.can_create_group
can! :read_users_list
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment