|
|
@ -3,16 +3,18 @@ |
|
|
|
|
|
|
|
import MySQLdb |
|
|
|
|
|
|
|
dbconn = {'host': '10.1.11.26', |
|
|
|
'user': 'LDAP2018', |
|
|
|
'pass': 'Pr4t7UEZITwW1AYG', |
|
|
|
'base': 'sitemanager0'} |
|
|
|
dbconn = {'host': '10.3.11.177', |
|
|
|
'user': 'readonlyuser', |
|
|
|
'pass': 'Readonly@2006', |
|
|
|
'base': 'techgrow'} |
|
|
|
|
|
|
|
sql = 'select * from LDAP' |
|
|
|
|
|
|
|
ad_groups_users = ['vpn-users', 'gogs'] |
|
|
|
ad_groups_bitrix = ['vpn-web-vpn', 'gogs'] |
|
|
|
ad_groups_1c = ['vpn-1c-vpn', 'Domain Users'] |
|
|
|
ad_group_xserv = 'ics' |
|
|
|
ad_group_rdp = 'Пользователи удаленного рабочего стола' |
|
|
|
|
|
|
|
|
|
|
|
def mysql_reader(dbconn, sql): |
|
|
@ -50,12 +52,17 @@ def users_make_zayavka(users): |
|
|
|
if i['Delete'] == 'Y': |
|
|
|
toremove = True |
|
|
|
# размечаем группы, в которых должен быть пользователь |
|
|
|
memberof = [] |
|
|
|
if str(i['Otdel']) == 'Users': |
|
|
|
memberof = ad_groups_users |
|
|
|
elif str(i['Otdel']) == '1C': |
|
|
|
memberof = ad_groups_1c |
|
|
|
elif str(i['Otdel']) == 'Bitrix': |
|
|
|
memberof = ad_groups_bitrix |
|
|
|
if str(i['XServ']) == '1': |
|
|
|
memberof.append(ad_group_xserv) |
|
|
|
if str(i['RDP']) == '1': |
|
|
|
memberof.append(ad_group_rdp) |
|
|
|
# собственно добавляем в мапу |
|
|
|
res[usrname] = {'id': str(i['ID']), |
|
|
|
'samAccountName': usrname, |
|
|
|