Skip to content

Commit

Permalink
update: updating authorized plugin via piston update
Browse files Browse the repository at this point in the history
  • Loading branch information
Kieran Pilkington committed Oct 5, 2008
1 parent 2885937 commit c728930
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions vendor/plugins/authorization/.gitignore
@@ -0,0 +1,2 @@
.DS_STORE
.DS_Store
4 changes: 2 additions & 2 deletions vendor/plugins/authorization/.piston.yml
@@ -1,8 +1,8 @@
---
format: 1
handler:
commit: f78438e627582ec424c74b7999c89cdd3f5350a0
commit: d4e6c7ca6a21b2b8c501f618e201b35128f949f8
branch: HEAD
lock:
lock: false
repository_url: git://github.com/DocSavage/rails-authorization-plugin.git
repository_class: Piston::Git::Repository
10 changes: 6 additions & 4 deletions vendor/plugins/authorization/lib/publishare/identity.rb
Expand Up @@ -101,11 +101,13 @@ module InstanceMethods
def method_missing( method_sym, *args )
method_name = method_sym.to_s
if method_name =~ /^has_(\w+)\?$/
role_name = $1.singularize
self.accepted_roles.find_all_by_name(role_name).any? { |role| role.users.compact.any? }
roles = $1.split('_or_').collect { |role| role.singularize }
roles = roles.flatten.compact
self.accepted_roles.find_all_by_name(roles, :include => :users).any? { |role| role.users.compact.any? }
elsif method_name =~ /^has_(\w+)$/
role_name = $1.singularize
users = self.accepted_roles.find_all_by_name(role_name).collect { |role| role.users }
roles = $1.split('_or_').collect { |role| role.singularize }
roles = roles.flatten.compact
users = self.accepted_roles.find_all_by_name(roles, :include => :users).collect { |role| role.users }
users.flatten.compact.uniq if users
else
super
Expand Down

0 comments on commit c728930

Please sign in to comment.