public
Fork of DocSavage/rails-authorization-plugin
Description: This plugin provides a flexible way to add authorization to Rails.
Homepage: http://www.writertopia.com/developers/authorization
Clone URL: git://github.com/bwyrosdick/rails-authorization-plugin.git
Patch #9431 : Fixes a bug in identity.rb submitted by Michel Martens 
(blaumag)

If some authorizable instance accepts a role, then it responds true when 
queried for has_[role_name]?

Example:
country.has_kings? #=> false

user.has_role "king", country
country.has_kings? #=> true

user.has_no_role "king", country
country.has_kings? #=> true

The last time, country.has_kings? should be false.
grempe (author)
Mon Feb 25 22:54:55 -0800 2008
commit  e0360c9ff0b025ec58381a0504ae8a1da9f33211
tree    19e4569fb0016a802c549814ab7d7838567a314a
parent  c437af066a995175f6a3d84229b58f5a41b95a6c
...
9
10
11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
13
14
...
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
0
@@ -9,6 +9,23 @@ TO DO
0
 
0
 CHANGES (from most recent to oldest)
0
 
0
+=== 1.0.7 release (February 25, 2008)
0
+
0
+* Patch #9431 : Fixes a bug in identity.rb submitted by Michel Martens (blaumag)
0
+
0
+ If some authorizable instance accepts a role, then it responds true when queried for has_[role_name]?
0
+
0
+ Example:
0
+ country.has_kings? #=> false
0
+
0
+ user.has_role "king", country
0
+ country.has_kings? #=> true
0
+
0
+ user.has_no_role "king", country
0
+ country.has_kings? #=> true
0
+
0
+ The last time, country.has_kings? should be false.
0
+
0
 === 1.0.6 release (February 25, 2008)
0
 
0
 * Patch #12170 : Additional HABTM options for acts_as_authorized_user
...
4
5
6
7
 
8
...
4
5
6
 
7
8
0
@@ -4,5 +4,5 @@ description: "Adds a flexible mechanism for authorization. Differs from other au
0
 homepage: http://www.writertopia.com/developers/authorization
0
 plugin: http://svn.writertopia.com/svn/plugins/authorization/
0
 license: MIT
0
-version: 1.0.6
0
+version: 1.0.7
0
 rails_version: 2.0+
...
97
98
99
100
 
101
102
103
...
97
98
99
 
100
101
102
103
0
@@ -97,7 +97,7 @@ module Authorization
0
           method_name = method_sym.to_s
0
           if method_name =~ /^has_(\w+)\?$/
0
             role_name = $1.singularize
0
- self.accepted_roles.find_all_by_name(role_name).any? { |role| role.users }
0
+ self.accepted_roles.find_all_by_name(role_name).any? { |role| role.users.any? }
0
           elsif method_name =~ /^has_(\w+)$/
0
             role_name = $1.singularize
0
             users = self.accepted_roles.find_all_by_name(role_name).collect { |role| role.users }

Comments

    No one has commented yet.