spec/demo/spec/features/concentric_spec.rb in kojac-0.13.0 vs spec/demo/spec/features/concentric_spec.rb in kojac-0.15.0

- old
+ new

@@ -70,16 +70,16 @@ ring :pleb, write: :password ring :boss, [:read,:write] => [:notes] end class TestUserPolicy < KojacBasePolicy - allow_filter ability: :write, ring: :boss do |aPolicy,aResult,aRing,aAbility| # boss can't write other people's passwords - aResult -= [:password] if aPolicy.user.id != aPolicy.record.id - aResult + allow_filter ability: :write, ring: :boss do |p,fields| # boss can't write other people's passwords + fields -= [:password] if p.user.id != p.record.id + fields end - allow_filter do |aPolicy,aResult,aRing,aAbility| # boss can't write other people's passwords - aResult = [] if aPolicy.user.id != aPolicy.record.id and aPolicy.user.ring >= aPolicy.record.ring and aPolicy.user.ring >= Concentric.lookup_ring(:master) - aResult + allow_filter do |p,fields| # boss can't write other people's passwords + fields = [] if p.user.id != p.record.id and p.user.ring >= p.record.ring and p.user.ring >= Concentric.lookup_ring(:master) + fields end end TestUser.permitted(:pleb,:read).should == [:address,:name] TestUser.permitted(:boss,:read).should == [:address,:name,:notes]