Example #1
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import datetime
import sys
import os
from pprint import pprint
from clacks.agent.objects import ObjectFactory


f = ObjectFactory()

## Update
object_type, extensions =  f.identifyObject(u'cn=Playground Tester,ou=people,dc=gonicus,dc=de')

# Add or remove samba
#if not 'SambaUser' in extensions:
#    p = f.getObject('SambaUser', u'cn=Playground Tester,ou=people,dc=gonicus,dc=de', mode='extend')
#    p.sambaSID = "11111111"
#    p.commit()
#    print "Extending!"
#
#else:
#    p = f.getObject('SambaUser', u'cn=Playground Tester,ou=people,dc=gonicus,dc=de')
#    p.retract()
#    print "Retracting!"

p = f.getObject('SambaUser', u'cn=Playground Tester,ou=people,dc=gonicus,dc=de', mode='update')
for entry in p.listProperties():
    print "%30s" % (entry,), getattr(p, entry)
Example #2
0
# -*- coding: utf-8 -*-
import time
import datetime
import sys
import os
from pprint import pprint
from clacks.agent.objects import ObjectFactory


f = ObjectFactory()

## Update

cn = u"hickert-test4"

object_type, extensions =  f.identifyObject(u'cn=%s,ou=groups,dc=gonicus,dc=de' % (cn,))

print object_type, extensions

p = f.getObject('PosixGroup', u'cn=%s,ou=groups,dc=gonicus,dc=de' % (cn,), mode='update')
for entry in p.listProperties():
    print "%30s" % (entry,), getattr(p, entry)

p.memberUid= [u"hickert"]
p.gidNumber = -1
p.commit()

p = f.getObject('SambaGroup', u'cn=%s,ou=groups,dc=gonicus,dc=de' % (cn,), mode='update')
p.sambaGroupType = 513
p.sambaGroupType = 514
p.sambaDomainName = "WINNT-TEST"