Fact check program completed,Lin checked

This commit is contained in:
Matt Fu committed 2012-03-22 14:33:59 +08:00
1 parent 7cc075e124
commit 34a4e47057
14 files changed
+91 -66

No files matched your search

+12 -4
View File
@@ -21,11 +21,19 @@ module OrbitCoreLib
def authed_users(title=nil)
users = []
unless title.nil?
users = self.object_auths.where(title: title )[0].auth_users_after_block_list rescue []
users = case title
when :all
ary = self.object_auths.collect{|t| t.auth_users}
ary.flatten!
when nil
if self.object_auths.count ==1
self.object_auths.first.auth_users_after_block_list rescue []
else
logger.info "Warning calling a auth commend without specificed value( has multi-auths ), return empty"
[]
end
else
users = self.object_auths.collect{|t| t.auth_users_after_block_list} rescue []
users.flatten!.uniq!
self.object_auths.where(title: title).first.auth_users rescue []
end
users
end