Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

Commit

Permalink
more bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
unnitallman committed Apr 4, 2012
1 parent 249eccc commit 4f8de03
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/acts_as_authoritah/core.rb
Expand Up @@ -13,7 +13,8 @@ module Core
module InstanceMethods
def can?(identifier, options={})
klass = self.class
klass.send(:default_acl).match_identifier(identifier)[self.usertype(options)] || klass.send(:whitelist)
h = klass.send(:default_acl).match_identifier(identifier)
h.empty? ? !klass.send(:whitelist) : h[self.usertype(options)]
end
end

Expand All @@ -29,7 +30,7 @@ def default_acl
end

def whitelist
!@@whitelist
@@whitelist
end
end
end
Expand Down
4 changes: 3 additions & 1 deletion spec/acts_as_authoritah/core_spec.rb
@@ -1,3 +1,5 @@
require 'spec_helper'

describe ActsAsAuthoritah::Core do
before :each do
class Foo
Expand Down Expand Up @@ -29,7 +31,7 @@ def usertype(options)
before :each do
class Foo
include ActsAsAuthoritah::Core
acts_as_authoritah "spec/data/default.xls"
acts_as_authoritah "spec/data/default.xls", :whitelist => false

def usertype(options)
"admin"
Expand Down

0 comments on commit 4f8de03

Please sign in to comment.