Univention Bugzilla – Attachment 9163 Details for
Bug 45310
memberOf is not set for existing users on backup and slave systems
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
update-memberof
update-memberof (text/plain), 1.07 KB, created by
Stefan Gohmann
on 2017-09-01 08:07:59 CEST
(
hide
)
Description:
update-memberof
Filename:
MIME Type:
Creator:
Stefan Gohmann
Created:
2017-09-01 08:07:59 CEST
Size:
1.07 KB
patch
obsolete
>#!/usr/bin/python2.7 > >import univention.uldap >import univention.config_registry >import ldap >import sys > >cr = univention.config_registry.ConfigRegistry() >cr.load() > ># split rootpw " >bindpw = open('/etc/ldap/rootpw.conf').readline().strip()[8:-1] > ># ldap connection >try: > lo = univention.uldap.access(host='%s.%s' % (cr['hostname'], cr['domainname']), port=None, base=cr['ldap/base'], binddn='cn=update,%s' % cr['ldap/base'], bindpw=bindpw) >except Exception as e: > print "failed to get ldap connection: %s" % e > ># search groups and del/add uniqueMember >results = lo.search(base=cr.get("ldap/base"), attr=["uniqueMember"], filter="(&(objectClass=posixGroup)(uniqueMember=*))") >for result in results: > dn = result[0] > uniqueMember = result[1].get("uniqueMember", [""]) > if dn and uniqueMember: > try: > # update groups > ml = [] > ml.append((ldap.MOD_REPLACE, "uniqueMember", uniqueMember)) > lo.modify_s(dn, ml) > except Exception as e: > sys.stderr.write("E: modifing %s failed error with %s\n" % (dn, e)) > sys.stderr.write(" please check the membership of this group\n") > sys.exit(1)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 45310
: 9163