Skip to content

Commit

Permalink
[MNOE-857] Allowed organization to be added to staff divisions
Browse files Browse the repository at this point in the history
  • Loading branch information
MAhsenArif committed Jan 31, 2018
1 parent c8fb5aa commit 82b079e
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def create

# OPTIMIZE: move this into a delayed job?
update_app_list
update_sub_tenants

@organization_active_apps = @organization.app_instances

Expand Down Expand Up @@ -141,5 +142,19 @@ def update_app_list
existing_apps.reload
end
end

def update_sub_tenants
return unless params[:organization].key?(:sub_tenant_ids)

sub_tenants = MnoEnterprise::SubTenant.where({'id.in' => params[:organization][:sub_tenant_ids]})

sub_tenants.to_a.each do |sub_tnt|
new_client_ids = sub_tnt.client_ids
new_client_ids << @organization.id
new_client_ids = new_client_ids.collect(&:to_s)

sub_tnt.update({"client_ids"=>new_client_ids})
end
end
end
end

0 comments on commit 82b079e

Please sign in to comment.