Reflect login method. LDAP,MidSite connection. The Mysql connection now is build on fly.
This commit is contained in:
1 parent
59b55d1574
commit
551e1ef740
4 files changed
+55
-28
No files matched your search
@@ -8,7 +8,7 @@ namespace :mid_site do
|
||||
admin_role = nil
|
||||
sub_role = nil
|
||||
test_account_ldap_id ='139716'
|
||||
|
||||
MiddleSiteConnection.establish
|
||||
|
||||
task :sync => :environment do
|
||||
info_profile = Info.first(conditions: {:key => 'profile'})
|
||||
@@ -27,8 +27,8 @@ namespace :mid_site do
|
||||
sub_role
|
||||
end
|
||||
|
||||
users_from_mid = MID_CLIENT.query("SELECT #{attr_from_mid.join(',')} FROM rss_pautlst_ut WHERE posgrp_cod IN (#{officer_posgrp_code.join(',')})")
|
||||
ut_data_from_mid = MID_CLIENT.query("SELECT ut_odr, ut_cod, up_ut_cod, ut_chi_m, ut_eng_m FROM rss_paunit WHERE ut_tpe = '1' AND ut_grp != '3' AND up_ut_cod != 'F00' ORDER BY ut_odr, ut_cod")
|
||||
users_from_mid = $mid_site_connection.query("SELECT #{attr_from_mid.join(',')} FROM rss_pautlst_ut WHERE posgrp_cod IN (#{officer_posgrp_code.join(',')})")
|
||||
ut_data_from_mid = $mid_site_connection.query("SELECT ut_odr, ut_cod, up_ut_cod, ut_chi_m, ut_eng_m FROM rss_paunit WHERE ut_tpe = '1' AND ut_grp != '3' AND up_ut_cod != 'F00' ORDER BY ut_odr, ut_cod")
|
||||
remote_list = users_from_mid.collect{|t| t["nccu_id"]}
|
||||
|
||||
#remove delete user sho has been deleted at remote first
|
||||
@@ -72,7 +72,7 @@ namespace :mid_site do
|
||||
# admin_role = Role.find_or_create_by( key: 'administrator')
|
||||
# sub_role = admin_role.sub_roles.find_or_create_by(:key => 'computer_center')
|
||||
|
||||
user_from_mid = MID_CLIENT.query("SELECT #{attr_from_mid.join(',')} FROM rss_pautlst_ut WHERE posgrp_cod IN (#{officer_posgrp_code.join(',')}) AND nccu_id = '#{admins_nccu_id}' limit 1")
|
||||
user_from_mid = $mid_site_connection.query("SELECT #{attr_from_mid.join(',')} FROM rss_pautlst_ut WHERE posgrp_cod IN (#{officer_posgrp_code.join(',')}) AND nccu_id = '#{admins_nccu_id}' limit 1")
|
||||
admin_at_mid = user_from_mid.first
|
||||
user_first_name = admin_at_mid["psn_nam"].size > 3 ? admin_at_mid["psn_nam"][3..-1] : admin_at_mid["psn_nam"][1..-1]
|
||||
user_last_name = admin_at_mid["psn_nam"].size > 3 ? admin_at_mid["psn_nam"][1..2] : admin_at_mid["psn_nam"][0]
|
||||
@@ -95,7 +95,7 @@ namespace :mid_site do
|
||||
# sub_role = admin_role.sub_roles.find_or_create_by(:key => 'computer_center')
|
||||
info_profile = Info.first(conditions: {:key => 'profile'})
|
||||
|
||||
user_from_mid = MID_CLIENT.query("SELECT #{attr_from_mid.join(',')} FROM rss_pautlst_ut WHERE nccu_id = '#{admins_nccu_id}' limit 1")
|
||||
user_from_mid = $mid_site_connection.query("SELECT #{attr_from_mid.join(',')} FROM rss_pautlst_ut WHERE nccu_id = '#{admins_nccu_id}' limit 1")
|
||||
admin_at_mid = user_from_mid.first
|
||||
user_first_name = admin_at_mid["psn_nam"].size > 3 ? admin_at_mid["psn_nam"][3..-1] : admin_at_mid["psn_nam"][1..-1]
|
||||
user_last_name = admin_at_mid["psn_nam"].size > 3 ? admin_at_mid["psn_nam"][1..2] : admin_at_mid["psn_nam"][0]
|
||||
|
||||
Reference in new issue
Block a user