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 26, 2018
1 parent c8fb5aa commit 483dd4f
Show file tree
Hide file tree
Showing 2 changed files with 16 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 if params[:organization].key?(:sub_tenant_ids).blank?

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
1 change: 1 addition & 0 deletions api/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@
get :count
end
member do
post :add_to_sub_tenants
post :users, action: :invite_member
end
resources :users, only: [] do
Expand Down

0 comments on commit 483dd4f

Please sign in to comment.