|
|
@ -26,9 +26,9 @@ sql_update_changes = "update LDAP set Changes = 'N' where ID = '%s'" |
|
|
|
sql_delete = "delete from LDAP where Delete = 'Y' and ID = '%s'" |
|
|
|
|
|
|
|
ad_groups = ['vpn-users', 'gogs'] |
|
|
|
ad_groups_users = ['vpn-users', 'gogs', 'Пользователи удаленного рабочего стола'] |
|
|
|
ad_groups_users = ['vpn-users', 'gogs'] |
|
|
|
ad_groups_bitrix = ['vpn-web-vpn', 'gogs'] |
|
|
|
ad_groups_1c = ['vpn-1c-vpn', 'Domain Users', 'Пользователи удаленного рабочего стола'] |
|
|
|
ad_groups_1c = ['vpn-1c-vpn', 'Domain Users'] |
|
|
|
ad_group_xserv = 'ics' |
|
|
|
ad_group_rdp = 'Пользователи удаленного рабочего стола' |
|
|
|
|
|
|
@ -56,21 +56,20 @@ def main(): |
|
|
|
lp.load(samba.param.default_path()) # или lp.load("/etc/samba/smb.conf") |
|
|
|
sam = SamDB(lp=lp, session_info=system_session()) |
|
|
|
res, err = z_reader.mysql_reader(dbconn, sql) |
|
|
|
print(res) |
|
|
|
if err: |
|
|
|
print err |
|
|
|
print(err) |
|
|
|
exit(0) |
|
|
|
z_users = z_reader.users_make_zayavka(res) |
|
|
|
print(z_users) |
|
|
|
i = 0 |
|
|
|
for z_user in z_users: |
|
|
|
print z_user, z_users[z_user]['memberOf'] |
|
|
|
ad_user = UserAd(sam, base, domainName, z_users[z_user]['samAccountName'], z_users[z_user]['usrPass']) |
|
|
|
if z_users[z_user]['toRemove']: # удаляем, если такой есть |
|
|
|
if ad_user.exists: |
|
|
|
ad_user.remove() |
|
|
|
dat, err = z_reader.mysql_reader(dbconn, sql_delete % z_users[z_user]['id']) |
|
|
|
if err: |
|
|
|
print err |
|
|
|
print(err) |
|
|
|
continue |
|
|
|
if not ad_user.exists: |
|
|
|
ad_user.add() |
|
|
@ -78,14 +77,13 @@ def main(): |
|
|
|
ad_user.set_passwd() |
|
|
|
dat, err = z_reader.mysql_reader(dbconn, sql_update_changes % z_users[z_user]['id']) |
|
|
|
if err: |
|
|
|
print err |
|
|
|
print(err) |
|
|
|
if z_users[z_user]['enabled']: # инаблим или дисаблим |
|
|
|
ad_user.enable() |
|
|
|
else: |
|
|
|
ad_user.disable() |
|
|
|
for group in z_users[z_user]['memberOf']: |
|
|
|
ad_user.add_in_group(group) |
|
|
|
break |
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|