Univention Bugzilla – Attachment 7498 Details for
Bug 40652
replace self.lo.search() with getAttr() or get (uldap) if the search is meant to return attributes for a specific object
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
my udm test (creates/removes/modifies various udm objects)
udm-test.py (text/x-python), 3.36 KB, created by
Felix Botner
on 2016-02-23 15:16:47 CET
(
hide
)
Description:
my udm test (creates/removes/modifies various udm objects)
Filename:
MIME Type:
Creator:
Felix Botner
Created:
2016-02-23 15:16:47 CET
Size:
3.36 KB
patch
obsolete
>import univention.admin.uldap >import univention.config_registry >import univention.admin.objects >import univention.admin.modules >import univention.admin.config > > >lo, position = univention.admin.uldap.getMachineConnection() >ucr = univention.config_registry.ConfigRegistry() >ucr.load() > >univention.admin.modules.update() >users = univention.admin.modules.get('users/user') >groups = univention.admin.modules.get('groups/group') >univention.admin.modules.init(lo, position, users) >univention.admin.modules.init(lo, position, groups) > >co = univention.admin.config.config() > >printers = univention.admin.modules.get('shares/printer') >univention.admin.modules.init(lo, position, printers) >printergroups = univention.admin.modules.get('shares/printergroup') >univention.admin.modules.init(lo, position, printergroups) > >printer_name = 'printer1' >printer = printers.object(co, lo, position) >printer.open() >printer['name'] = printer_name >printer['spoolHost'] = '%s.%s' % (ucr['hostname'], ucr['domainname']) >printer['uri'] = ('file:', '/tmp/printer1') >printer['model'] = "foomatic-rip/Panasonic-DP-8016P-pxlmono.ppd Panasonic DP-8016P Foomatic/pxlmono" >printer['setQuota'] = '1' >printer.create() > >printerg_name = 'printer1g' >printerg = printergroups.object(co, lo, position) >printerg.open() >printerg['name'] = printerg_name >printerg['spoolHost'] = '%s.%s' % (ucr['hostname'], ucr['domainname']) >printerg['groupMember'] = ['%s' % printer_name] >printerg['setQuota'] = '1' >printerg.create() > >res = printers.lookup(co, lo, "cn=%s" % printer_name)[0] >res.open() >res['setQuota'] = '0' >res.modify() > >res = printergroups.lookup(co, lo, "cn=%s" % printerg_name)[0] >res.open() >res['setQuota'] = '0' >res.modify() > >res = printers.lookup(co, lo, "cn=%s" % printer_name)[0] >res.open() >res.remove() > >res = printergroups.lookup(co, lo, "cn=%s" % printerg_name)[0] >res.open() >res.remove() > > ># create >name = "univention7" >user = users.object(co, lo, position) >user.open() >user["lastname"] = "univention" >user["password"] = "univention" >user["username"] = name >user.create() > ># pg >res = users.lookup(co, lo, "uid=%s" % name)[0] >res.open() >res['primaryGroup'] = "cn=Domain Admins,cn=groups,%s" % ucr['ldap/base'] >res.modify() > ># move - no does not work >#res = users.lookup(co, lo, "uid=%s" % name)[0] >#res.open() >#res.move("uid=%s,cn=users,%s" % (name, ucr['ldap/base'])) > ># remove >res = users.lookup(co, lo, "uid=%s" % name)[0] >res.open() >res.remove() > ># create >group_name = "group1" >group = groups.object(co, lo, position) >group.open() >group['name'] = group_name >group.create() > ># add member >res = groups.lookup(co, lo, "cn=%s" % group_name)[0] >res['users'] = ['uid=Administrator,cn=users,%s' % ucr['ldap/base']] >res.modify() > ># remove member >res = groups.lookup(co, lo, "cn=%s" % group_name)[0] >res['users'] = [] >res.modify() > ># remove >res = groups.lookup(co, lo, "cn=%s" % group_name)[0] >res.open() >res.remove() > >hosts = [ > 'computers/domaincontroller_slave', > 'computers/macos', > 'computers/memberserver', > 'computers/domaincontroller_backup', > 'computers/ubuntu', > 'computers/windows_domaincontroller', > 'computers/windows', > 'computers/domaincontroller_master', > 'computers/linux'] > > >for host in hosts: > name = host.split('/')[1] > mod = univention.admin.modules.get(host) > univention.admin.modules.init(lo, position, mod) > h = mod.object(co, lo, position) > h.open() > h['name'] = name > h.create() > > res = mod.lookup(co, lo, "cn=%s" % name)[0] > res.open() > res.remove() >
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 40652
: 7498 |
7499