View | Details | Raw Unified | Return to bug 28145
Collapse All | Expand All

(-)a/branches/ucs-3.2/ucs-3.2-1/management/univention-directory-manager-modules/modules/univention/admin/handlers/groups/group.py (-40 / +28 lines)
 Lines 88-94   property_descriptions={ Link Here 
88
			syntax=univention.admin.syntax.gid,
88
			syntax=univention.admin.syntax.gid,
89
			multivalue=0,
89
			multivalue=0,
90
			include_in_default_search=1,
90
			include_in_default_search=1,
91
			options=['posix', 'samba'],
92
			required=1,
91
			required=1,
93
			may_change=1,
92
			may_change=1,
94
			identifies=1
93
			identifies=1
 Lines 361-367   class object(univention.admin.handlers.simpleLdap): Link Here 
361
		# None ==> ldap has not been checked for servers with service "S4 Connector"
360
		# None ==> ldap has not been checked for servers with service "S4 Connector"
362
		# True ==> at least one server with IP address (aRecord) is present
361
		# True ==> at least one server with IP address (aRecord) is present
363
		# False ==> no server is present
362
		# False ==> no server is present
364
		if s4connector_present == None:
363
		if s4connector_present is None:
365
			searchResult = lo.search('(&(|(objectClass=univentionDomainController)(objectClass=univentionMemberServer))(univentionService=S4 Connector))', attr = ['aRecord'])
364
			searchResult = lo.search('(&(|(objectClass=univentionDomainController)(objectClass=univentionMemberServer))(univentionService=S4 Connector))', attr = ['aRecord'])
366
			s4connector_present = True
365
			s4connector_present = True
367
			if not [ ddn for (ddn, attr) in searchResult if attr.has_key('aRecord') ]:
366
			if not [ ddn for (ddn, attr) in searchResult if attr.has_key('aRecord') ]:
 Lines 399-409   class object(univention.admin.handlers.simpleLdap): Link Here 
399
398
400
			time_start = time.time()
399
			time_start = time.time()
401
400
402
			self['users']=self['hosts']=self['nestedGroup']=[]
401
			self['users'] = []
403
			if self.oldattr.has_key('uniqueMember'):
402
			self['hosts'] = []
404
				groupMembers=self.oldattr['uniqueMember']
403
			self['nestedGroup'] = []
405
404
			for i in self.oldattr.get('uniqueMember', []):
406
				for i in groupMembers:
407
					if cache_uniqueMember.is_valid(i):
405
					if cache_uniqueMember.is_valid(i):
408
						membertype = cache_uniqueMember.get(i).get('type')
406
						membertype = cache_uniqueMember.get(i).get('type')
409
						if membertype == 'user':
407
						if membertype == 'user':
 Lines 433-446   class object(univention.admin.handlers.simpleLdap): Link Here 
433
			time_end = time.time()
431
			time_end = time.time()
434
			univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'groups/group: open(): member check duration: %1.2fs' % (time_end - time_start))
432
			univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'groups/group: open(): member check duration: %1.2fs' % (time_end - time_start))
435
433
436
434
			self['allowedEmailUsers'] = self.oldattr.get('univentionAllowedEmailUsers', [])
437
			self['allowedEmailUsers'] = []
435
			self['allowedEmailGroups'] = self.oldattr.get('univentionAllowedEmailGroups', [])
438
			if self.oldattr.has_key('univentionAllowedEmailUsers'):
439
				self['allowedEmailUsers'] = self.oldattr['univentionAllowedEmailUsers']
440
441
			self['allowedEmailGroups'] = []
442
			if self.oldattr.has_key('univentionAllowedEmailGroups'):
443
				self['allowedEmailGroups'] = self.oldattr['univentionAllowedEmailGroups']
444
436
445
			self.save()
437
			self.save()
446
438
 Lines 448-457   class object(univention.admin.handlers.simpleLdap): Link Here 
448
		ml = []
440
		ml = []
449
		uids = []
441
		uids = []
450
		members = []
442
		members = []
451
		searchResult = self.lo.search(base=self.dn, attr=['uniqueMember','memberUid'])
443
		for _dn, searchResult in self.lo.search(base=self.dn, attr=['uniqueMember', 'memberUid']):
452
		if searchResult:
444
			uids = searchResult.get('memberUid', [])
453
			uids = searchResult[0][1].get('memberUid',[])
445
			members = searchResult.get('uniqueMember', [])
454
			members = searchResult[0][1].get('uniqueMember',[])
455
446
456
		add_uidlist = []
447
		add_uidlist = []
457
		for uid in uidlist:
448
		for uid in uidlist:
 Lines 484-493   class object(univention.admin.handlers.simpleLdap): Link Here 
484
		ml = []
475
		ml = []
485
		uids = []
476
		uids = []
486
		members = []
477
		members = []
487
		searchResult = self.lo.search(base=self.dn, attr=['uniqueMember','memberUid'])
