Created
July 23, 2008 00:33
-
-
Save nikz/1410 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def has_permission(name) | |
(p = permissions.detect{|p| p[:name] == name } ) ? p[:active] : false | |
end | |
def has_one_of_permissions(ps) | |
ps = [ps].flatten | |
ps.each do |p| | |
return true if has_permission(p) | |
end | |
false | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment