Esempio n. 1
0
    def __init__(self):
        self.env = Environment.getInstance()

        self.log = logging.getLogger(__name__)
        self.log.info("initializing object index handler")
        self.factory = ObjectFactory.getInstance()

        # Listen for object events
        zope.event.subscribers.append(self.__handle_events)
Esempio n. 2
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()
p = f.getObject('SambaDomain', u'sambaDomainName=FabianSuperDomain,sambaDomainName=GONICUS,dc=gonicus,dc=de', mode='remove')

for entry in p.listProperties():
    print "%30s" % (entry,), getattr(p, entry)

#p.commit()
p.remove();
Esempio n. 3
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)
Esempio n. 4
0
 def process(self, obj, key, valDict, value):
     f = ObjectFactory()
     types = f.getAttributeTypes()
     valDict[key]['value'] = types['String'].convert_to(valDict[key]['type'], [value])
     return key, valDict
Esempio n. 5
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

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
Esempio n. 6
0

# Register pseudo event handler
def l(event):
    print "%s event catched: %s of %s" % (event.__class__.__name__, event.reason, event.uuid)

zope.event.subscribers.append(l)

# use create, update, remove, move, extend, retract
if len(sys.argv) != 2:
    mode = 'update'
else:
    mode = sys.argv[1]
    del sys.argv[1]

f = ObjectFactory.getInstance()

if mode == "create":
    p = f.getObject('User', u'ou=people,dc=gonicus,dc=de', mode="create")

if mode in ["update", "move", "remove"]:
    p = f.getObject('User', u"cn=Klaus Mustermann,ou=people,dc=gonicus,dc=de")

if mode == "extend":
    p = f.getObject('PosixUser', u'cn=Klaus Mustermann,ou=people,dc=gonicus,dc=de', mode="extend")
    p.uidNumber = 4711
    p.gidNumber = 4711
    p.homeDirectory = "/home/cajus"
    p.commit()
    exit(0)