consolidate_object_auth for 171 production

This commit is contained in:
Matthew K. Fu JuYuan 2012-10-16 15:08:02 +08:00
parent b3a9a7ab07
commit a50ccdafb2
1 changed files with 2 additions and 2 deletions

View File

@ -46,7 +46,7 @@ class ModuleApp
def assign_manager(user,assigner) def assign_manager(user,assigner)
manager = AppManager.first(conditions: {managing_app_id: self.id,user_id: user.id}) rescue nil manager = AppManager.first(conditions: {managing_app_id: self.id,user_id: user.id}) rescue nil
if manager.nil? if manager.nil?
manager = self.managers.create(:user => user,:rule_creator => assigner) manager = self.managers.create(:user_id => user.id,:rule_creator_id => (assigner.id rescue nil))
end end
manager manager
end end
@ -54,7 +54,7 @@ class ModuleApp
def assign_sub_manager(user,assigner) def assign_sub_manager(user,assigner)
submanager = AppManager.first(conditions: {sub_managing_app_id: self.id,user_id: user.id}) rescue nil submanager = AppManager.first(conditions: {sub_managing_app_id: self.id,user_id: user.id}) rescue nil
if submanager.nil? && !self.managing_users.include?(user) if submanager.nil? && !self.managing_users.include?(user)
submanager = self.sub_managers.create(:user_id => user.id,:rule_creator_id => assigner.id) submanager = self.sub_managers.create(:user_id => user.id,:rule_creator_id => (assigner.id rescue nil) )
end end
submanager submanager
end end