478
		for _dn, searchResult in self.lo.search(base=self.dn, attr=['uniqueMember', 'memberUid']):
488
		if searchResult:
479
			uids = searchResult.get('memberUid', [])
489
			uids = searchResult[0][1].get('memberUid',[])
480
			members = searchResult.get('uniqueMember', [])
490
			members = searchResult[0][1].get('uniqueMember',[])
491
481
492
		remove_uidlist = []
482
		remove_uidlist = []
493
		for uid in uidlist:
483
		for uid in uidlist:
 Lines 551-577   class object(univention.admin.handlers.simpleLdap): Link Here 
551
			try:
541
			try:
552
				self.alloc.append(('groupName', self['name']))
542
				self.alloc.append(('groupName', self['name']))
553
				name=univention.admin.allocators.request(self.lo, self.position, 'groupName', value=self['name'])
543
				name=univention.admin.allocators.request(self.lo, self.position, 'groupName', value=self['name'])
554
				univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'groups/group: arequested groupname without exception')
544
				univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'groups/group: requested groupname without exception')
555
			except univention.admin.uexceptions.permissionDenied, e:
545
			except univention.admin.uexceptions.permissionDenied, e:
556
				univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'groups/group: arequested groupname with permissionDenied exception')
546
				univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'groups/group: requested groupname with permissionDenied exception')
557
				raise e
547
				raise e
558
			except univention.admin.uexceptions.licenseNotFound, e:
548
			except univention.admin.uexceptions.licenseNotFound, e:
559
				univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'groups/group: arequested groupname with licenseNotFound exception')
549
				univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'groups/group: requested groupname with licenseNotFound exception')
560
				raise e
550
				raise e
561
			except univention.admin.uexceptions.licenseInvalid, e:
551
			except univention.admin.uexceptions.licenseInvalid, e:
562
				univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'groups/group: arequested groupname with licenseInvalid exception')
552
				univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'groups/group: requested groupname with licenseInvalid exception')
563
				raise e
553
				raise e
564
			except univention.admin.uexceptions.licenseExpired, e:
554
			except univention.admin.uexceptions.licenseExpired, e:
565
				univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'groups/group: arequested groupname with licenseExpired exception')
555
				univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'groups/group: requested groupname with licenseExpired exception')
566
				raise e
556
				raise e
567
			except univention.admin.uexceptions.licenseWrongBaseDn, e:
557
			except univention.admin.uexceptions.licenseWrongBaseDn, e:
568
				univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'groups/group: arequested groupname with licenseWrongbaseDn exception')
558
				univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'groups/group: requested groupname with licenseWrongbaseDn exception')
569
				raise e
559
				raise e
570
			except univention.admin.uexceptions.licenseDisableModify, e:
560
			except univention.admin.uexceptions.licenseDisableModify, e:
571
				univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'groups/group: arequested groupname with licenseDisableModify exception')
561
				univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'groups/group: requested groupname with licenseDisableModify exception')
572
				raise e
562
				raise e
573
			except univention.admin.uexceptions.base, e:
563
			except univention.admin.uexceptions.base, e:
574
				univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'groups/group: arequested groupname with base (%s) exception'%e)
564
				univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'groups/group: requested groupname with base (%s) exception'%e)
575
				error=1
565
				error=1
576
566
577
			if not name or error:
567
			if not name or error:
 Lines 584-603   class object(univention.admin.handlers.simpleLdap): Link Here 
584
				raise univention.admin.uexceptions.groupNameAlreadyUsed, ': %s' % (name)
574
				raise univention.admin.uexceptions.groupNameAlreadyUsed, ': %s' % (name)
585
				return []
575
				return []
586
576
587
			ocs=['top']
577
			ocs = ['top']
588
			al=[]
578
			al = [('objectClass', ocs)]
589
			if 'posix' in self.options:
579
			if 'posix' in self.options:
590
				ocs.append('posixGroup')
580
				ocs.append('posixGroup')
591
				ocs.append('univentionGroup')
581
			else:
582
				ocs.append('organizationalRole')  # any STRUCTURAL class with 'cn'
583
			ocs.append('univentionGroup')
592
			if 'samba' in self.options:
584
			if 'samba' in self.options:
593
				ocs.append('sambaGroupMapping')
585
				ocs.append('sambaGroupMapping')
594
				if not 'posix' in self.options:
595
					ocs.append('organizationalRole')
596
				al.append(('sambaSID', [self.groupSid]))
586
				al.append(('sambaSID', [self.groupSid]))
597
587
			if set(('posix', 'samba')) & set(self.options):
598
			al.append(('gidNumber', [self.gidNum]))
588
				al.append(('gidNumber', [self.gidNum]))
599
600
			al.insert(0, ('objectClass', ocs))
601
			return al
589
			return al
602
		except:
590
		except:
603
			self.cancel()
591
			self.cancel()

Return to bug 28145