Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MNOE-857] Allowed organization to be added to staff divisions #640

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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