Lines 209-214
mapping.register('description', 'description', None, univention.admin.mapping.Li
|
Link Here
|
---|
|
209 |
class object(univention.admin.handlers.simpleLdap): |
209 |
class object(univention.admin.handlers.simpleLdap): |
210 |
module = module |
210 |
module = module |
211 |
|
211 |
|
|
|
212 |
PATH_KEYS = { |
213 |
'userPath': 'univentionUsersObject', |
214 |
'groupPath': 'univentionGroupsObject', |
215 |
'computerPath': 'univentionComputersObject', |
216 |
'policyPath': 'univentionPolicyObject', |
217 |
'dnsPath': 'univentionDnsObject', |
218 |
'dhcpPath': 'univentionDhcpObject', |
219 |
'networkPath': 'univentionNetworksObject', |
220 |
'sharePath': 'univentionSharesObject', |
221 |
'printerPath': 'univentionPrintersObject', |
222 |
'mailPath': 'univentionMailObject', |
223 |
'licensePath': 'univentionLicenseObject', |
224 |
} |
225 |
|
212 |
def open(self): |
226 |
def open(self): |
213 |
univention.admin.handlers.simpleLdap.open(self) |
227 |
univention.admin.handlers.simpleLdap.open(self) |
214 |
|
228 |
|
Lines 218-249
class object(univention.admin.handlers.simpleLdap):
|
Link Here
|
---|
|
218 |
pathResult = self.lo.get('cn=default containers,cn=univention,' + self.position.getDomain()) |
232 |
pathResult = self.lo.get('cn=default containers,cn=univention,' + self.position.getDomain()) |
219 |
self.default_dn = 'cn=default containers,cn=univention,' + self.position.getDomain() |
233 |
self.default_dn = 'cn=default containers,cn=univention,' + self.position.getDomain() |
220 |
|
234 |
|
221 |
self.pathKeys = ['userPath', 'groupPath', 'computerPath', 'policyPath', 'dnsPath', 'dhcpPath', 'networkPath', 'sharePath', 'printerPath', 'mailPath', 'licensePath'] |
235 |
for prop in self.PATH_KEYS: |
222 |
self.ldapKeys = ['univentionUsersObject', 'univentionGroupsObject', 'univentionComputersObject', 'univentionPolicyObject', 'univentionDnsObject', 'univentionDhcpObject', 'univentionNetworksObject', 'univentionSharesObject', 'univentionPrintersObject', 'univentionMailObject', 'univentionLicenseObject'] |
236 |
self[prop] = '0' |
223 |
|
|
|
224 |
for key in self.pathKeys: |
225 |
self[key] = '0' |
226 |
|
237 |
|
227 |
for i in range(0, len(self.pathKeys)): |
238 |
for prop in self.PATH_KEYS: |
228 |
if pathResult.has_key(self.ldapKeys[i]): |
239 |
if prop in pathResult: |
229 |
for j in pathResult[self.ldapKeys[i]]: |
240 |
for j in pathResult[prop]: |
230 |
if j == self.dn: |
241 |
if j == self.dn: |
231 |
self[self.pathKeys[i]] = '1' |
242 |
self[prop] = '1' |
232 |
|
243 |
|
233 |
self.save() |
244 |
self.save() |
234 |
|
245 |
|
235 |
def _ldap_post_create(self): |
246 |
def _ldap_post_create(self): |
236 |
changes = [] |
247 |
changes = [] |
237 |
|
248 |
|
238 |
for i in range(0, len(self.pathKeys)): |
249 |
for (prop, attr) in self.PATH_KEYS.items(): |
239 |
if self.oldinfo[self.pathKeys[i]] != self.info[self.pathKeys[i]]: |
250 |
if self.oldinfo.get(prop) != self.info.get(prop): |
240 |
entries = self.lo.getAttr(self.default_dn, self.ldapKeys[i]) |
251 |
entries = self.lo.getAttr(self.default_dn, attr) |
241 |
if self.info[self.pathKeys[i]] == '0': |
252 |
if self.info[prop] == '0': |
242 |
if self.dn in entries: |
253 |
if self.dn in entries: |
243 |
changes.append((self.ldapKeys[i], self.dn, '')) |
254 |
changes.append((attr, self.dn, '')) |
244 |
else: |
255 |
else: |
245 |
if self.dn not in entries: |
256 |
if self.dn not in entries: |
246 |
changes.append((self.ldapKeys[i], '', self.dn)) |
257 |
changes.append((attr, '', self.dn)) |
247 |
|
258 |
|
248 |
if changes: |
259 |
if changes: |
249 |
self.lo.modify(self.default_dn, changes) |
260 |
self.lo.modify(self.default_dn, changes) |
Lines 253-270
class object(univention.admin.handlers.simpleLdap):
|
Link Here
|
---|
|
253 |
newdn = 'cn=%s,%s' % (ldap.dn.escape_dn_chars(self.info['name']), self.lo.parentDn(self.dn)) |
264 |
newdn = 'cn=%s,%s' % (ldap.dn.escape_dn_chars(self.info['name']), self.lo.parentDn(self.dn)) |
254 |
self.move(newdn) |
265 |
self.move(newdn) |
255 |
|
266 |
|
256 |
def _ldap_post_modify(self): |
|
|
257 |
changes = [] |
258 |
|
259 |
for i in range(0, len(self.pathKeys)): |
260 |
if self.oldinfo[self.pathKeys[i]] != self.info[self.pathKeys[i]]: |
261 |
if self.info[self.pathKeys[i]] == '0': |
262 |
changes.append((self.ldapKeys[i], self.dn, '')) |
263 |
else: |
264 |
changes.append((self.ldapKeys[i], '', self.dn)) |
265 |
if changes: |
266 |
self.lo.modify(self.default_dn, changes) |
267 |
|
268 |
def _ldap_post_move(self, olddn): |
267 |
def _ldap_post_move(self, olddn): |
269 |
settings_module = univention.admin.modules.get('settings/directory') |
268 |
settings_module = univention.admin.modules.get('settings/directory') |
270 |
settings_object = univention.admin.objects.get(settings_module, None, self.lo, position='', dn=self.default_dn) |
269 |
settings_object = univention.admin.objects.get(settings_module, None, self.lo, position='', dn=self.default_dn) |
Lines 275-288
class object(univention.admin.handlers.simpleLdap):
|
Link Here
|
---|
|
275 |
settings_object[attr].append(self.dn) |
274 |
settings_object[attr].append(self.dn) |
276 |
settings_object.modify() |
275 |
settings_object.modify() |
277 |
|
276 |
|
|
|
277 |
def _ldap_post_modify(self): |
278 |
changes = [] |
279 |
|
280 |
for prop, attr in self.PATH_KEYS.items(): |
281 |
if self.oldinfo.get(prop) != self.info.get(prop): |
282 |
if self.info[prop] == '0': |
283 |
changes.append((attr, self.dn, '')) |
284 |
else: |
285 |
changes.append((attr, '', self.dn)) |
286 |
if changes: |
287 |
self.lo.modify(self.default_dn, changes) |
288 |
|
278 |
def _ldap_pre_remove(self): |
289 |
def _ldap_pre_remove(self): |
279 |
changes = [] |
290 |
changes = [] |
280 |
|
291 |
|
281 |
self.open() |
292 |
self.open() |
282 |
|
293 |
|
283 |
for i in range(0, len(self.pathKeys)): |
294 |
for prop, attr in self.PATH_KEYS.items(): |
284 |
if self.oldinfo[self.pathKeys[i]] == '1': |
295 |
if self.oldinfo.get(prop) == '1': |
285 |
changes.append((self.ldapKeys[i], self.dn, '')) |
296 |
changes.append((attr, self.dn, '')) |
286 |
self.lo.modify(self.default_dn, changes) |
297 |
self.lo.modify(self.default_dn, changes) |
287 |
|
298 |
|
288 |
def _ldap_addlist(self): |
299 |
def _ldap_addlist(self): |