Fact check program completed,Lin checked

This commit is contained in:
Matt Fu authored and Christophe Vilayphiou committed 2012-03-27 18:54:03 +08:00
1 parent 7efaddf57c
commit 3ba89ecbcf
13 files changed
+144 -130

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