View | Details | Raw Unified | Return to bug 33223 | Differences between
and this patch

Collapse All | Expand All

(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py (-15 / +3 lines)
 Lines 546-561   class simpleLdap(base): Link Here 
546
		self.exceptions=[]
546
		self.exceptions=[]
547
547
548
		# remove all properties which do not belong to chosen options
548
		# remove all properties which do not belong to chosen options
549
550
		chosen_options = None
551
		descriptions = None
552
553
		try:
549
		try:
554
			# these might not be set by an inheriting module
550
			# these might not be set by an inheriting module
555
			chosen_options = self.options
551
			chosen_options = self.options
556
			descriptions = self.descriptions
552
			descriptions = self.descriptions
557
		except:
553
		except:
558
			pass
554
			chosen_options = None
555
			descriptions = None
559
556
560
		if chosen_options and descriptions:
557
		if chosen_options and descriptions:
561
			for desc in descriptions:
558
			for desc in descriptions:
 Lines 1009-1016   class simpleLdap(base): Link Here 
1009
			self.policyObjects[policy_type]=univention.admin.objects.get(policy_module, None, self.lo, policy_position)
1006
			self.policyObjects[policy_type]=univention.admin.objects.get(policy_module, None, self.lo, policy_position)
1010
			self.policyObjects[policy_type].copyIdentifier(self)
1007
			self.policyObjects[policy_type].copyIdentifier(self)
1011
			self._init_ldap_search( self.policyObjects[ policy_type ] )
1008
			self._init_ldap_search( self.policyObjects[ policy_type ] )
1012
		else:
1013
			pass
1014
1009
1015
		return self.policyObjects[policy_type]
1010
		return self.policyObjects[policy_type]
1016
1011
 Lines 1519-1525   class simpleComputer( simpleLdap ): Link Here 
1519
						modify(rdn, zone)
1514
						modify(rdn, zone)
1520
					except univention.admin.uexceptions.noObject:
1515
					except univention.admin.uexceptions.noObject:
1521
						pass
1516
						pass
1522
			pass
1517
1523
	def __add_dns_reverse_object( self, name, zoneDn, ip ):
1518
	def __add_dns_reverse_object( self, name, zoneDn, ip ):
1524
		univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'we should create a dns reverse object: zoneDn="%s", name="%s", ip="%s"' % ( zoneDn, name, ip ) )
1519
		univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'we should create a dns reverse object: zoneDn="%s", name="%s", ip="%s"' % ( zoneDn, name, ip ) )
1525
		if name and zoneDn and ip:
1520
		if name and zoneDn and ip:
 Lines 1798-1804   class simpleComputer( simpleLdap ): Link Here 
1798
			else:
1793
			else:
1799
				# thow exeption, cNAMERecord is single value
1794
				# thow exeption, cNAMERecord is single value
1800
				raise univention.admin.uexceptions.dnsAliasAlreadyUsed, _('DNS alias is already in use.')
1795
				raise univention.admin.uexceptions.dnsAliasAlreadyUsed, _('DNS alias is already in use.')
1801
		pass
1802
1796
1803
	def __remove_dns_alias_object( self, name, dnsForwardZone, dnsAliasZoneContainer, alias = None ):
1797
	def __remove_dns_alias_object( self, name, dnsForwardZone, dnsAliasZoneContainer, alias = None ):
1804
		univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'remove a dns alias object: name="%s", dnsForwardZone="%s", dnsAliasZoneContainer="%s", alias="%s"' % ( name, dnsForwardZone, dnsAliasZoneContainer, alias ) )
1798
		univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'remove a dns alias object: name="%s", dnsForwardZone="%s", dnsAliasZoneContainer="%s", alias="%s"' % ( name, dnsForwardZone, dnsAliasZoneContainer, alias ) )
 Lines 1963-1969   class simpleComputer( simpleLdap ): Link Here 
1963
			self.__update_groups_after_namechange()
1957
			self.__update_groups_after_namechange()
1964
			self.__rename_dhcp_object( position = None, old_name = self.__changes[ 'name' ][ 0 ], new_name = self.__changes[ 'name' ][ 1 ] )
1958
			self.__rename_dhcp_object( position = None, old_name = self.__changes[ 'name' ][ 0 ], new_name = self.__changes[ 'name' ][ 1 ] )
1965
			self.__rename_dns_object( position = None, old_name = self.__changes[ 'name' ][ 0 ], new_name = self.__changes[ 'name' ][ 1 ] )
1959
			self.__rename_dns_object( position = None, old_name = self.__changes[ 'name' ][ 0 ], new_name = self.__changes[ 'name' ][ 1 ] )
1966
			pass
1967
1960
1968
		if self.ipRequest == 1 and self[ 'ip' ]:
1961
		if self.ipRequest == 1 and self[ 'ip' ]:
1969
			for ipAddress in self[ 'ip' ]:
1962
			for ipAddress in self[ 'ip' ]:
 Lines 2545-2553   class simpleComputer( simpleLdap ): Link Here 
2545
							self.__saved_dhcp_entry = network_object['dhcpEntryZone']
2538
							self.__saved_dhcp_entry = network_object['dhcpEntryZone']
2546
2539
2547
					self.old_network=value
2540
					self.old_network=value
2548
				else:
2549
					pass
2550
2551
2541
2552
		elif key == 'ip':
2542
		elif key == 'ip':
2553
			self.ip_freshly_set = True
2543
			self.ip_freshly_set = True
2554
- 
2555
--
2556
.../modules/univention/admin/handlers/__init__.py  | 28 +++++++---------------
2544
.../modules/univention/admin/handlers/__init__.py  | 28 +++++++---------------
2557
.../univention/admin/handlers/dhcp/service.py      |  3 +--
2545
.../univention/admin/handlers/dhcp/service.py      |  3 +--
2558
.../univention/admin/handlers/dhcp/sharedsubnet.py |  2 +-
2546
.../univention/admin/handlers/dhcp/sharedsubnet.py |  2 +-
2559
.../univention/admin/handlers/dhcp/subnet.py       |  4 ++--
2547
.../univention/admin/handlers/dhcp/subnet.py       |  4 ++--
2560
4 files changed, 12 insertions(+), 25 deletions(-)
2548
4 files changed, 12 insertions(+), 25 deletions(-)
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py (-20 / +8 lines)
 Lines 558-576   class simpleLdap(base): Link Here 
558
			for desc in descriptions:
558
			for desc in descriptions:
559
				propoptions = descriptions[desc].options
559
				propoptions = descriptions[desc].options
560
560
561
				if (propoptions==[]):
561
				if not propoptions:
562
					# property applies to all options
562
					# property applies to all options
563
					continue
563
					continue
564
564
565
				shortcut = False
565
				if set(propoptions) & set(chosen_options):
566
566
					# this property applies to one of the chosen options,
567
				for i in propoptions:
567
					# jump to next option
568
					if i in chosen_options:
569
						# this property applies to one of the chosen options,
570
						# jump to next option
571
						shortcut = True
572
						continue
573
				if shortcut:
574
					continue
568
					continue
575
569
576
				# if we've come here, we found a property that does not apply
570
				# if we've come here, we found a property that does not apply
 Lines 1840-1847   class simpleComputer( simpleLdap ): Link Here 
1840
1834
1841
	def _ldap_post_modify( self ):
1835
	def _ldap_post_modify( self ):
1842
1836
1843
		if len ( self[ 'mac' ] ) > 1 or len( self[ 'ip' ] ) > 1:
1837
		self.__multiip |= len(self['mac']) > 1 or len(self['ip']) > 1
1844
			self.__multiip = True
1845
1838
1846
		for entry in self.__changes[ 'dhcpEntryZone' ][ 'remove' ]:
1839
		for entry in self.__changes[ 'dhcpEntryZone' ][ 'remove' ]:
1847
			univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'simpleComputer: dhcp check: removed: %s' % entry )
1840
			univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'simpleComputer: dhcp check: removed: %s' % entry )
 Lines 2164-2175   class simpleComputer( simpleLdap ): Link Here 
2164
				else:
2157
				else:
2165
					raise univention.admin.uexceptions.invalidDNSAliasEntry, _('The DNS alias entry for this host should contain the zone name, the alias zone container LDAP-DN and the alias.')
2158
					raise univention.admin.uexceptions.invalidDNSAliasEntry, _('The DNS alias entry for this host should contain the zone name, the alias zone container LDAP-DN and the alias.')
2166
2159
2167
		if len ( self[ 'mac' ] ) < 2 and len( self[ 'ip' ] ) < 2:
2160
		self.__multiip = len(self['mac']) > 1 or len(self['ip']) > 1
2168
			self.__multiip = False
2169
		else:
2170
			self.__multiip = True
2171
2161
2172
		ml = ml + super( simpleComputer, self )._ldap_modlist( )
2162
		ml += super(simpleComputer, self)._ldap_modlist()
2173
2163
2174
		return ml
2164
		return ml
2175
2165
 Lines 2785-2793   class simplePolicy(simpleLdap): Link Here 
2785
				if self.hasChanged(key):
2775
				if self.hasChanged(key):
2786
					univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'polinfo: key:%s hasChanged' % (key) )
2776
					univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'polinfo: key:%s hasChanged' % (key) )
2787
					self.changes=1
2777
					self.changes=1
2788
				return
2778
			return
2789
			else:
2790
				return
2791
2779
2792
		# this object did not exist before
2780
		# this object did not exist before
2793
		if not self.oldinfo:
2781
		if not self.oldinfo:
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py (-2 / +1 lines)
 Lines 123-127   def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, Link Here 
123
	return res
123
	return res
124
124
125
def identify(dn, attr):
125
def identify(dn, attr):
126
	return 'dhcpService' in attr.get('objectClass', []) \
126
	return bool(set(('dhcpService', 'univentionDhcpService')) & set(attr.get('objectClass', [])))
127
		or 'univentionDhcpService' in attr.get('objectClass', [])
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py (-1 / +1 lines)
 Lines 171-174   def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, Link Here 
171
	return res
171
	return res
172
172
173
def identify(dn, attr):
173
def identify(dn, attr):
174
	return 'univentionDhcpSubnet' in attr.get('objectClass', []) and 'univentionDhcpSharedSubnet' in attr.get('objectClass', [])
174
	return set(('univentionDhcpSubnet', 'univentionDhcpSharedSubnet')) <= set(attr.get('objectClass', []))
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py (-4 / +2 lines)
 Lines 205-209   def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, Link Here 
205
	return res
205
	return res
206
206
207
def identify(dn, attr):
207
def identify(dn, attr):
208
	
208
	ocs = set(attr.get('objectClass', []))
209
	return 'univentionDhcpSubnet' in attr.get('objectClass', []) and not 'univentionDhcpSharedSubnet' in attr.get('objectClass', [])
209
	return 'univentionDhcpSubnet' in ocs and not 'univentionDhcpSharedSubnet' in ocs
210
- 
211
--
212
.../modules/univention/admin/handlers/__init__.py  | 31 +++++++++++-----------
210
.../modules/univention/admin/handlers/__init__.py  | 31 +++++++++++-----------
213
.../modules/univention/admin/handlers/dhcp/pool.py |  1 -
211
.../modules/univention/admin/handlers/dhcp/pool.py |  1 -
214
.../univention/admin/handlers/dhcp/sharedsubnet.py |  2 --
212
.../univention/admin/handlers/dhcp/sharedsubnet.py |  2 --
215
.../univention/admin/handlers/dhcp/subnet.py       |  4 +--
213
.../univention/admin/handlers/dhcp/subnet.py       |  4 +--
216
4 files changed, 16 insertions(+), 22 deletions(-)
214
4 files changed, 16 insertions(+), 22 deletions(-)
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py (-16 / +15 lines)
 Lines 33-39    Link Here 
33
import copy
33
import copy
34
import types
34
import types
35
import re
35
import re
36
import string
37
import ldap
36
import ldap
38
import ipaddr
37
import ipaddr
39
38
 Lines 1111-1117   class simpleComputer( simpleLdap ): Link Here 
1111
		zoneName.reverse( )
1110
		zoneName.reverse( )
1112
		relativeDomainName = relativeDomainName.split( '.' )
1111
		relativeDomainName = relativeDomainName.split( '.' )
1113
		relativeDomainName.reverse( )
1112
		relativeDomainName.reverse( )
1114
		return '%s.%s' % ( string.join( zoneName, '.' ) , string.join( relativeDomainName, '.' ) )
1113
		return '.'.join(zoneName + relativeDomainName)
1115
1114
1116
	def __ip_from_ptr_ipv6( self, zoneName, relativeDomainName ):
1115
	def __ip_from_ptr_ipv6( self, zoneName, relativeDomainName ):
1117
		fullName = relativeDomainName + '.' + zoneName.replace('.ip6.arpa', '')
1116
		fullName = relativeDomainName + '.' + zoneName.replace('.ip6.arpa', '')
 Lines 1200-1206   class simpleComputer( simpleLdap ): Link Here 
1200
							poscomponents = univention.admin.uldap.explodeDn( dn,0 )
1199
							poscomponents = univention.admin.uldap.explodeDn( dn,0 )
1201
							poscomponents.pop( 0 )
1200
							poscomponents.pop( 0 )
1202
							ip = self.__ip_from_ptr( attr[ 'zoneName' ][ 0 ], attr[ 'relativeDomainName' ][ 0 ] )
1201
							ip = self.__ip_from_ptr( attr[ 'zoneName' ][ 0 ], attr[ 'relativeDomainName' ][ 0 ] )
1203
							entry = [ string.join( poscomponents, ',' ), ip ]
1202
							entry = [','.join(poscomponents), ip]
1204
							if not entry in self[ 'dnsEntryZoneReverse' ]:
1203
							if not entry in self[ 'dnsEntryZoneReverse' ]:
1205
								self[ 'dnsEntryZoneReverse' ].append( entry )
1204
								self[ 'dnsEntryZoneReverse' ].append( entry )
1206
					except univention.admin.uexceptions.insufficientInformation, msg:
1205
					except univention.admin.uexceptions.insufficientInformation, msg:
 Lines 1218-1224   class simpleComputer( simpleLdap ): Link Here 
1218
							self[ 'dnsAlias' ].append(dnsAlias)
1217
							self[ 'dnsAlias' ].append(dnsAlias)
1219
							poscomponents = univention.admin.uldap.explodeDn( dn,0 )
1218
							poscomponents = univention.admin.uldap.explodeDn( dn,0 )
1220
							poscomponents.pop( 0 )
1219
							poscomponents.pop( 0 )
1221
							dnsAliasZoneContainer = string.join( poscomponents,',' )
1220
							dnsAliasZoneContainer = ','.join(poscomponents)
1222
							if attr[ 'cNAMERecord' ][0] == self[ 'name' ]:
1221
							if attr[ 'cNAMERecord' ][0] == self[ 'name' ]:
1223
								dnsForwardZone = attr[ 'zoneName' ][0]
1222
								dnsForwardZone = attr[ 'zoneName' ][0]
1224
							else:
1223
							else:
 Lines 1250-1261   class simpleComputer( simpleLdap ): Link Here 
1250
							poscomponents.pop( 0 )
1249
							poscomponents.pop( 0 )
1251
							if attr.has_key( 'univentionDhcpFixedAddress' ):
1250
							if attr.has_key( 'univentionDhcpFixedAddress' ):
1252
								for ip in attr[ 'univentionDhcpFixedAddress' ]:
1251
								for ip in attr[ 'univentionDhcpFixedAddress' ]:
1253
									entry = [ string.join( poscomponents,',' ), ip, macAddress ]
1252
									entry = [','.join(poscomponents), ip, macAddress]
1254
									if not entry in self[ 'dhcpEntryZone' ]:
1253
									if not entry in self[ 'dhcpEntryZone' ]:
1255
										self[ 'dhcpEntryZone' ].append( entry )
1254
										self[ 'dhcpEntryZone' ].append( entry )
1256
1255
1257
							else:
1256
							else:
1258
								entry = [ string.join( poscomponents,',' ), macAddress ]
1257
								entry = [','.join(poscomponents), macAddress]
1259
								if not entry in self[ 'dhcpEntryZone' ]:
1258
								if not entry in self[ 'dhcpEntryZone' ]:
1260
									self[ 'dhcpEntryZone' ].append( entry )
1259
									self[ 'dhcpEntryZone' ].append( entry )
1261
						univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'open: DHCP; self[ dhcpEntryZone ] = "%s"' % self[ 'dhcpEntryZone' ] )
1260
						univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'open: DHCP; self[ dhcpEntryZone ] = "%s"' % self[ 'dhcpEntryZone' ] )
 Lines 1499-1505   class simpleComputer( simpleLdap ): Link Here 
1499
			results = self.lo.search( base = tmppos.getBase( ), scope = 'domain', attr = [ 'zoneDn' ], filter = '(&(objectClass=dNSZone)(|(pTRRecord=%s)(pTRRecord=%s.*)))' % ( name, name ), unique = 0 )
1498
			results = self.lo.search( base = tmppos.getBase( ), scope = 'domain', attr = [ 'zoneDn' ], filter = '(&(objectClass=dNSZone)(|(pTRRecord=%s)(pTRRecord=%s.*)))' % ( name, name ), unique = 0 )
1500
			for dn, attr in results:
1499
			for dn, attr in results:
1501
				univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'DEBUG: dn: "%s"' % dn )
1500
				univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'DEBUG: dn: "%s"' % dn )
1502
				zone = string.join( ldap.explode_dn( dn )[ 1: ], ',' )
1501
				zone = ','.join(ldap.explode_dn(dn)[1:])
1503
				univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'DEBUG: zone: "%s"' % zone )
1502
				univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'DEBUG: zone: "%s"' % zone )
1504
				rdn = self.calc_dns_reverse_entry_name( ip, zone )
1503
				rdn = self.calc_dns_reverse_entry_name( ip, zone )
1505
				univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'DEBUG: rdn: "%s"' % rdn )
1504
				univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'DEBUG: rdn: "%s"' % rdn )
 Lines 1539-1551   class simpleComputer( simpleLdap ): Link Here 
1539
			else:
1538
			else:
1540
				subnet = ldap.explode_dn( zoneDn, 1 )[ 0 ].replace( '.in-addr.arpa', '' ).split( '.' )
1539
				subnet = ldap.explode_dn( zoneDn, 1 )[ 0 ].replace( '.in-addr.arpa', '' ).split( '.' )
1541
				subnet.reverse( )
1540
				subnet.reverse( )
1542
				subnet = string.join( subnet, '.' ) + '.'
1541
				subnet = '.'.join(subnet) + '.'
1543
				ipPart = ip.replace( subnet, '' )
1542
				ipPart = ip.replace( subnet, '' )
1544
				if ipPart == ip:
1543
				if ipPart == ip:
1545
					raise univention.admin.uexceptions.InvalidDNS_Information, _( 'Reverse zone and IP address are incompatible.' )
1544
					raise univention.admin.uexceptions.InvalidDNS_Information, _( 'Reverse zone and IP address are incompatible.' )
1546
				pointer = string.split( ipPart, '.' )
1545
				pointer = ipPart.split('.')
1547
				pointer.reverse( )
1546
				pointer.reverse( )
1548
				ipPart = string.join( pointer, '.' )
1547
				ipPart = '.'.join(pointer)
1549
				tmppos = univention.admin.uldap.position( self.position.getDomain( ) )
1548
				tmppos = univention.admin.uldap.position( self.position.getDomain( ) )
1550
				# check in which forward zone the ip is set
1549
				# check in which forward zone the ip is set
1551
				hostname_list = []
1550
				hostname_list = []
 Lines 1601-1607   class simpleComputer( simpleLdap ): Link Here 
1601
						# remove the object
1600
						# remove the object
1602
						self.lo.delete( dn )
1601
						self.lo.delete( dn )
1603
						if not zoneDn:
1602
						if not zoneDn:
1604
							zone = string.join( ldap.explode_dn( dn )[ 1: ], ',' )
1603
							zone = ','.join(ldap.explode_dn(dn)[1:])
1605
						else:
1604
						else:
1606
							zone = zoneDn
1605
							zone = zoneDn
1607
1606
 Lines 1616-1622   class simpleComputer( simpleLdap ): Link Here 
1616
						self.lo.modify(dn, [(attrEdit, attr[attrEdit], new_ip_list, ), ])
1615
						self.lo.modify(dn, [(attrEdit, attr[attrEdit], new_ip_list, ), ])
1617
1616
1618
						if not zoneDn:
1617
						if not zoneDn:
1619
							zone = string.join( ldap.explode_dn( dn )[ 1: ], ',' )
1618
							zone = ','.join(ldap.explode_dn(dn)[1:])
1620
						else:
1619
						else:
1621
							zone = zoneDn
1620
							zone = zoneDn
1622
1621
 Lines 1696-1702   class simpleComputer( simpleLdap ): Link Here 
1696
						modlist.append( ('aRecord', old_aRecord, new_aRecord, ) )
1695
						modlist.append( ('aRecord', old_aRecord, new_aRecord, ) )
1697
				self.lo.modify(dn, modlist)
1696
				self.lo.modify(dn, modlist)
1698
				if not zoneDn:
1697
				if not zoneDn:
1699
					zone = string.join( ldap.explode_dn( dn )[ 1: ], ',' )
1698
					zone = ','.join(ldap.explode_dn(dn)[1:])
1700
1699
1701
			if zoneDn:
1700
			if zoneDn:
1702
				zone = zoneDn
1701
				zone = zoneDn
 Lines 1919-1925   class simpleComputer( simpleLdap ): Link Here 
1919
					if len (self[ 'mac' ] ) > 0:
1918
					if len (self[ 'mac' ] ) > 0:
1920
						dn = self.__remove_from_dhcp_object(  None, self[ 'name' ], entry,  self[ 'mac' ][ 0 ])
1919
						dn = self.__remove_from_dhcp_object(  None, self[ 'name' ], entry,  self[ 'mac' ][ 0 ])
1921
						try:
1920
						try:
1922
							dn = string.join(dn.split(',')[1:],',')
1921
							dn = ','.join(dn.split(',')[1:])
1923
							self.__modify_dhcp_object( dn, self[ 'name' ], self.__changes[ 'ip' ][ 'add' ][ 0 ],  self[ 'mac' ][ 0 ] )
1922
							self.__modify_dhcp_object( dn, self[ 'name' ], self.__changes[ 'ip' ][ 'add' ][ 0 ],  self[ 'mac' ][ 0 ] )
1924
						except:
1923
						except:
1925
							pass
1924
							pass
 Lines 1967-1979   class simpleComputer( simpleLdap ): Link Here 
1967
1966
1968
	def __remove_associated_domain( self, entry ):
1967
	def __remove_associated_domain( self, entry ):
1969
		dn, ip = self.__split_dns_line( entry )
1968
		dn, ip = self.__split_dns_line( entry )
1970
		domain = string.join(ldap.explode_rdn(dn)[0].split('=')[1:], '=')
1969
		domain = ldap.explode_rdn(dn)[0].split('=', 1)[1]
1971
		if self.info.get('domain', None) == domain:
1970
		if self.info.get('domain', None) == domain:
1972
			self.info['domain'] = None
1971
			self.info['domain'] = None
1973
1972
1974
	def __set_associated_domain( self, entry ):
1973
	def __set_associated_domain( self, entry ):
1975
		dn, ip = self.__split_dns_line( entry )
1974
		dn, ip = self.__split_dns_line( entry )
1976
		domain = string.join(ldap.explode_rdn(dn)[0].split('=')[1:], '=')
1975
		domain = ldap.explode_rdn(dn)[0].split('=', 1)[1]
1977
		if not self.info.get('domain', None):
1976
		if not self.info.get('domain', None):
1978
			self.info['domain'] = domain
1977
			self.info['domain'] = domain
1979
1978
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py (-1 lines)
 Lines 31-37    Link Here 
31
# <http://www.gnu.org/licenses/>.
31
# <http://www.gnu.org/licenses/>.
32
32
33
import copy
33
import copy
34
import string
35
34
36
from univention.admin.layout import Tab, Group
35
from univention.admin.layout import Tab, Group
37
import univention.admin.filter
36
import univention.admin.filter
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py (-2 lines)
 Lines 30-37    Link Here 
30
# /usr/share/common-licenses/AGPL-3; if not, see
30
# /usr/share/common-licenses/AGPL-3; if not, see
31
# <http://www.gnu.org/licenses/>.
31
# <http://www.gnu.org/licenses/>.
32
32
33
import string
34
35
from univention.admin.layout import Tab, Group
33
from univention.admin.layout import Tab, Group
36
import univention.admin.filter
34
import univention.admin.filter
37
import univention.admin.handlers
35
import univention.admin.handlers
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py (-5 / +1 lines)
 Lines 30-37    Link Here 
30
# /usr/share/common-licenses/AGPL-3; if not, see
30
# /usr/share/common-licenses/AGPL-3; if not, see
31
# <http://www.gnu.org/licenses/>.
31
# <http://www.gnu.org/licenses/>.
32
32
33
import string
34
35
from univention.admin.layout import Tab, Group
33
from univention.admin.layout import Tab, Group
36
import univention.admin.filter
34
import univention.admin.filter
37
import univention.admin.handlers
35
import univention.admin.handlers
 Lines 178-184   class object(univention.admin.handlers.simpleLdap): Link Here 
178
						raise univention.admin.uexceptions.rangeInBroadcastAddress, '%s-%s' % (i[0], i[1])
176
						raise univention.admin.uexceptions.rangeInBroadcastAddress, '%s-%s' % (i[0], i[1])
179
177
180
				if ip_in_network:
178
				if ip_in_network:
181
					dhcpRange.append(string.join(i, ' '))
179
					dhcpRange.append(' '.join(i))
182
				else:
180
				else:
183
					raise univention.admin.uexceptions.rangeNotInNetwork, '%s-%s' % (i[0], i[1])
181
					raise univention.admin.uexceptions.rangeNotInNetwork, '%s-%s' % (i[0], i[1])
184
			#univention.debug.debug(univention.debug.ADMIN, univention.debug.ERROR, 'old Range: %s' % self.oldinfo['range'])
182
			#univention.debug.debug(univention.debug.ADMIN, univention.debug.ERROR, 'old Range: %s' % self.oldinfo['range'])
185
- 
186
--
187
.../modules/univention/admin/handlers/dhcp/__common.py           | 9 +--------
183
.../modules/univention/admin/handlers/dhcp/__common.py           | 9 +--------
188
.../modules/univention/admin/handlers/dhcp/pool.py               | 3 ---
184
.../modules/univention/admin/handlers/dhcp/pool.py               | 3 ---
189
.../modules/univention/admin/handlers/dhcp/shared.py             | 7 -------
185
.../modules/univention/admin/handlers/dhcp/shared.py             | 7 -------
190
.../modules/univention/admin/handlers/dhcp/sharedsubnet.py       | 3 ---
186
.../modules/univention/admin/handlers/dhcp/sharedsubnet.py       | 3 ---
191
.../modules/univention/admin/handlers/dhcp/subnet.py             | 3 ---
187
.../modules/univention/admin/handlers/dhcp/subnet.py             | 3 ---
192
5 files changed, 1 insertion(+), 24 deletions(-)
188
5 files changed, 1 insertion(+), 24 deletions(-)
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py (-8 / +1 lines)
 Lines 33-39    Link Here 
33
import copy
33
import copy
34
34
35
import univention.admin.localization
35
import univention.admin.localization
36
from univention.admin.layout import Tab, Group
36
from univention.admin.layout import Tab
37
37
38
translation = univention.admin.localization.translation( 'univention.admin.handlers.dhcp' )
38
translation = univention.admin.localization.translation( 'univention.admin.handlers.dhcp' )
39
_ = translation.translate
39
_ = translation.translate
 Lines 51-64   _properties = { Link Here 
51
		),
51
		),
52
}
52
}
53
53
54
# def optionMap( value ):
55
# 	return map( lambda x: ' '.join( x ), value )
56
57
# def optionUnmap( value ):
58
# 	return map( lambda x: x.split( ' ', 1 ), value )
59
60
_mappings = (
54
_mappings = (
61
	# ( 'option', 'dhcpOption', optionMap, optionUnmap ),
62
	( 'option', 'dhcpOption', None, univention.admin.mapping.ListToString ),
55
	( 'option', 'dhcpOption', None, univention.admin.mapping.ListToString ),
63
	)
56
	)
64
57
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py (-3 lines)
 Lines 124-132   property_descriptions={ Link Here 
124
		),
124
		),
125
}
125
}
126
126
127
options={
128
}
129
130
layout = [
127
layout = [
131
	Tab(_('General'), _('Basic settings'), layout = [
128
	Tab(_('General'), _('Basic settings'), layout = [
132
		Group( _( 'General' ), layout = [
129
		Group( _( 'General' ), layout = [
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py (-7 lines)
 Lines 60-67   property_descriptions={ Link Here 
60
			identifies=1
60
			identifies=1
61
		)
61
		)
62
}
62
}
63
options={
64
}
65
63
66
layout = [
64
layout = [
67
	Tab( _( 'General' ), _( 'Basic settings' ), layout = [
65
	Tab( _( 'General' ), _( 'Basic settings' ), layout = [
 Lines 91-101   class object(univention.admin.handlers.simpleLdap): Link Here 
91
89
92
		univention.admin.handlers.simpleLdap.__init__(self, co, lo, position, dn, superordinate, attributes = attributes )
90
		univention.admin.handlers.simpleLdap.__init__(self, co, lo, position, dn, superordinate, attributes = attributes )
93
91
94
	def open(self):
95
		univention.admin.handlers.simpleLdap.open(self)
96
97
		self.save()
98
99
	def _ldap_pre_create(self):
92
	def _ldap_pre_create(self):
100
		self.dn='%s=%s,%s' % (mapping.mapName('name'), mapping.mapValue('name', self.info['name']), self.position.getDn())
93
		self.dn='%s=%s,%s' % (mapping.mapName('name'), mapping.mapValue('name', self.info['name']), self.position.getDn())
101
94
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py (-3 lines)
 Lines 91-99   property_descriptions={ Link Here 
91
		),
91
		),
92
}
92
}
93
93
94
options={
95
}
96
97
layout = [
94
layout = [
98
	Tab(_('General'), _('Basic settings'), layout = [
95
	Tab(_('General'), _('Basic settings'), layout = [
99
		Group( _( 'General' ), layout = [
96
		Group( _( 'General' ), layout = [
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py (-5 lines)
 Lines 92-100   property_descriptions={ Link Here 
92
		),
92
		),
93
}
93
}
94
94
95
options={
96
}
97
98
layout = [
95
layout = [
99
	Tab( _( 'General' ), _('Basic settings'), layout = [
96
	Tab( _( 'General' ), _('Basic settings'), layout = [
100
		Group( _( 'General' ), layout = [
97
		Group( _( 'General' ), layout = [
101
- 
102
--
103
.../modules/univention/admin/handlers/dhcp/__common.py           | 9 +++++++++
98
.../modules/univention/admin/handlers/dhcp/__common.py           | 9 +++++++++
104
.../modules/univention/admin/handlers/dhcp/pool.py               | 5 +----
99
.../modules/univention/admin/handlers/dhcp/pool.py               | 5 +----
105
.../modules/univention/admin/handlers/dhcp/sharedsubnet.py       | 5 +----
100
.../modules/univention/admin/handlers/dhcp/sharedsubnet.py       | 5 +----
106
.../modules/univention/admin/handlers/dhcp/subnet.py             | 6 +-----
101
.../modules/univention/admin/handlers/dhcp/subnet.py             | 6 +-----
107
4 files changed, 12 insertions(+), 13 deletions(-)
102
4 files changed, 12 insertions(+), 13 deletions(-)
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py (+9 lines)
 Lines 51-56   _properties = { Link Here 
51
		),
51
		),
52
}
52
}
53
53
54
55
def rangeMap(value):
56
	return map(lambda x: ' '.join(x), value)
57
58
59
def rangeUnmap(value):
60
	return map(lambda x: x.split(), value)
61
62
54
_mappings = (
63
_mappings = (
55
	( 'option', 'dhcpOption', None, univention.admin.mapping.ListToString ),
64
	( 'option', 'dhcpOption', None, univention.admin.mapping.ListToString ),
56
	)
65
	)
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py (-4 / +1 lines)
 Lines 138-148   layout = [ Link Here 
138
	] )
138
	] )
139
]
139
]
140
140
141
def rangeMap( value ):
142
	return map( lambda x: ' '.join( x ), value )
143
141
144
def rangeUnmap( value ):
142
from .__common import rangeMap, rangeUnmap
145
	return map( lambda x: x.split( ' ' ), value )
146
143
147
mapping=univention.admin.mapping.mapping()
144
mapping=univention.admin.mapping.mapping()
148
mapping.register('name', 'cn', None, univention.admin.mapping.ListToString)
145
mapping.register('name', 'cn', None, univention.admin.mapping.ListToString)
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py (-4 / +1 lines)
 Lines 101-111   layout = [ Link Here 
101
	] ),
101
	] ),
102
]
102
]
103
103
104
def rangeMap( value ):
105
	return map( lambda x: ' '.join( x ), value ) or None
106
104
107
def rangeUnmap( value ):
105
from .__common import rangeMap, rangeUnmap
108
	return map( lambda x: x.split( ' ' ), value )
109
106
110
mapping=univention.admin.mapping.mapping()
107
mapping=univention.admin.mapping.mapping()
111
mapping.register('subnet', 'cn', None, univention.admin.mapping.ListToString)
108
mapping.register('subnet', 'cn', None, univention.admin.mapping.ListToString)
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py (-7 / +1 lines)
 Lines 102-112   layout = [ Link Here 
102
	] ),
102
	] ),
103
]
103
]
104
104
105
def rangeMap( value ):
105
from .__common import rangeUnmap
106
	return map( lambda x: ' '.join( x ), value )
107
108
def rangeUnmap( value ):
109
	return map( lambda x: x.split(), value )
110
106
111
mapping=univention.admin.mapping.mapping()
107
mapping=univention.admin.mapping.mapping()
112
mapping.register('subnet', 'cn', None, univention.admin.mapping.ListToString)
108
mapping.register('subnet', 'cn', None, univention.admin.mapping.ListToString)
113
- 
114
--
115
.../modules/univention/admin/handlers/dhcp/__common.py                | 4 ++--
109
.../modules/univention/admin/handlers/dhcp/__common.py                | 4 ++--
116
1 file changed, 2 insertions(+), 2 deletions(-)
110
1 file changed, 2 insertions(+), 2 deletions(-)
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py (-4 / +2 lines)
 Lines 61-68   def rangeUnmap(value): Link Here 
61
61
62
62
63
_mappings = (
63
_mappings = (
64
	( 'option', 'dhcpOption', None, univention.admin.mapping.ListToString ),
64
	('option', 'dhcpOption', None, None),
65
	)
65
)
66
66
67
def add_dhcp_options( properties, mapping, layout ):
67
def add_dhcp_options( properties, mapping, layout ):
68
	global _properties, _mappings
68
	global _properties, _mappings
69
- 
70
--
71
.../modules/univention/admin/handlers/dhcp/__common.py                 | 2 --
69
.../modules/univention/admin/handlers/dhcp/__common.py                 | 2 --
72
.../modules/univention/admin/handlers/dhcp/dhcp.py                     | 3 ---
70
.../modules/univention/admin/handlers/dhcp/dhcp.py                     | 3 ---
73
.../modules/univention/admin/handlers/dhcp/host.py                     | 3 ---
71
.../modules/univention/admin/handlers/dhcp/host.py                     | 3 ---
74
.../modules/univention/admin/handlers/dhcp/pool.py                     | 3 ---
72
.../modules/univention/admin/handlers/dhcp/pool.py                     | 3 ---
75
.../modules/univention/admin/handlers/dhcp/server.py                   | 3 ---
73
.../modules/univention/admin/handlers/dhcp/server.py                   | 3 ---
76
.../modules/univention/admin/handlers/dhcp/service.py                  | 3 ---
74
.../modules/univention/admin/handlers/dhcp/service.py                  | 3 ---
77
.../modules/univention/admin/handlers/dhcp/shared.py                   | 3 ---
75
.../modules/univention/admin/handlers/dhcp/shared.py                   | 3 ---
78
.../modules/univention/admin/handlers/dhcp/sharedsubnet.py             | 3 ---
76
.../modules/univention/admin/handlers/dhcp/sharedsubnet.py             | 3 ---
79
.../modules/univention/admin/handlers/dhcp/subnet.py                   | 3 ---
77
.../modules/univention/admin/handlers/dhcp/subnet.py                   | 3 ---
80
9 files changed, 26 deletions(-)
78
9 files changed, 26 deletions(-)
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py (-2 lines)
 Lines 65-72   _mappings = ( Link Here 
65
)
65
)
66
66
67
def add_dhcp_options( properties, mapping, layout ):
67
def add_dhcp_options( properties, mapping, layout ):
68
	global _properties, _mappings
69
70
	for name, prop in _properties.items():
68
	for name, prop in _properties.items():
71
		properties[ name ] = prop
69
		properties[ name ] = prop
72
70
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/dhcp.py (-3 lines)
 Lines 93-101   class object(univention.admin.handlers.simpleLdap): Link Here 
93
	module=module
93
	module=module
94
94
95
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
95
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
96
		global mapping
97
		global property_descriptions
98
99
		self.mapping=mapping
96
		self.mapping=mapping
100
		self.descriptions=property_descriptions
97
		self.descriptions=property_descriptions
101
98
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py (-3 lines)
 Lines 118-126   class object(univention.admin.handlers.simpleLdap): Link Here 
118
	module=module
118
	module=module
119
119
120
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
120
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
121
		global mapping
122
		global property_descriptions
123
124
		self.mapping=mapping
121
		self.mapping=mapping
125
		self.descriptions=property_descriptions
122
		self.descriptions=property_descriptions
126
123
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py (-3 lines)
 Lines 150-158   class object(univention.admin.handlers.simpleLdap): Link Here 
150
	module=module
150
	module=module
151
151
152
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
152
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
153
		global mapping
154
		global property_descriptions
155
156
		self.mapping=mapping
153
		self.mapping=mapping
157
		self.descriptions=property_descriptions
154
		self.descriptions=property_descriptions
158
155
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py (-3 lines)
 Lines 81-89   class object(univention.admin.handlers.simpleLdap): Link Here 
81
	module=module
81
	module=module
82
82
83
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
83
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
84
		global mapping
85
		global property_descriptions
86
87
		self.superordinate=superordinate
84
		self.superordinate=superordinate
88
		self.mapping=mapping
85
		self.mapping=mapping
89
		self.descriptions=property_descriptions
86
		self.descriptions=property_descriptions
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py (-3 lines)
 Lines 79-87   class object(univention.admin.handlers.simpleLdap): Link Here 
79
	module=module
79
	module=module
80
80
81
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
81
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
82
		global mapping
83
		global property_descriptions
84
85
		self.mapping=mapping
82
		self.mapping=mapping
86
		self.descriptions=property_descriptions
83
		self.descriptions=property_descriptions
87
84
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py (-3 lines)
 Lines 76-84   class object(univention.admin.handlers.simpleLdap): Link Here 
76
	module=module
76
	module=module
77
77
78
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
78
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
79
		global mapping
80
		global property_descriptions
81
82
		self.mapping=mapping
79
		self.mapping=mapping
83
		self.descriptions=property_descriptions
80
		self.descriptions=property_descriptions
84
81
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py (-3 lines)
 Lines 118-126   class object(univention.admin.handlers.simpleLdap): Link Here 
118
	module=module
118
	module=module
119
119
120
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
120
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
121
		global mapping
122
		global property_descriptions
123
124
		self.superordinate=superordinate
121
		self.superordinate=superordinate
125
		self.mapping=mapping
122
		self.mapping=mapping
126
		self.descriptions=property_descriptions
123
		self.descriptions=property_descriptions
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py (-5 lines)
 Lines 117-125   class object(univention.admin.handlers.simpleLdap): Link Here 
117
	module=module
117
	module=module
118
118
119
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
119
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
120
		global mapping
121
		global property_descriptions
122
123
		self.superordinate=superordinate
120
		self.superordinate=superordinate
124
		self.mapping=mapping
121
		self.mapping=mapping
125
		self.descriptions=property_descriptions
122
		self.descriptions=property_descriptions
126
- 
127
properties
123
properties
128
--
129
.../modules/univention/admin/handlers/dhcp/pool.py | 22 ++++++++++++----------
124
.../modules/univention/admin/handlers/dhcp/pool.py | 22 ++++++++++++----------
130
1 file changed, 12 insertions(+), 10 deletions(-)
125
1 file changed, 12 insertions(+), 10 deletions(-)
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py (-12 / +12 lines)
 Lines 53-59   options={ Link Here 
53
property_descriptions={
53
property_descriptions={
54
	'name': univention.admin.property(
54
	'name': univention.admin.property(
55
			short_description=_('Name'),
55
			short_description=_('Name'),
56
			long_description='',
56
			long_description=_('A unique name used to identify this pool, e.g. "known" or "guests"'),
57
			syntax=univention.admin.syntax.string,
57
			syntax=univention.admin.syntax.string,
58
			multivalue=0,
58
			multivalue=0,
59
			include_in_default_search=1,
59
			include_in_default_search=1,
 Lines 74-80   property_descriptions={ Link Here 
74
		),
74
		),
75
	'failover_peer': univention.admin.property(
75
	'failover_peer': univention.admin.property(
76
			short_description=_('Failover peer'),
76
			short_description=_('Failover peer'),
77
			long_description='',
77
			long_description=_('The name of a failover configuration manually configured in /etc/dhcp/local.conf.'),
78
			syntax=univention.admin.syntax.string,
78
			syntax=univention.admin.syntax.string,
79
			multivalue=0,
79
			multivalue=0,
80
			options=[],
80
			options=[],
 Lines 83-90   property_descriptions={ Link Here 
83
			identifies=0,
83
			identifies=0,
84
		),
84
		),
85
	'known_clients': univention.admin.property(
85
	'known_clients': univention.admin.property(
86
			short_description=_('Allow known clients'),
86
			short_description=_('Give IP to known clients'),
87
			long_description='',
87
			long_description=_('Addresses are allocated for client, which have a host entry matching their MAC address.'),
88
			syntax=univention.admin.syntax.AllowDeny,
88
			syntax=univention.admin.syntax.AllowDeny,
89
			multivalue=0,
89
			multivalue=0,
90
			options=[],
90
			options=[],
 Lines 93-100   property_descriptions={ Link Here 
93
			identifies=0
93
			identifies=0
94
		),
94
		),
95
	'unknown_clients': univention.admin.property(
95
	'unknown_clients': univention.admin.property(
96
			short_description=_('Allow unknown clients'),
96
			short_description=_('Give IP to unknown clients'),
97
			long_description='',
97
			long_description=_('Addresses are allocated for clients, which do not have a host entry mating their MAC address.'),
98
			syntax=univention.admin.syntax.AllowDeny,
98
			syntax=univention.admin.syntax.AllowDeny,
99
			multivalue=0,
99
			multivalue=0,
100
			options=[],
100
			options=[],
 Lines 103-110   property_descriptions={ Link Here 
103
			identifies=0
103
			identifies=0
104
		),
104
		),
105
	'dynamic_bootp_clients': univention.admin.property(
105
	'dynamic_bootp_clients': univention.admin.property(
106
			short_description=_('Allow dynamic BOOTP clients'),
106
			short_description=_('Give IP to dynamic BOOTP clients'),
107
			long_description='',
107
			long_description=_(
108
				'Give addresses to clients using the legacy BOOTP protocol.'
109
				'Since BOOTP does not support an expiry date or a release mechanism, addresses are allocated indefinitely!'),
108
			syntax=univention.admin.syntax.AllowDeny,
110
			syntax=univention.admin.syntax.AllowDeny,
109
			multivalue=0,
111
			multivalue=0,
110
			options=[],
112
			options=[],
 Lines 113-120   property_descriptions={ Link Here 
113
			identifies=0
115
			identifies=0
114
		),
116
		),
115
	'all_clients': univention.admin.property(
117
	'all_clients': univention.admin.property(
116
			short_description=_('All clients'),
118
			short_description=_('Give IP from this pool'),
117
			long_description='',
119
			long_description=_('Give addresses from this pool at all or not.'),
118
			syntax=univention.admin.syntax.AllowDeny,
120
			syntax=univention.admin.syntax.AllowDeny,
119
			multivalue=0,
121
			multivalue=0,
120
			options=[],
122
			options=[],
121
- 
122
--
123
.../modules/univention/admin/handlers/dhcp/dhcp.py                 | 2 +-
123
.../modules/univention/admin/handlers/dhcp/dhcp.py                 | 2 +-
124
.../modules/univention/admin/handlers/dhcp/host.py                 | 2 +-
124
.../modules/univention/admin/handlers/dhcp/host.py                 | 2 +-
125
.../modules/univention/admin/handlers/dhcp/pool.py                 | 7 +++----
125
.../modules/univention/admin/handlers/dhcp/pool.py                 | 7 +++----
126
.../modules/univention/admin/handlers/dhcp/server.py               | 2 +-
126
.../modules/univention/admin/handlers/dhcp/server.py               | 2 +-
127
.../modules/univention/admin/handlers/dhcp/service.py              | 2 +-
127
.../modules/univention/admin/handlers/dhcp/service.py              | 2 +-
128
.../modules/univention/admin/handlers/dhcp/shared.py               | 2 +-
128
.../modules/univention/admin/handlers/dhcp/shared.py               | 2 +-
129
.../modules/univention/admin/handlers/dhcp/sharedsubnet.py         | 2 +-
129
.../modules/univention/admin/handlers/dhcp/sharedsubnet.py         | 2 +-
130
.../modules/univention/admin/handlers/dhcp/subnet.py               | 6 +++---
130
.../modules/univention/admin/handlers/dhcp/subnet.py               | 6 +++---
131
8 files changed, 12 insertions(+), 13 deletions(-)
131
8 files changed, 12 insertions(+), 13 deletions(-)
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/dhcp.py (-1 / +1 lines)
 Lines 96-102   class object(univention.admin.handlers.simpleLdap): Link Here 
96
		self.mapping=mapping
96
		self.mapping=mapping
97
		self.descriptions=property_descriptions
97
		self.descriptions=property_descriptions
98
98
99
		univention.admin.handlers.simpleLdap.__init__(self, co, lo, position, dn, superordinate, attributes = attributes )
99
		super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes)
100
100
101
101
102
def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, required=0, timeout=-1, sizelimit=0):
102
def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, required=0, timeout=-1, sizelimit=0):
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py (-1 / +1 lines)
 Lines 126-132   class object(univention.admin.handlers.simpleLdap): Link Here 
126
		if not dn and not position:
126
		if not dn and not position:
127
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
127
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
128
128
129
		univention.admin.handlers.simpleLdap.__init__(self, co, lo, position, dn, superordinate, attributes = attributes )
129
		super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes)
130
130
131
	def _ldap_pre_create(self):
131
	def _ldap_pre_create(self):
132
		self.dn='%s=%s,%s' % (mapping.mapName('host'), mapping.mapValue('host', self.info['host']), self.position.getDn())
132
		self.dn='%s=%s,%s' % (mapping.mapName('host'), mapping.mapValue('host', self.info['host']), self.position.getDn())
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py (-4 / +3 lines)
 Lines 160-170   class object(univention.admin.handlers.simpleLdap): Link Here 
160
		if not dn and not position:
160
		if not dn and not position:
161
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
161
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
162
162
163
		univention.admin.handlers.simpleLdap.__init__(self, co, lo, position, dn, superordinate, attributes = attributes )
163
		super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes)
164
164
165
	def open(self):
165
	def open(self):
166
166
		super(object, self).open()
167
		univention.admin.handlers.simpleLdap.open(self)
168
167
169
		for i in self.oldattr.get('dhcpPermitList', []):
168
		for i in self.oldattr.get('dhcpPermitList', []):
170
			pos=i.find(' ')
169
			pos=i.find(' ')
 Lines 191-197   class object(univention.admin.handlers.simpleLdap): Link Here 
191
		]
190
		]
192
	
191
	
193
	def _ldap_modlist(self):
192
	def _ldap_modlist(self):
194
		ml=univention.admin.handlers.simpleLdap._ldap_modlist(self)
193
		ml = super(object, self)._ldap_modlist()
195
		if self.hasChanged(['known_clients', 'unknown_clients', 'dynamic_bootp_clients', 'all_clients']):
194
		if self.hasChanged(['known_clients', 'unknown_clients', 'dynamic_bootp_clients', 'all_clients']):
196
			old=self.oldattr.get('dhcpPermitList', [])
195
			old=self.oldattr.get('dhcpPermitList', [])
197
			new=copy.deepcopy(old)
196
			new=copy.deepcopy(old)
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py (-1 / +1 lines)
 Lines 90-96   class object(univention.admin.handlers.simpleLdap): Link Here 
90
		if not dn and not position:
90
		if not dn and not position:
91
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
91
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
92
92
93
		univention.admin.handlers.simpleLdap.__init__(self, co, lo, position, dn, superordinate, attributes = attributes )
93
		super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes)
94
94
95
	def _ldap_pre_create(self):
95
	def _ldap_pre_create(self):
96
		self.dn='%s=%s,%s' % (mapping.mapName('server'), mapping.mapValue('server', self.info['server']), self.position.getDn())
96
		self.dn='%s=%s,%s' % (mapping.mapName('server'), mapping.mapValue('server', self.info['server']), self.position.getDn())
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py (-1 / +1 lines)
 Lines 85-91   class object(univention.admin.handlers.simpleLdap): Link Here 
85
		if not dn and not position:
85
		if not dn and not position:
86
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
86
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
87
87
88
		univention.admin.handlers.simpleLdap.__init__(self, co, lo, position, dn, superordinate, attributes = attributes )
88
		super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes)
89
89
90
	def _ldap_pre_create(self):
90
	def _ldap_pre_create(self):
91
		self.dn='%s=%s,%s' % (mapping.mapName('service'), mapping.mapValue('service', self.info['service']), self.position.getDn())
91
		self.dn='%s=%s,%s' % (mapping.mapName('service'), mapping.mapValue('service', self.info['service']), self.position.getDn())
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py (-1 / +1 lines)
 Lines 84-90   class object(univention.admin.handlers.simpleLdap): Link Here 
84
		if not dn and not position:
84
		if not dn and not position:
85
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
85
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
86
86
87
		univention.admin.handlers.simpleLdap.__init__(self, co, lo, position, dn, superordinate, attributes = attributes )
87
		super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes)
88
88
89
	def _ldap_pre_create(self):
89
	def _ldap_pre_create(self):
90
		self.dn='%s=%s,%s' % (mapping.mapName('name'), mapping.mapValue('name', self.info['name']), self.position.getDn())
90
		self.dn='%s=%s,%s' % (mapping.mapName('name'), mapping.mapValue('name', self.info['name']), self.position.getDn())
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py (-1 / +1 lines)
 Lines 127-133   class object(univention.admin.handlers.simpleLdap): Link Here 
127
		if not dn and not position:
127
		if not dn and not position:
128
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
128
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
129
129
130
		univention.admin.handlers.simpleLdap.__init__(self, co, lo, position, dn, superordinate, attributes = attributes )
130
		super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes)
131
131
132
	def _ldap_pre_create(self):
132
	def _ldap_pre_create(self):
133
		self.dn='%s=%s,%s' % (mapping.mapName('subnet'), mapping.mapValue('subnet', self.info['subnet']), self.position.getDn())
133
		self.dn='%s=%s,%s' % (mapping.mapName('subnet'), mapping.mapValue('subnet', self.info['subnet']), self.position.getDn())
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py (-5 / +3 lines)
 Lines 126-136   class object(univention.admin.handlers.simpleLdap): Link Here 
126
		if not dn and not position:
126
		if not dn and not position:
127
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
127
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
128
128
129
		univention.admin.handlers.simpleLdap.__init__(self, co, lo, position, dn, superordinate, attributes = attributes )
129
		super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes)
130
130
131
131
132
	def open(self):
132
	def open(self):
133
		univention.admin.handlers.simpleLdap.open(self)
133
		super(object, self).open()
134
		self.info['range'] = rangeUnmap( self.oldattr.get('dhcpRange', []) )
134
		self.info['range'] = rangeUnmap( self.oldattr.get('dhcpRange', []) )
135
		self.oldinfo['range'] = rangeUnmap( self.oldattr.get('dhcpRange', []) )
135
		self.oldinfo['range'] = rangeUnmap( self.oldattr.get('dhcpRange', []) )
136
136
 Lines 145-151   class object(univention.admin.handlers.simpleLdap): Link Here 
145
145
146
	def _ldap_modlist(self):
146
	def _ldap_modlist(self):
147
147
148
		ml=univention.admin.handlers.simpleLdap._ldap_modlist(self)
148
		ml = super(object, self)._ldap_modlist()
149
149
150
		if self.hasChanged('range'):
150
		if self.hasChanged('range'):
151
			dhcpRange=[]
151
			dhcpRange=[]
152
- 
153
super class
152
super class
154
--
155
.../univention/admin/handlers/dhcp/__common.py     | 17 ++++++++++++
153
.../univention/admin/handlers/dhcp/__common.py     | 17 ++++++++++++
156
.../modules/univention/admin/handlers/dhcp/host.py | 27 +++++++++----------
154
.../modules/univention/admin/handlers/dhcp/host.py | 27 +++++++++----------
157
.../modules/univention/admin/handlers/dhcp/pool.py | 25 ++++++++---------
155
.../modules/univention/admin/handlers/dhcp/pool.py | 25 ++++++++---------
158
.../univention/admin/handlers/dhcp/server.py       | 25 ++++++++---------
156
.../univention/admin/handlers/dhcp/server.py       | 25 ++++++++---------
159
.../univention/admin/handlers/dhcp/service.py      | 31 ++++++++++------------
157
.../univention/admin/handlers/dhcp/service.py      | 31 ++++++++++------------
160
.../univention/admin/handlers/dhcp/shared.py       | 27 ++++++++++---------
158
.../univention/admin/handlers/dhcp/shared.py       | 27 ++++++++++---------
161
.../univention/admin/handlers/dhcp/sharedsubnet.py | 27 +++++++++----------
159
.../univention/admin/handlers/dhcp/sharedsubnet.py | 27 +++++++++----------
162
.../univention/admin/handlers/dhcp/subnet.py       | 27 +++++++++----------
160
.../univention/admin/handlers/dhcp/subnet.py       | 27 +++++++++----------
163
8 files changed, 106 insertions(+), 100 deletions(-)
161
8 files changed, 106 insertions(+), 100 deletions(-)
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py (+17 lines)
 Lines 34-39   import copy Link Here 
34
34
35
import univention.admin.localization
35
import univention.admin.localization
36
from univention.admin.layout import Tab
36
from univention.admin.layout import Tab
37
from univention.admin.handlers import simpleLdap
37
38
38
translation = univention.admin.localization.translation( 'univention.admin.handlers.dhcp' )
39
translation = univention.admin.localization.translation( 'univention.admin.handlers.dhcp' )
39
_ = translation.translate
40
_ = translation.translate
 Lines 74-79   def add_dhcp_options( properties, mapping, layout ): Link Here 
74
	# currently not visible
75
	# currently not visible
75
	#layout.append( Tab( _( 'Advanced' ), _( 'Advanced DHCP options' ), layout = [ 'option' ] ) )
76
	#layout.append( Tab( _( 'Advanced' ), _( 'Advanced DHCP options' ), layout = [ 'option' ] ) )
76
77
78
79
class SimpleDhcp(simpleLdap):
80
	@classmethod
81
	def lookup(cls, co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, required=0, timeout=-1, sizelimit=0):
82
		filter_str = unicode(cls.lookup_filter(filter_s))
83
		res = [
84
			cls(co, lo, None, dn=dn, superordinate=superordinate, attributes=attrs)
85
			for dn, attrs in lo.search(filter_str, base, scope, [], unique, required, timeout, sizelimit)
86
		]
87
		return res
88
89
90
class DhcpOptions(SimpleDhcp):
91
	pass
92
93
77
def add_dhcp_objectclass( self, ml ):
94
def add_dhcp_objectclass( self, ml ):
78
	oldOCs = self.oldattr.get( 'objectClass', [] )
95
	oldOCs = self.oldattr.get( 'objectClass', [] )
79
	newOCs = copy.copy( oldOCs )
96
	newOCs = copy.copy( oldOCs )
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py (-14 / +13 lines)
 Lines 114-120   mapping.register('host', 'cn', None, univention.admin.mapping.ListToString) Link Here 
114
mapping.register('hwaddress', 'dhcpHWAddress', mapHWAddress, unmapHWAddress)
114
mapping.register('hwaddress', 'dhcpHWAddress', mapHWAddress, unmapHWAddress)
115
mapping.register('fixedaddress', 'univentionDhcpFixedAddress')
115
mapping.register('fixedaddress', 'univentionDhcpFixedAddress')
116
116
117
class object(univention.admin.handlers.simpleLdap):
117
from .__common import DhcpOptions
118
119
120
class object(DhcpOptions):
118
	module=module
121
	module=module
119
122
120
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
123
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
 Lines 136-156   class object(univention.admin.handlers.simpleLdap): Link Here 
136
			('objectClass', ['top', 'univentionDhcpHost']),
139
			('objectClass', ['top', 'univentionDhcpHost']),
137
		]
140
		]
138
141
139
def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, required=0, timeout=-1, sizelimit=0):
142
	@staticmethod
140
143
	def lookup_filter(filter_s=None, lo=None):
141
	filter=univention.admin.filter.conjunction('&', [
144
		filter_obj = univention.admin.filter.conjunction('&', [
142
	univention.admin.filter.expression('objectClass', 'univentionDhcpHost')
145
			univention.admin.filter.expression('objectClass', 'univentionDhcpHost')
143
	])
146
		])
147
		filter_obj.append_unmapped_filter_string(filter_s, univention.admin.mapping.mapRewrite, mapping)
148
		return filter_obj
144
149
145
	if filter_s:
146
		filter_p=univention.admin.filter.parse(filter_s)
147
		univention.admin.filter.walk(filter_p, univention.admin.mapping.mapRewrite, arg=mapping)
148
		filter.expressions.append(filter_p)
149
150
150
	res=[]
151
lookup_filter = object.lookup_filter
151
	for dn, attrs in lo.search(unicode(filter), base, scope, [], unique, required, timeout, sizelimit):
152
lookup = object.lookup
152
		res.append((object(co, lo, None, dn=dn, superordinate=superordinate, attributes = attrs )))
153
	return res
154
153
155
def identify(dn, attr):
154
def identify(dn, attr):
156
155
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py (-14 / +11 lines)
 Lines 141-154   layout = [ Link Here 
141
]
141
]
142
142
143
143
144
from .__common import rangeMap, rangeUnmap
144
from .__common import rangeMap, rangeUnmap, DhcpOptions
145
145
146
mapping=univention.admin.mapping.mapping()
146
mapping=univention.admin.mapping.mapping()
147
mapping.register('name', 'cn', None, univention.admin.mapping.ListToString)
147
mapping.register('name', 'cn', None, univention.admin.mapping.ListToString)
148
mapping.register('range', 'dhcpRange', rangeMap, rangeUnmap)
148
mapping.register('range', 'dhcpRange', rangeMap, rangeUnmap)
149
mapping.register('failover_peer', 'univentionDhcpFailoverPeer', None, univention.admin.mapping.ListToString)
149
mapping.register('failover_peer', 'univentionDhcpFailoverPeer', None, univention.admin.mapping.ListToString)
150
150
151
class object(univention.admin.handlers.simpleLdap):
151
class object(DhcpOptions):
152
	module=module
152
	module=module
153
153
154
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
154
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
 Lines 220-240   class object(univention.admin.handlers.simpleLdap): Link Here 
220
			raise univention.admin.uexceptions.bootpXORFailover
220
			raise univention.admin.uexceptions.bootpXORFailover
221
		return ml
221
		return ml
222
222
223
def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, required=0, timeout=-1, sizelimit=0):
223
	@staticmethod
224
	def lookup_filter(filter_s=None, lo=None):
225
		filter_obj = univention.admin.filter.conjunction('&', [
226
			univention.admin.filter.expression('objectClass', 'univentionDhcpPool')
227
		])
228
		filter_obj.append_unmapped_filter_string(filter_s, univention.admin.mapping.mapRewrite, mapping)
229
		return filter_obj
224
230
225
	filter=univention.admin.filter.conjunction('&', [
226
	univention.admin.filter.expression('objectClass', 'univentionDhcpPool')
227
	])
228
231
229
	if filter_s:
232
lookup_filter = object.lookup_filter
230
		filter_p=univention.admin.filter.parse(filter_s)
233
lookup = object.lookup
231
		univention.admin.filter.walk(filter_p, univention.admin.mapping.mapRewrite, arg=mapping)
232
		filter.expressions.append(filter_p)
233
234
234
	res=[]
235
	for dn, attrs in lo.search(unicode(filter), base, scope, [], unique, required, timeout, sizelimit):
236
		res.append((object(co, lo, None, dn=dn, superordinate=superordinate, attributes = attrs )))
237
	return res
238
235
239
def identify(dn, attr):
236
def identify(dn, attr):
240
	return 'univentionDhcpPool' in attr.get('objectClass', [])
237
	return 'univentionDhcpPool' in attr.get('objectClass', [])
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py (-12 / +13 lines)
 Lines 112-134   class object(univention.admin.handlers.simpleLdap): Link Here 
112
		shadow_module, shadow_object=univention.admin.objects.shadow(self.lo, module, object, self.position)
112
		shadow_module, shadow_object=univention.admin.objects.shadow(self.lo, module, object, self.position)
113
		self.lo.modify(self.dn, [('dhcpServiceDN', oldServiceDN[0], shadow_object.dn)])
113
		self.lo.modify(self.dn, [('dhcpServiceDN', oldServiceDN[0], shadow_object.dn)])
114
114
115
def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, required=0, timeout=-1, sizelimit=0):
115
def lookup_filter(filter_s=None, lo=None):
116
116
	filter_obj=univention.admin.filter.conjunction('&', [
117
	filter=univention.admin.filter.conjunction('&', [
118
	univention.admin.filter.expression('objectClass', 'dhcpServer')
117
	univention.admin.filter.expression('objectClass', 'dhcpServer')
119
	])
118
	])
119
	filter_obj.append_unmapped_filter_string(filter_s, univention.admin.mapping.mapRewrite, mapping)
120
	return filter_obj
120
121
121
	if superordinate:
122
		filter.expressions.append(univention.admin.filter.expression('dhcpServiceDN', superordinate.dn))
123
122
124
	if filter_s:
123
def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, required=0, timeout=-1, sizelimit=0):
125
		filter_p=univention.admin.filter.parse(filter_s)
124
	filter_obj = lookup_filter(filter_s)
126
		univention.admin.filter.walk(filter_p, univention.admin.mapping.mapRewrite, arg=mapping)
125
	if superordinate:
127
		filter.expressions.append(filter_p)
126
		filter_obj.expressions.append(univention.admin.filter.expression('dhcpServiceDN', superordinate.dn))
127
	filter_str = unicode(filter_obj)
128
128
129
	res=[]
129
	res = [
130
	for dn, attrs in lo.search(unicode(filter), base, scope, [], unique, required, timeout, sizelimit):
130
		object(co, lo, None, dn=dn, superordinate=superordinate, attributes=attrs)
131
		res.append((object(co, lo, None, dn=dn, superordinate=superordinate, attributes = attrs )))
131
		for dn, attrs in lo.search(filter_str, base, scope, [], unique, required, timeout, sizelimit)
132
	]
132
	return res
133
	return res
133
134
134
def identify(dn, attr):
135
def identify(dn, attr):
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py (-17 / +14 lines)
 Lines 71-81   layout = [ Link Here 
71
mapping=univention.admin.mapping.mapping()
71
mapping=univention.admin.mapping.mapping()
72
mapping.register('service', 'cn', None, univention.admin.mapping.ListToString)
72
mapping.register('service', 'cn', None, univention.admin.mapping.ListToString)
73
73
74
from .__common import add_dhcp_options, add_dhcp_objectclass
74
from .__common import add_dhcp_options, add_dhcp_objectclass, DhcpOptions
75
75
76
add_dhcp_options( property_descriptions, mapping, layout )
76
add_dhcp_options( property_descriptions, mapping, layout )
77
77
78
class object(univention.admin.handlers.simpleLdap):
78
class object(DhcpOptions):
79
	module=module
79
	module=module
80
80
81
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
81
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
 Lines 100-123   class object(univention.admin.handlers.simpleLdap): Link Here 
100
100
101
		return add_dhcp_objectclass( self, ml )
101
		return add_dhcp_objectclass( self, ml )
102
102
103
def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, required=0, timeout=-1, sizelimit=0):
103
	@staticmethod
104
104
	def lookup_filter(filter_s=None, lo=None):
105
	filter=univention.admin.filter.conjunction('&', [
105
		filter_obj = univention.admin.filter.conjunction('&', [
106
		univention.admin.filter.conjunction('|', [
106
			univention.admin.filter.conjunction('|', [
107
			univention.admin.filter.expression('objectClass', 'dhcpService'),
107
				univention.admin.filter.expression('objectClass', 'dhcpService'),
108
			univention.admin.filter.expression('objectClass', 'univentionDhcpService')
108
				univention.admin.filter.expression('objectClass', 'univentionDhcpService')
109
			])
109
		])
110
		])
110
	])
111
		filter_obj.append_unmapped_filter_string(filter_s, univention.admin.mapping.mapRewrite, mapping)
112
		return filter_obj
113
111
114
112
	if filter_s:
115
lookup_filter = object.lookup_filter
113
		filter_p=univention.admin.filter.parse(filter_s)
116
lookup = object.lookup
114
		univention.admin.filter.walk(filter_p, univention.admin.mapping.mapRewrite, arg=mapping)
115
		filter.expressions.append(filter_p)
116
117
117
	res=[]
118
	for dn, attrs in lo.search(unicode(filter), base, scope, [], unique, required, timeout, sizelimit):
119
		res.append((object(co, lo, None, dn=dn, superordinate=superordinate, attributes = attrs )))
120
	return res
121
118
122
def identify(dn, attr):
119
def identify(dn, attr):
123
	return bool(set(('dhcpService', 'univentionDhcpService')) & set(attr.get('objectClass', [])))
120
	return bool(set(('dhcpService', 'univentionDhcpService')) & set(attr.get('objectClass', [])))
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py (-13 / +14 lines)
 Lines 72-78   layout = [ Link Here 
72
mapping=univention.admin.mapping.mapping()
72
mapping=univention.admin.mapping.mapping()
73
mapping.register('name', 'cn', None, univention.admin.mapping.ListToString)
73
mapping.register('name', 'cn', None, univention.admin.mapping.ListToString)
74
74
75
class object(univention.admin.handlers.simpleLdap):
75
from .__common import DhcpOptions
76
77
78
class object(DhcpOptions):
76
	module=module
79
	module=module
77
80
78
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
81
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
 Lines 94-114   class object(univention.admin.handlers.simpleLdap): Link Here 
94
			('objectClass', ['top', 'dhcpSharedNetwork'])
97
			('objectClass', ['top', 'dhcpSharedNetwork'])
95
		]
98
		]
96
99
97
def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, required=0, timeout=-1, sizelimit=0):
98
100
99
	filter=univention.admin.filter.conjunction('&', [
101
	@staticmethod
100
	univention.admin.filter.expression('objectClass', 'dhcpSharedNetwork')
102
	def lookup_filter(filter_s=None, lo=None):
101
	])
103
		filter_obj = univention.admin.filter.conjunction('&', [
104
			univention.admin.filter.expression('objectClass', 'dhcpSharedNetwork')
105
		])
106
		filter_obj.append_unmapped_filter_string(filter_s, univention.admin.mapping.mapRewrite, mapping)
107
		return filter_obj
108
102
109
103
	if filter_s:
110
lookup_filter = object.lookup_filter
104
		filter_p=univention.admin.filter.parse(filter_s)
111
lookup = object.lookup
105
		univention.admin.filter.walk(filter_p, univention.admin.mapping.mapRewrite, arg=mapping)
106
		filter.expressions.append(filter_p)
107
112
108
	res=[]
109
	for dn, attrs in lo.search(unicode(filter), base, scope, [], unique, required, timeout, sizelimit):
110
		res.append((object(co, lo, None, dn=dn, superordinate=superordinate, attributes = attrs )))
111
	return res
112
113
113
def identify(dn, attr):
114
def identify(dn, attr):
114
	
115
	
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py (-15 / +12 lines)
 Lines 102-108   layout = [ Link Here 
102
]
102
]
103
103
104
104
105
from .__common import rangeMap, rangeUnmap
105
from .__common import rangeMap, rangeUnmap, DhcpOptions
106
106
107
mapping=univention.admin.mapping.mapping()
107
mapping=univention.admin.mapping.mapping()
108
mapping.register('subnet', 'cn', None, univention.admin.mapping.ListToString)
108
mapping.register('subnet', 'cn', None, univention.admin.mapping.ListToString)
 Lines 114-120   from .__common import add_dhcp_options, add_dhcp_objectclass Link Here 
114
114
115
add_dhcp_options( property_descriptions, mapping, layout )
115
add_dhcp_options( property_descriptions, mapping, layout )
116
116
117
class object(univention.admin.handlers.simpleLdap):
117
class object(DhcpOptions):
118
	module=module
118
	module=module
119
119
120
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
120
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
 Lines 142-163   class object(univention.admin.handlers.simpleLdap): Link Here 
142
142
143
		return add_dhcp_objectclass( self, ml )
143
		return add_dhcp_objectclass( self, ml )
144
144
145
def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, required=0, timeout=-1, sizelimit=0):
145
	@staticmethod
146
	def lookup_filter(filter_s=None, lo=None):
147
		filter_obj = univention.admin.filter.conjunction('&', [
148
			univention.admin.filter.expression('objectClass', 'univentionDhcpSubnet'),
149
			univention.admin.filter.expression('objectClass', 'univentionDhcpSharedSubnet')
150
		])
151
		filter_obj.append_unmapped_filter_string(filter_s, univention.admin.mapping.mapRewrite, mapping)
152
		return filter_obj
146
153
147
	filter=univention.admin.filter.conjunction('&', [
148
	univention.admin.filter.expression('objectClass', 'univentionDhcpSubnet'),
149
	univention.admin.filter.expression('objectClass', 'univentionDhcpSharedSubnet')
150
	])
151
154
152
	if filter_s:
155
lookup_filter = object.lookup_filter
153
		filter_p=univention.admin.filter.parse(filter_s)
156
lookup = object.lookup
154
		univention.admin.filter.walk(filter_p, univention.admin.mapping.mapRewrite, arg=mapping)
155
		filter.expressions.append(filter_p)
156
157
157
	res=[]
158
	for dn, attrs in lo.search(unicode(filter), base, scope, [], unique, required, timeout, sizelimit):
159
		res.append((object(co, lo, None, dn=dn, superordinate=superordinate, attributes = attrs )))
160
	return res
161
158
162
def identify(dn, attr):
159
def identify(dn, attr):
163
	return set(('univentionDhcpSubnet', 'univentionDhcpSharedSubnet')) <= set(attr.get('objectClass', []))
160
	return set(('univentionDhcpSubnet', 'univentionDhcpSharedSubnet')) <= set(attr.get('objectClass', []))
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py (-17 / +12 lines)
 Lines 102-108   layout = [ Link Here 
102
	] ),
102
	] ),
103
]
103
]
104
104
105
from .__common import rangeUnmap
105
from .__common import rangeUnmap, DhcpOptions
106
106
107
mapping=univention.admin.mapping.mapping()
107
mapping=univention.admin.mapping.mapping()
108
mapping.register('subnet', 'cn', None, univention.admin.mapping.ListToString)
108
mapping.register('subnet', 'cn', None, univention.admin.mapping.ListToString)
 Lines 113-119   from .__common import add_dhcp_options, add_dhcp_objectclass Link Here 
113
113
114
add_dhcp_options( property_descriptions, mapping, layout )
114
add_dhcp_options( property_descriptions, mapping, layout )
115
115
116
class object(univention.admin.handlers.simpleLdap):
116
class object(DhcpOptions):
117
	module=module
117
	module=module
118
118
119
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
119
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
 Lines 175-196   class object(univention.admin.handlers.simpleLdap): Link Here 
175
			ml.append(('dhcpRange', self.oldattr.get('dhcpRange', []), dhcpRange))
175
			ml.append(('dhcpRange', self.oldattr.get('dhcpRange', []), dhcpRange))
176
		return add_dhcp_objectclass( self, ml )
176
		return add_dhcp_objectclass( self, ml )
177
177
178
def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, required=0, timeout=-1, sizelimit=0):
178
	@staticmethod
179
	def lookup_filter(filter_s=None, lo=None):
180
		filter_obj = univention.admin.filter.conjunction('&', [
181
			univention.admin.filter.expression('objectClass', 'univentionDhcpSubnet'),
182
			univention.admin.filter.conjunction('!', [univention.admin.filter.expression('objectClass', 'univentionDhcpSharedSubnet')])
183
		])
184
		filter_obj.append_unmapped_filter_string(filter_s, univention.admin.mapping.mapRewrite, mapping)
185
		return filter_obj
179
186
180
	filter=univention.admin.filter.conjunction('&', [
181
	univention.admin.filter.expression('objectClass', 'univentionDhcpSubnet'),
182
	univention.admin.filter.conjunction('!', [univention.admin.filter.expression('objectClass', 'univentionDhcpSharedSubnet')])
183
	])
184
187
185
	if filter_s:
188
lookup_filter = object.lookup_filter
186
		filter_p=univention.admin.filter.parse(filter_s)
189
lookup = object.lookup
187
		univention.admin.filter.walk(filter_p, univention.admin.mapping.mapRewrite, arg=mapping)
188
		filter.expressions.append(filter_p)
189
190
190
	res=[]
191
	for dn, attrs in lo.search(unicode(filter), base, scope, [], unique, required, timeout, sizelimit):
192
		res.append((object(co, lo, None, dn=dn, superordinate=superordinate, attributes = attrs )))
193
	return res
194
191
195
def identify(dn, attr):
192
def identify(dn, attr):
196
	ocs = set(attr.get('objectClass', []))
193
	ocs = set(attr.get('objectClass', []))
197
- 
198
options
194
options
199
--
200
.../modules/univention/admin/handlers/dhcp/__common.py         | 10 +++++++---
195
.../modules/univention/admin/handlers/dhcp/__common.py         | 10 +++++++---
201
.../modules/univention/admin/handlers/dhcp/host.py             |  3 ++-
196
.../modules/univention/admin/handlers/dhcp/host.py             |  3 ++-
202
.../modules/univention/admin/handlers/dhcp/pool.py             |  5 ++++-
197
.../modules/univention/admin/handlers/dhcp/pool.py             |  5 ++++-
203
.../modules/univention/admin/handlers/dhcp/server.py           |  2 +-
198
.../modules/univention/admin/handlers/dhcp/server.py           |  2 +-
204
.../modules/univention/admin/handlers/dhcp/service.py          |  2 +-
199
.../modules/univention/admin/handlers/dhcp/service.py          |  2 +-
205
.../modules/univention/admin/handlers/dhcp/shared.py           |  3 ++-
200
.../modules/univention/admin/handlers/dhcp/shared.py           |  3 ++-
206
.../modules/univention/admin/handlers/dhcp/sharedsubnet.py     |  7 ++++---
201
.../modules/univention/admin/handlers/dhcp/sharedsubnet.py     |  7 ++++---
207
.../modules/univention/admin/handlers/dhcp/subnet.py           |  7 ++++---
202
.../modules/univention/admin/handlers/dhcp/subnet.py           |  7 ++++---
208
8 files changed, 25 insertions(+), 14 deletions(-)
203
8 files changed, 25 insertions(+), 14 deletions(-)
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py (-3 / +7 lines)
 Lines 30-35    Link Here 
30
# /usr/share/common-licenses/AGPL-3; if not, see
30
# /usr/share/common-licenses/AGPL-3; if not, see
31
# <http://www.gnu.org/licenses/>.
31
# <http://www.gnu.org/licenses/>.
32
32
33
import sys
33
import copy
34
import copy
34
35
35
import univention.admin.localization
36
import univention.admin.localization
 Lines 65-74   _mappings = ( Link Here 
65
	('option', 'dhcpOption', None, None),
66
	('option', 'dhcpOption', None, None),
66
)
67
)
67
68
68
def add_dhcp_options( properties, mapping, layout ):
69
def add_dhcp_options(module_name):
69
	for name, prop in _properties.items():
70
	module = sys.modules[module_name]
70
		properties[ name ] = prop
71
71
72
	properties = getattr(module, "property_descriptions")
73
	properties.update(_properties)
74
75
	mapping = getattr(module, "mapping")
72
	for item in _mappings:
76
	for item in _mappings:
73
		mapping.register( *item )
77
		mapping.register( *item )
74
78
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py (-1 / +2 lines)
 Lines 114-120   mapping.register('host', 'cn', None, univention.admin.mapping.ListToString) Link Here 
114
mapping.register('hwaddress', 'dhcpHWAddress', mapHWAddress, unmapHWAddress)
114
mapping.register('hwaddress', 'dhcpHWAddress', mapHWAddress, unmapHWAddress)
115
mapping.register('fixedaddress', 'univentionDhcpFixedAddress')
115
mapping.register('fixedaddress', 'univentionDhcpFixedAddress')
116
116
117
from .__common import DhcpOptions
117
from .__common import add_dhcp_options, DhcpOptions
118
add_dhcp_options(__name__)
118
119
119
120
120
class object(DhcpOptions):
121
class object(DhcpOptions):
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py (-1 / +4 lines)
 Lines 141-153   layout = [ Link Here 
141
]
141
]
142
142
143
143
144
from .__common import rangeMap, rangeUnmap, DhcpOptions
144
from .__common import rangeMap, rangeUnmap, add_dhcp_options, DhcpOptions
145
145
146
mapping=univention.admin.mapping.mapping()
146
mapping=univention.admin.mapping.mapping()
147
mapping.register('name', 'cn', None, univention.admin.mapping.ListToString)
147
mapping.register('name', 'cn', None, univention.admin.mapping.ListToString)
148
mapping.register('range', 'dhcpRange', rangeMap, rangeUnmap)
148
mapping.register('range', 'dhcpRange', rangeMap, rangeUnmap)
149
mapping.register('failover_peer', 'univentionDhcpFailoverPeer', None, univention.admin.mapping.ListToString)
149
mapping.register('failover_peer', 'univentionDhcpFailoverPeer', None, univention.admin.mapping.ListToString)
150
150
151
add_dhcp_options(__name__)
152
153
151
class object(DhcpOptions):
154
class object(DhcpOptions):
152
	module=module
155
	module=module
153
156
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py (-1 / +1 lines)
 Lines 74-81   mapping=univention.admin.mapping.mapping() Link Here 
74
mapping.register('server', 'cn', None, univention.admin.mapping.ListToString)
74
mapping.register('server', 'cn', None, univention.admin.mapping.ListToString)
75
75
76
from .__common import add_dhcp_options
76
from .__common import add_dhcp_options
77
add_dhcp_options(__name__)
77
78
78
add_dhcp_options( property_descriptions, mapping, layout )
79
79
80
class object(univention.admin.handlers.simpleLdap):
80
class object(univention.admin.handlers.simpleLdap):
81
	module=module
81
	module=module
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py (-1 / +1 lines)
 Lines 72-79   mapping=univention.admin.mapping.mapping() Link Here 
72
mapping.register('service', 'cn', None, univention.admin.mapping.ListToString)
72
mapping.register('service', 'cn', None, univention.admin.mapping.ListToString)
73
73
74
from .__common import add_dhcp_options, add_dhcp_objectclass, DhcpOptions
74
from .__common import add_dhcp_options, add_dhcp_objectclass, DhcpOptions
75
add_dhcp_options(__name__)
75
76
76
add_dhcp_options( property_descriptions, mapping, layout )
77
77
78
class object(DhcpOptions):
78
class object(DhcpOptions):
79
	module=module
79
	module=module
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py (-1 / +2 lines)
 Lines 72-78   layout = [ Link Here 
72
mapping=univention.admin.mapping.mapping()
72
mapping=univention.admin.mapping.mapping()
73
mapping.register('name', 'cn', None, univention.admin.mapping.ListToString)
73
mapping.register('name', 'cn', None, univention.admin.mapping.ListToString)
74
74
75
from .__common import DhcpOptions
75
from .__common import add_dhcp_options, DhcpOptions
76
add_dhcp_options(__name__)
76
77
77
78
78
class object(DhcpOptions):
79
class object(DhcpOptions):
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py (-3 / +4 lines)
 Lines 102-108   layout = [ Link Here 
102
]
102
]
103
103
104
104
105
from .__common import rangeMap, rangeUnmap, DhcpOptions
105
from .__common import rangeMap, rangeUnmap, add_dhcp_options, DhcpOptions
106
106
107
mapping=univention.admin.mapping.mapping()
107
mapping=univention.admin.mapping.mapping()
108
mapping.register('subnet', 'cn', None, univention.admin.mapping.ListToString)
108
mapping.register('subnet', 'cn', None, univention.admin.mapping.ListToString)
 Lines 110-118   mapping.register('range', 'dhcpRange', rangeMap, rangeUnmap) Link Here 
110
mapping.register('subnetmask', 'dhcpNetMask', None, univention.admin.mapping.ListToString)
110
mapping.register('subnetmask', 'dhcpNetMask', None, univention.admin.mapping.ListToString)
111
mapping.register('broadcastaddress', 'univentionDhcpBroadcastAddress', None, univention.admin.mapping.ListToString)
111
mapping.register('broadcastaddress', 'univentionDhcpBroadcastAddress', None, univention.admin.mapping.ListToString)
112
112
113
from .__common import add_dhcp_options, add_dhcp_objectclass
113
add_dhcp_options(__name__)
114
115
from .__common import add_dhcp_objectclass
114
116
115
add_dhcp_options( property_descriptions, mapping, layout )
116
117
117
class object(DhcpOptions):
118
class object(DhcpOptions):
118
	module=module
119
	module=module
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py (-5 / +4 lines)
 Lines 102-117   layout = [ Link Here 
102
	] ),
102
	] ),
103
]
103
]
104
104
105
from .__common import rangeUnmap, DhcpOptions
105
from .__common import rangeUnmap, add_dhcp_options, DhcpOptions
106
106
107
mapping=univention.admin.mapping.mapping()
107
mapping=univention.admin.mapping.mapping()
108
mapping.register('subnet', 'cn', None, univention.admin.mapping.ListToString)
108
mapping.register('subnet', 'cn', None, univention.admin.mapping.ListToString)
109
mapping.register('subnetmask', 'dhcpNetMask', None, univention.admin.mapping.ListToString)
109
mapping.register('subnetmask', 'dhcpNetMask', None, univention.admin.mapping.ListToString)
110
mapping.register('broadcastaddress', 'univentionDhcpBroadcastAddress', None, univention.admin.mapping.ListToString)
110
mapping.register('broadcastaddress', 'univentionDhcpBroadcastAddress', None, univention.admin.mapping.ListToString)
111
111
112
from .__common import add_dhcp_options, add_dhcp_objectclass
112
add_dhcp_options(__name__)
113
114
from .__common import add_dhcp_objectclass
113
115
114
add_dhcp_options( property_descriptions, mapping, layout )
115
116
116
class object(DhcpOptions):
117
class object(DhcpOptions):
117
	module=module
118
	module=module
118
- 
119
super class
119
super class
120
--
121
.../univention/admin/handlers/dhcp/__common.py     | 71 +++++++++++++++++-----
120
.../univention/admin/handlers/dhcp/__common.py     | 71 +++++++++++++++++-----
122
.../modules/univention/admin/handlers/dhcp/host.py |  1 +
121
.../modules/univention/admin/handlers/dhcp/host.py |  1 +
123
.../modules/univention/admin/handlers/dhcp/pool.py |  1 +
122
.../modules/univention/admin/handlers/dhcp/pool.py |  1 +
124
.../univention/admin/handlers/dhcp/service.py      | 10 +--
123
.../univention/admin/handlers/dhcp/service.py      | 10 +--
125
.../univention/admin/handlers/dhcp/shared.py       |  1 +
124
.../univention/admin/handlers/dhcp/shared.py       |  1 +
126
.../univention/admin/handlers/dhcp/sharedsubnet.py | 10 +--
125
.../univention/admin/handlers/dhcp/sharedsubnet.py | 10 +--
127
.../univention/admin/handlers/dhcp/subnet.py       |  7 +--
126
.../univention/admin/handlers/dhcp/subnet.py       |  7 +--
128
7 files changed, 66 insertions(+), 35 deletions(-)
127
7 files changed, 66 insertions(+), 35 deletions(-)
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py (-16 / +55 lines)
 Lines 31-38    Link Here 
31
# <http://www.gnu.org/licenses/>.
31
# <http://www.gnu.org/licenses/>.
32
32
33
import sys
33
import sys
34
import copy
35
36
import univention.admin.localization
34
import univention.admin.localization
37
from univention.admin.layout import Tab
35
from univention.admin.layout import Tab
38
from univention.admin.handlers import simpleLdap
36
from univention.admin.handlers import simpleLdap
 Lines 40-52   from univention.admin.handlers import simpleLdap Link Here 
40
translation = univention.admin.localization.translation( 'univention.admin.handlers.dhcp' )
38
translation = univention.admin.localization.translation( 'univention.admin.handlers.dhcp' )
41
_ = translation.translate
39
_ = translation.translate
42
40
41
42
_options = {
43
	'options': univention.admin.option(
44
		short_description=_('Allow custom DHCP options'),
45
		long_description=_("Allow adding custom DHCP options. Experts only!"),
46
		default=False,
47
		editable=True,
48
		objectClasses=['dhcpOptions'],
49
	),
50
}
51
52
43
_properties = {
53
_properties = {
44
	'option': univention.admin.property(
54
	'option': univention.admin.property(
45
		short_description = _( 'DHCP options' ),
55
		short_description = _( 'DHCP options' ),
46
		long_description = _( 'Defines DHCP options for the subnet.' ),
56
		long_description = _( 'Defines DHCP options for the subnet.' ),
47
		syntax = univention.admin.syntax.string,
57
		syntax = univention.admin.syntax.string,
48
		multivalue = True,
58
		multivalue = True,
49
		options = [],
59
		options = ["options"],
50
		required = 0,
60
		required = 0,
51
		may_change = True,
61
		may_change = True,
52
		identifies = 0
62
		identifies = 0
 Lines 66-74   _mappings = ( Link Here 
66
	('option', 'dhcpOption', None, None),
76
	('option', 'dhcpOption', None, None),
67
)
77
)
68
78
79
69
def add_dhcp_options(module_name):
80
def add_dhcp_options(module_name):
70
	module = sys.modules[module_name]
81
	module = sys.modules[module_name]
71
82
83
	options = getattr(module, "options")
84
	options.update(_options)
85
72
	properties = getattr(module, "property_descriptions")
86
	properties = getattr(module, "property_descriptions")
73
	properties.update(_properties)
87
	properties.update(_properties)
74
88
 Lines 76-83   def add_dhcp_options(module_name): Link Here 
76
	for item in _mappings:
90
	for item in _mappings:
77
		mapping.register( *item )
91
		mapping.register( *item )
78
92
79
	# currently not visible
93
	layout = getattr(module, "layout")
80
	#layout.append( Tab( _( 'Advanced' ), _( 'Advanced DHCP options' ), layout = [ 'option' ] ) )
94
	layout.append(Tab(
95
		_('DHCP options'),
96
		_('Custom DHCP options'),
97
		advanced=True,
98
		layout=['option']
99
	))
81
100
82
101
83
class SimpleDhcp(simpleLdap):
102
class SimpleDhcp(simpleLdap):
 Lines 92-105   class SimpleDhcp(simpleLdap): Link Here 
92
111
93
112
94
class DhcpOptions(SimpleDhcp):
113
class DhcpOptions(SimpleDhcp):
95
	pass
114
	def setup_options(self, options):
96
115
		self.options = []
97
116
		self._define_options(options)
98
def add_dhcp_objectclass( self, ml ):
117
99
	oldOCs = self.oldattr.get( 'objectClass', [] )
118
	def open(self):
100
	newOCs = copy.copy( oldOCs )
119
		super(DhcpOptions, self).open()
101
	if self.info.get( 'option', [] ) and not 'dhcpOptions' in oldOCs:
120
		try:
102
		newOCs.append( 'dhcpOptions' )
121
			ocs = self.oldattr['objectClass']
103
		ml.append( ( 'objectClass', oldOCs, newOCs ) )
122
			if "dhcpOptions" in ocs:
104
123
				self.options.append("options")
105
	return ml
124
		except LookupError:
125
			pass
126
		self.old_options = list(self.options)
127
128
	def _ldap_modlist(self):
129
		if "options" not in self.options:
130
			del self.info.get('option', [])[:]
131
132
		mod_list = super(DhcpOptions, self)._ldap_modlist()
133
134
		old_ocs = self.oldattr.get('objectClass', [])
135
		if self.info.get('option', []):
136
			if 'dhcpOptions' not in old_ocs:
137
				new_ocs = old_ocs + ['dhcpOptions']
138
				mod_list.append(('objectClass', old_ocs, new_ocs))
139
		elif "options" not in self.options and 'dhcpOptions' in old_ocs:
140
			new_ocs = list(old_ocs)
141
			new_ocs.remove("dhcpOptions")
142
			mod_list.append(('objectClass', old_ocs, new_ocs))
143
144
		return mod_list
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py (+1 lines)
 Lines 131-136   class object(DhcpOptions): Link Here 
131
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
131
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
132
132
133
		super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes)
133
		super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes)
134
		self.setup_options(options)
134
135
135
	def _ldap_pre_create(self):
136
	def _ldap_pre_create(self):
136
		self.dn='%s=%s,%s' % (mapping.mapName('host'), mapping.mapValue('host', self.info['host']), self.position.getDn())
137
		self.dn='%s=%s,%s' % (mapping.mapName('host'), mapping.mapValue('host', self.info['host']), self.position.getDn())
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py (+1 lines)
 Lines 164-169   class object(DhcpOptions): Link Here 
164
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
164
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
165
165
166
		super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes)
166
		super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes)
167
		self.setup_options(options)
167
168
168
	def open(self):
169
	def open(self):
169
		super(object, self).open()
170
		super(object, self).open()
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py (-7 / +3 lines)
 Lines 71-77   layout = [ Link Here 
71
mapping=univention.admin.mapping.mapping()
71
mapping=univention.admin.mapping.mapping()
72
mapping.register('service', 'cn', None, univention.admin.mapping.ListToString)
72
mapping.register('service', 'cn', None, univention.admin.mapping.ListToString)
73
73
74
from .__common import add_dhcp_options, add_dhcp_objectclass, DhcpOptions
74
from .__common import add_dhcp_options, DhcpOptions
75
add_dhcp_options(__name__)
75
add_dhcp_options(__name__)
76
76
77
77
 Lines 86-105   class object(DhcpOptions): Link Here 
86
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
86
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
87
87
88
		super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes)
88
		super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes)
89
		self.setup_options(options)
89
90
90
	def _ldap_pre_create(self):
91
	def _ldap_pre_create(self):
91
		self.dn='%s=%s,%s' % (mapping.mapName('service'), mapping.mapValue('service', self.info['service']), self.position.getDn())
92
		self.dn='%s=%s,%s' % (mapping.mapName('service'), mapping.mapValue('service', self.info['service']), self.position.getDn())
92
93
93
	def _ldap_addlist(self):
94
	def _ldap_addlist(self):
94
		return [
95
		return [
95
			('objectClass', [ 'top', 'univentionDhcpService', 'dhcpOptions' ] ),
96
			('objectClass', ['top', 'univentionDhcpService']),
96
		]
97
		]
97
98
98
	def _ldap_modlist(self):
99
		ml = univention.admin.handlers.simpleLdap._ldap_modlist( self )
100
101
		return add_dhcp_objectclass( self, ml )
102
103
	@staticmethod
99
	@staticmethod
104
	def lookup_filter(filter_s=None, lo=None):
100
	def lookup_filter(filter_s=None, lo=None):
105
		filter_obj = univention.admin.filter.conjunction('&', [
101
		filter_obj = univention.admin.filter.conjunction('&', [
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py (+1 lines)
 Lines 89-94   class object(DhcpOptions): Link Here 
89
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
89
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
90
90
91
		super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes)
91
		super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes)
92
		self.setup_options(options)
92
93
93
	def _ldap_pre_create(self):
94
	def _ldap_pre_create(self):
94
		self.dn='%s=%s,%s' % (mapping.mapName('name'), mapping.mapValue('name', self.info['name']), self.position.getDn())
95
		self.dn='%s=%s,%s' % (mapping.mapName('name'), mapping.mapValue('name', self.info['name']), self.position.getDn())
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py (-8 / +2 lines)
 Lines 112-119   mapping.register('broadcastaddress', 'univentionDhcpBroadcastAddress', None, uni Link Here 
112
112
113
add_dhcp_options(__name__)
113
add_dhcp_options(__name__)
114
114
115
from .__common import add_dhcp_objectclass
116
117
115
118
class object(DhcpOptions):
116
class object(DhcpOptions):
119
	module=module
117
	module=module
 Lines 129-148   class object(DhcpOptions): Link Here 
129
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
127
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
130
128
131
		super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes)
129
		super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes)
130
		self.setup_options(options)
132
131
133
	def _ldap_pre_create(self):
132
	def _ldap_pre_create(self):
134
		self.dn='%s=%s,%s' % (mapping.mapName('subnet'), mapping.mapValue('subnet', self.info['subnet']), self.position.getDn())
133
		self.dn='%s=%s,%s' % (mapping.mapName('subnet'), mapping.mapValue('subnet', self.info['subnet']), self.position.getDn())
135
134
136
	def _ldap_addlist(self):
135
	def _ldap_addlist(self):
137
		return [
136
		return [
138
			('objectClass', ['top', 'univentionDhcpSubnet', 'univentionDhcpSharedSubnet', 'dhcpOptions' ]),
137
			('objectClass', ['top', 'univentionDhcpSubnet', 'univentionDhcpSharedSubnet']),
139
		]
138
		]
140
139
141
	def _ldap_modlist(self):
142
		ml = univention.admin.handlers.simpleLdap._ldap_modlist( self )
143
144
		return add_dhcp_objectclass( self, ml )
145
146
	@staticmethod
140
	@staticmethod
147
	def lookup_filter(filter_s=None, lo=None):
141
	def lookup_filter(filter_s=None, lo=None):
148
		filter_obj = univention.admin.filter.conjunction('&', [
142
		filter_obj = univention.admin.filter.conjunction('&', [
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py (-6 / +3 lines)
 Lines 111-118   mapping.register('broadcastaddress', 'univentionDhcpBroadcastAddress', None, uni Link Here 
111
111
112
add_dhcp_options(__name__)
112
add_dhcp_options(__name__)
113
113
114
from .__common import add_dhcp_objectclass
115
116
114
117
class object(DhcpOptions):
115
class object(DhcpOptions):
118
	module=module
116
	module=module
 Lines 128-134   class object(DhcpOptions): Link Here 
128
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
126
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
129
127
130
		super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes)
128
		super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes)
131
129
		self.setup_options(options)
132
130
133
	def open(self):
131
	def open(self):
134
		super(object, self).open()
132
		super(object, self).open()
 Lines 174-180   class object(DhcpOptions): Link Here 
174
			if '' in dhcpRange:
172
			if '' in dhcpRange:
175
				dhcpRange.remove('')
173
				dhcpRange.remove('')
176
			ml.append(('dhcpRange', self.oldattr.get('dhcpRange', []), dhcpRange))
174
			ml.append(('dhcpRange', self.oldattr.get('dhcpRange', []), dhcpRange))
177
		return add_dhcp_objectclass( self, ml )
175
176
		return ml
178
177
179
	@staticmethod
178
	@staticmethod
180
	def lookup_filter(filter_s=None, lo=None):
179
	def lookup_filter(filter_s=None, lo=None):
181
- 
182
--
183
.../modules/univention/admin/handlers/dhcp/pool.py | 58 +++++++++-------------
180
.../modules/univention/admin/handlers/dhcp/pool.py | 58 +++++++++-------------
184
1 file changed, 24 insertions(+), 34 deletions(-)
181
1 file changed, 24 insertions(+), 34 deletions(-)
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py (-36 / +24 lines)
 Lines 154-159   add_dhcp_options(__name__) Link Here 
154
class object(DhcpOptions):
154
class object(DhcpOptions):
155
	module=module
155
	module=module
156
156
157
	permits_udm2dhcp = {
158
		'known_clients': "known clients",
159
		'unknown_clients': "unknown clients",
160
		'dynamic_bootp_clients': "dynamic bootp clients",
161
		'all_clients': "all clients",
162
	}
163
	permits_dhcp2udm = dict((value, key) for (key, value) in permits_udm2dhcp.items())
164
157
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
165
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
158
		self.mapping=mapping
166
		self.mapping=mapping
159
		self.descriptions=property_descriptions
167
		self.descriptions=property_descriptions
 Lines 170-186   class object(DhcpOptions): Link Here 
170
		super(object, self).open()
178
		super(object, self).open()
171
179
172
		for i in self.oldattr.get('dhcpPermitList', []):
180
		for i in self.oldattr.get('dhcpPermitList', []):
173
			pos=i.find(' ')
181
			permit, name = i.split(' ', 1)
174
			permit=i[:pos]
182
			prop = self.permits_dhcp2udm[name]
175
			name=i[pos+1:]
183
			self[prop] = permit
176
			if name == 'known clients':
177
				self['known_clients']=permit
178
			elif name == 'unknown clients':
179
				self['unknown_clients']=permit
180
			elif name == 'dynamic bootp clients':
181
				self['dynamic_bootp_clients']=permit
182
			elif name == 'all clients':
183
				self['all_clients']=permit
184
184
185
		self.save()
185
		self.save()
186
186
 Lines 192-224   class object(DhcpOptions): Link Here 
192
		return [
192
		return [
193
			('objectClass', ['top', 'univentionDhcpPool']),
193
			('objectClass', ['top', 'univentionDhcpPool']),
194
		]
194
		]
195
	
195
196
	def _ldap_modlist(self):
196
	def _ldap_modlist(self):
197
		ml = super(object, self)._ldap_modlist()
197
		ml = super(object, self)._ldap_modlist()
198
		if self.hasChanged(['known_clients', 'unknown_clients', 'dynamic_bootp_clients', 'all_clients']):
198
		if self.hasChanged(self.permits_udm2dhcp.keys()):
199
			old=self.oldattr.get('dhcpPermitList', [])
199
			old=self.oldattr.get('dhcpPermitList', [])
200
			new=copy.deepcopy(old)
200
			new=copy.deepcopy(old)
201
201
			for prop, value in self.permits_udm2dhcp.items():
202
			if self.oldinfo.has_key('known_clients') and self.oldinfo['known_clients']:
202
				try:
203
				new.remove(self.oldinfo['known_clients']+' known clients')
203
					permit = self.oldinfo[prop]
204
			if self.info.has_key('known_clients') and self.info['known_clients']:
204
					new.remove("%s %s" % (permit, value))
205
				new.append(self.info['known_clients']+' known clients')
205
				except LookupError:
206
				
206
					pass
207
			if self.oldinfo.has_key('unknown_clients') and self.oldinfo['unknown_clients']:
207
				try:
208
				new.remove(self.oldinfo['unknown_clients']+' unknown clients')
208
					permit = self.info[prop]
209
			if self.info.has_key('unknown_clients') and self.info['unknown_clients']:
209
					new.append("%s %s" % (permit, value))
210
				new.append(self.info['unknown_clients']+' unknown clients')
210
				except LookupError:
211
211
					pass
212
			if self.oldinfo.has_key('dynamic_bootp_clients') and self.oldinfo['dynamic_bootp_clients']:
213
				new.remove(self.oldinfo['dynamic_bootp_clients']+' dynamic bootp clients')
214
			if self.info.has_key('dynamic_bootp_clients') and self.info['dynamic_bootp_clients']:
215
				new.append(self.info['dynamic_bootp_clients']+' dynamic bootp clients')
216
			
217
			if self.oldinfo.has_key('all_clients') and self.oldinfo['all_clients']:
218
				new.remove(self.oldinfo['all_clients']+' all clients')
219
			if self.info.has_key('all_clients') and self.info['all_clients']:
220
				new.append(self.info['all_clients']+' all clients')
221
				
222
			ml.append(('dhcpPermitList', old, new))
212
			ml.append(('dhcpPermitList', old, new))
223
		if self.info.get('failover_peer', None) and not self.info.get('dynamic_bootp_clients', None) == 'deny':
213
		if self.info.get('failover_peer', None) and not self.info.get('dynamic_bootp_clients', None) == 'deny':
224
			raise univention.admin.uexceptions.bootpXORFailover
214
			raise univention.admin.uexceptions.bootpXORFailover
225
- 
226
--
227
.../modules/univention/admin/handlers/dhcp/subnet.py              | 8 +++-----
215
.../modules/univention/admin/handlers/dhcp/subnet.py              | 8 +++-----
228
1 file changed, 3 insertions(+), 5 deletions(-)
216
1 file changed, 3 insertions(+), 5 deletions(-)
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py (-7 / +3 lines)
 Lines 130-138   class object(DhcpOptions): Link Here 
130
130
131
	def open(self):
131
	def open(self):
132
		super(object, self).open()
132
		super(object, self).open()
133
		self.info['range'] = rangeUnmap( self.oldattr.get('dhcpRange', []) )
133
		self.info['range'] = self.oldinfo['range'] = rangeUnmap(self.oldattr.get('dhcpRange', []))
134
		self.oldinfo['range'] = rangeUnmap( self.oldattr.get('dhcpRange', []) )
135
136
134
137
	def _ldap_pre_create(self):
135
	def _ldap_pre_create(self):
138
		self.dn='%s=%s,%s' % (mapping.mapName('subnet'), mapping.mapValue('subnet', self.info['subnet']), self.position.getDn())
136
		self.dn='%s=%s,%s' % (mapping.mapName('subnet'), mapping.mapValue('subnet', self.info['subnet']), self.position.getDn())
 Lines 153-162   class object(DhcpOptions): Link Here 
153
					if i != j and univention.admin.ipaddress.is_range_overlapping(i, j):
151
					if i != j and univention.admin.ipaddress.is_range_overlapping(i, j):
154
						raise univention.admin.uexceptions.rangesOverlapping, '%s-%s; %s-%s' % (i[0], i[1], j[0], j[1])
152
						raise univention.admin.uexceptions.rangesOverlapping, '%s-%s; %s-%s' % (i[0], i[1], j[0], j[1])
155
153
156
				ip_in_network=1
154
				ip_in_network = True
157
				for j in i:
155
				for j in i:
158
					if not univention.admin.ipaddress.ip_is_in_network(self['subnet'], self['subnetmask'], j):
156
					if not univention.admin.ipaddress.ip_is_in_network(self['subnet'], self['subnetmask'], j):
159
						ip_in_network=0
157
						ip_in_network = False
160
158
161
					if univention.admin.ipaddress.ip_is_network_address(self['subnet'], self['subnetmask'], j):
159
					if univention.admin.ipaddress.ip_is_network_address(self['subnet'], self['subnetmask'], j):
162
						raise univention.admin.uexceptions.rangeInNetworkAddress, '%s-%s' % (i[0], i[1])
160
						raise univention.admin.uexceptions.rangeInNetworkAddress, '%s-%s' % (i[0], i[1])
163
- 
164
--
165
.../modules/univention/admin/handlers/dhcp/host.py                  | 6 +++---
161
.../modules/univention/admin/handlers/dhcp/host.py                  | 6 +++---
166
1 file changed, 3 insertions(+), 3 deletions(-)
162
1 file changed, 3 insertions(+), 3 deletions(-)
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py (-5 / +3 lines)
 Lines 34-40   from univention.admin.layout import Tab, Group Link Here 
34
import univention.admin.filter
34
import univention.admin.filter
35
import univention.admin.handlers
35
import univention.admin.handlers
36
import univention.admin.localization
36
import univention.admin.localization
37
import univention.debug
37
import univention.debug as ud
38
38
39
translation=univention.admin.localization.translation('univention.admin.handlers.dhcp')
39
translation=univention.admin.localization.translation('univention.admin.handlers.dhcp')
40
_=translation.translate
40
_=translation.translate
 Lines 94-106   layout=[ Link Here 
94
]
94
]
95
95
96
def unmapHWAddress(old):
96
def unmapHWAddress(old):
97
	univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'host.py: unmapHWAddress: old: %s' % old)
97
	ud.debug(ud.ADMIN, ud.INFO, 'host.py: unmapHWAddress: old: %s' % old)
98
	if not old:
98
	if not old:
99
		return ['', '']
99
		return ['', '']
100
	return old[0].split(' ')
100
	return old[0].split(' ')
101
101
102
def mapHWAddress(old):
102
def mapHWAddress(old):
103
	univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'host.py: mapHWAddress: old: %s' % old)
103
	ud.debug(ud.ADMIN, ud.INFO, 'host.py: mapHWAddress: old: %s' % old)
104
	if not old[0]:
104
	if not old[0]:
105
		return ''
105
		return ''
106
	else:
106
	else:
107
- 
108
--
109
.../modules/univention/admin/handlers/__init__.py  |  47 ++---
107
.../modules/univention/admin/handlers/__init__.py  |  47 ++---
110
.../univention/admin/handlers/dhcp/__common.py     |  18 +-
108
.../univention/admin/handlers/dhcp/__common.py     |  18 +-
111
.../modules/univention/admin/handlers/dhcp/dhcp.py | 114 ++++++------
109
.../modules/univention/admin/handlers/dhcp/dhcp.py | 114 ++++++------
112
.../modules/univention/admin/handlers/dhcp/host.py | 122 +++++++------
110
.../modules/univention/admin/handlers/dhcp/host.py | 122 +++++++------
113
.../modules/univention/admin/handlers/dhcp/pool.py | 193 +++++++++++----------
111
.../modules/univention/admin/handlers/dhcp/pool.py | 193 +++++++++++----------
114
.../univention/admin/handlers/dhcp/server.py       |  89 +++++-----
112
.../univention/admin/handlers/dhcp/server.py       |  89 +++++-----
115
.../univention/admin/handlers/dhcp/service.py      |  68 ++++----
113
.../univention/admin/handlers/dhcp/service.py      |  68 ++++----
116
.../univention/admin/handlers/dhcp/shared.py       |  70 ++++----
114
.../univention/admin/handlers/dhcp/shared.py       |  70 ++++----
117
.../univention/admin/handlers/dhcp/sharedsubnet.py | 126 +++++++-------
115
.../univention/admin/handlers/dhcp/sharedsubnet.py | 126 +++++++-------
118
.../univention/admin/handlers/dhcp/subnet.py       | 133 +++++++-------
116
.../univention/admin/handlers/dhcp/subnet.py       | 133 +++++++-------
119
10 files changed, 510 insertions(+), 470 deletions(-)
117
10 files changed, 510 insertions(+), 470 deletions(-)
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py (-33 / +14 lines)
 Lines 63-68   s4connector_search = False Link Here 
63
# FIXME: What is the use of the following line?
63
# FIXME: What is the use of the following line?
64
# __path__.append("users")
64
# __path__.append("users")
65
65
66
66
# manages properties
67
# manages properties
67
class base(object):
68
class base(object):
68
	def __init__(self, co, lo, position, dn='', superordinate = None ):
69
	def __init__(self, co, lo, position, dn='', superordinate = None ):
 Lines 298-304   class base(object): Link Here 
298
		return self.descriptions.keys()
299
		return self.descriptions.keys()
299
300
300
	def items(self):
301
	def items(self):
301
302
		# this returns emtpy strings resp. empty lists for attributes not set
302
		# this returns emtpy strings resp. empty lists for attributes not set
303
		r=[]
303
		r=[]
304
		for key in self.keys():
304
		for key in self.keys():
 Lines 455-461   class base(object): Link Here 
455
455
456
456
457
class simpleLdap(base):
457
class simpleLdap(base):
458
459
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
458
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
460
		global s4connector_present
459
		global s4connector_present
461
		global s4connector_search
460
		global s4connector_search
 Lines 527-533   class simpleLdap(base): Link Here 
527
	def description(self):
526
	def description(self):
528
		if self.dn:
527
		if self.dn:
529
			rdn = self.lo.explodeDn(self.dn)[0]
528
			rdn = self.lo.explodeDn(self.dn)[0]
530
			return rdn[rdn.find('=')+1:]
529
			return rdn[rdn.find('=') + 1:]
531
		else:
530
		else:
532
			return 'none'
531
			return 'none'
533
532
 Lines 584-590   class simpleLdap(base): Link Here 
584
				ml.append(('objectClass', self.oldattr.get('objectClass', []), self.oldattr.get('objectClass', [])+['univentionPolicyReference']))
583
				ml.append(('objectClass', self.oldattr.get('objectClass', []), self.oldattr.get('objectClass', [])+['univentionPolicyReference']))
585
			ml.append(('univentionPolicyReference', self.oldpolicies, self.policies))
584
			ml.append(('univentionPolicyReference', self.oldpolicies, self.policies))
586
585
587
588
		return ml
586
		return ml
589
587
590
	def _create(self):
588
	def _create(self):
 Lines 709-715   class simpleLdap(base): Link Here 
709
		self.save()
707
		self.save()
710
		return self.dn
708
		return self.dn
711
709
712
#+++# MODIFY #+++#
710
	#+++# MODIFY #+++#
713
	def _modify(self, modify_childs=1, ignore_license=0):
711
	def _modify(self, modify_childs=1, ignore_license=0):
714
		self.exceptions=[]
712
		self.exceptions=[]
715
713
 Lines 734-740   class simpleLdap(base): Link Here 
734
		# iterate over all properties and call checkLdap() of corresponding syntax
732
		# iterate over all properties and call checkLdap() of corresponding syntax
735
		self._call_checkLdap_on_all_property_syntaxes()
733
		self._call_checkLdap_on_all_property_syntaxes()
736
734
737
#+++# MODLIST #+++#
735
		#+++# MODLIST #+++#
738
		ml=self._ldap_modlist()
736
		ml=self._ldap_modlist()
739
		# custom attributes
737
		# custom attributes
740
		m=univention.admin.modules.get(self.module)
738
		m=univention.admin.modules.get(self.module)
 Lines 771-777   class simpleLdap(base): Link Here 
771
							ml.remove(i)
769
							ml.remove(i)
772
						ml.extend( addlist )
770
						ml.extend( addlist )
773
771
774
775
					else:
772
					else:
776
						if deleteObjectClass == '1' and not self.info.has_key(pname):
773
						if deleteObjectClass == '1' and not self.info.has_key(pname):
777
							# value is empty, should delete objectClass and Values
774
							# value is empty, should delete objectClass and Values
 Lines 819-825   class simpleLdap(base): Link Here 
819
					ml.append( ('objectClass', self.oldattr.get('objectClass'), current_ocs+[prop.objClass]) )
816
					ml.append( ('objectClass', self.oldattr.get('objectClass'), current_ocs+[prop.objClass]) )
820
817
821
				else:
818
				else:
822
823
					if prop.syntax == 'boolean' and self.info.has_key(prop.name) and self.info[prop.name] == '0':
819
					if prop.syntax == 'boolean' and self.info.has_key(prop.name) and self.info[prop.name] == '0':
824
						# syntax is boolean and value == 0 ==> remove
820
						# syntax is boolean and value == 0 ==> remove
825
						dellist = []
821
						dellist = []
 Lines 1396-1408   class simpleComputer( simpleLdap ): Link Here 
1396
				object[ 'host' ] = object[ 'host' ].replace( old_name, new_name )
1392
				object[ 'host' ] = object[ 'host' ].replace( old_name, new_name )
1397
				object.modify( )
1393
				object.modify( )
1398
1394
1399
1400
	def __remove_from_dhcp_object( self, position = None, name = None, oldname = None, mac = None, ip = None ):
1395
	def __remove_from_dhcp_object( self, position = None, name = None, oldname = None, mac = None, ip = None ):
1401
		# if we got the mac addres, then we remove the object
1396
		# if we got the mac addres, then we remove the object
1402
		# if we only got the ip addres, we remove the ip address
1397
		# if we only got the ip addres, we remove the ip address
1403
1398
1404
		univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'we should remove a dhcp object: position="%s", name="%s", oldname="%s", mac="%s", ip="%s"' % ( position, name, oldname, mac, ip ) )
1399
		univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'we should remove a dhcp object: position="%s", name="%s", oldname="%s", mac="%s", ip="%s"' % ( position, name, oldname, mac, ip ) )
1405
		
1400
1406
		dn = None
1401
		dn = None
1407
1402
1408
		tmppos = univention.admin.uldap.position( self.position.getDomain( ) )
1403
		tmppos = univention.admin.uldap.position( self.position.getDomain( ) )
 Lines 1482-1492   class simpleComputer( simpleLdap ): Link Here 
1482
					for dn2, attributes2 in self.lo.search(scope='domain', attr=[ 'zoneName' ], filter='(&(relativeDomainName=%s)(objectClass=dNSZone))' %  name, unique=0 ):
1477
					for dn2, attributes2 in self.lo.search(scope='domain', attr=[ 'zoneName' ], filter='(&(relativeDomainName=%s)(objectClass=dNSZone))' %  name, unique=0 ):
1483
						self.lo.modify( dn, [('pTRRecord', '%s.%s.' % (name, attributes2['zoneName'][0]), '')] )
1478
						self.lo.modify( dn, [('pTRRecord', '%s.%s.' % (name, attributes2['zoneName'][0]), '')] )
1484
1479
1485
				zone = univention.admin.handlers.dns.reverse_zone.object( self.co, self.lo, self.position, zoneDN) 
1480
				zone = univention.admin.handlers.dns.reverse_zone.object( self.co, self.lo, self.position, zoneDN)
1486
				zone.open()
1481
				zone.open()
1487
				zone.modify()
1482
				zone.modify()
1488
1483
1489
1490
		univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'we should remove a dns reverse object: dnsEntryZoneReverse="%s", name="%s", ip="%s"' % ( dnsEntryZoneReverse, name, ip ) )
1484
		univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'we should remove a dns reverse object: dnsEntryZoneReverse="%s", name="%s", ip="%s"' % ( dnsEntryZoneReverse, name, ip ) )
1491
		if dnsEntryZoneReverse:
1485
		if dnsEntryZoneReverse:
1492
			rdn = self.calc_dns_reverse_entry_name( ip, dnsEntryZoneReverse )
1486
			rdn = self.calc_dns_reverse_entry_name( ip, dnsEntryZoneReverse )
 Lines 1632-1639   class simpleComputer( simpleLdap ): Link Here 
1632
		for dn, attributes in self.lo.search(base=zoneDN, scope='domain', attr=['pTRRecord'], filter=search_filter):
1626
		for dn, attributes in self.lo.search(base=zoneDN, scope='domain', attr=['pTRRecord'], filter=search_filter):
1633
			self.lo.modify(dn, [('pTRRecord', '', ptrrecord)])
1627
			self.lo.modify(dn, [('pTRRecord', '', ptrrecord)])
1634
1628
1635
1636
1637
	def __remove_related_ptrrecords(self, zoneDN, ip):
1629
	def __remove_related_ptrrecords(self, zoneDN, ip):
1638
		ptrrecord = '%s.%s.' % (self.info['name'], zoneDN.split('=')[1].split(',')[0])
1630
		ptrrecord = '%s.%s.' % (self.info['name'], zoneDN.split('=')[1].split(',')[0])
1639
		ip_split = ip.split('.')
1631
		ip_split = ip.split('.')
 Lines 1643-1649   class simpleComputer( simpleLdap ): Link Here 
1643
		for dn, attributes in self.lo.search(base=zoneDN, scope='domain', attr=['pTRRecord'], filter=search_filter):
1635
		for dn, attributes in self.lo.search(base=zoneDN, scope='domain', attr=['pTRRecord'], filter=search_filter):
1644
			if ptrrecord in attributes['pTRRecord']:
1636
			if ptrrecord in attributes['pTRRecord']:
1645
				self.lo.modify(dn, [('pTRRecord', ptrrecord, '')])
1637
				self.lo.modify(dn, [('pTRRecord', ptrrecord, '')])
1646
		
1647
1638
1648
	def check_common_name_length(self):
1639
	def check_common_name_length(self):
1649
		univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'check_common_name_length with self["ip"] = %r and self["dnsEntryZoneForward"] = %r' % (self['ip'], self['dnsEntryZoneForward'], ))
1640
		univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'check_common_name_length with self["ip"] = %r and self["dnsEntryZoneForward"] = %r' % (self['ip'], self['dnsEntryZoneForward'], ))
 Lines 1767-1773   class simpleComputer( simpleLdap ): Link Here 
1767
					else:
1758
					else:
1768
						self.lo.modify( dn, [ ( 'aRecord', '' ,  ip ) ] )
1759
						self.lo.modify( dn, [ ( 'aRecord', '' ,  ip ) ] )
1769
1760
1770
1771
	def __add_dns_alias_object( self, name, dnsForwardZone, dnsAliasZoneContainer, alias ):
1761
	def __add_dns_alias_object( self, name, dnsForwardZone, dnsAliasZoneContainer, alias ):
1772
		univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'add a dns alias object: name="%s", dnsForwardZone="%s", dnsAliasZoneContainer="%s", alias="%s"' % ( name, dnsForwardZone, dnsAliasZoneContainer, alias ) )
1762
		univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'add a dns alias object: name="%s", dnsForwardZone="%s", dnsAliasZoneContainer="%s", alias="%s"' % ( name, dnsForwardZone, dnsAliasZoneContainer, alias ) )
1773
		if name and dnsForwardZone and dnsAliasZoneContainer and alias:
1763
		if name and dnsForwardZone and dnsAliasZoneContainer and alias:
 Lines 1832-1838   class simpleComputer( simpleLdap ): Link Here 
1832
					pass
1822
					pass
1833
1823
1834
	def _ldap_post_modify( self ):
1824
	def _ldap_post_modify( self ):
1835
1836
		self.__multiip |= len(self['mac']) > 1 or len(self['ip']) > 1
1825
		self.__multiip |= len(self['mac']) > 1 or len(self['ip']) > 1
1837
1826
1838
		for entry in self.__changes[ 'dhcpEntryZone' ][ 'remove' ]:
1827
		for entry in self.__changes[ 'dhcpEntryZone' ][ 'remove' ]:
 Lines 1886-1892   class simpleComputer( simpleLdap ): Link Here 
1886
			else:
1875
			else:
1887
				self.__add_dns_reverse_object( self[ 'name' ], dn, ip )
1876
				self.__add_dns_reverse_object( self[ 'name' ], dn, ip )
1888
1877
1889
1890
		for entry in self.__changes[ 'dnsEntryZoneAlias' ][ 'remove' ]:
1878
		for entry in self.__changes[ 'dnsEntryZoneAlias' ][ 'remove' ]:
1891
			dnsForwardZone, dnsAliasZoneContainer, alias = entry
1879
			dnsForwardZone, dnsAliasZoneContainer, alias = entry
1892
			if not alias:
1880
			if not alias:
 Lines 1976-1982   class simpleComputer( simpleLdap ): Link Here 
1976
		if not self.info.get('domain', None):
1964
		if not self.info.get('domain', None):
1977
			self.info['domain'] = domain
1965
			self.info['domain'] = domain
1978
1966
1979
1980
	def _ldap_modlist( self ):
1967
	def _ldap_modlist( self ):
1981
		self.__changes =  {	'mac': {'remove': [ ], 'add': [ ]}, 'ip': {'remove': [ ], 'add': [ ]}, 'name': None,
1968
		self.__changes =  {	'mac': {'remove': [ ], 'add': [ ]}, 'ip': {'remove': [ ], 'add': [ ]}, 'name': None,
1982
							'dnsEntryZoneForward': { 'remove': [ ], 'add': [ ] },
1969
							'dnsEntryZoneForward': { 'remove': [ ], 'add': [ ] },
 Lines 2014-2026   class simpleComputer( simpleLdap ): Link Here 
2014
		newAaaaRecord = []
2001
		newAaaaRecord = []
2015
		if oldAddresses != newAddresses:
2002
		if oldAddresses != newAddresses:
2016
			if oldAddresses:
2003
			if oldAddresses:
2017
			    for address in oldAddresses:
2004
				for address in oldAddresses:
2018
					if ':' in address: # IPv6
2005
					if ':' in address: # IPv6
2019
						oldAaaaRecord.append(address)
2006
						oldAaaaRecord.append(address)
2020
					else:
2007
					else:
2021
						oldARecord.append(address)
2008
						oldARecord.append(address)
2022
			if newAddresses:
2009
			if newAddresses:
2023
			    for address in newAddresses:
2010
				for address in newAddresses:
2024
					if ':' in address: # IPv6
2011
					if ':' in address: # IPv6
2025
						newAaaaRecord.append(ipaddr.IPv6Address(address).exploded)
2012
						newAaaaRecord.append(ipaddr.IPv6Address(address).exploded)
2026
					else:
2013
					else:
 Lines 2060-2078   class simpleComputer( simpleLdap ): Link Here 
2060
						continue
2047
						continue
2061
					self.__changes[ 'ip' ][ 'remove' ].append( ipAddress )
2048
					self.__changes[ 'ip' ][ 'remove' ].append( ipAddress )
2062
2049
2063
2064
		if self.hasChanged( 'name' ):
2050
		if self.hasChanged( 'name' ):
2065
			ml.append( ( 'sn', self.oldattr.get( 'sn', [ None ] )[ 0 ], self[ 'name' ] ) )
2051
			ml.append( ( 'sn', self.oldattr.get( 'sn', [ None ] )[ 0 ], self[ 'name' ] ) )
2066
			self.__changes[ 'name' ] = ( self.oldattr.get( 'sn', [ None ] )[ 0 ], self[ 'name' ] )
2052
			self.__changes[ 'name' ] = ( self.oldattr.get( 'sn', [ None ] )[ 0 ], self[ 'name' ] )
2067
2053
2068
		if self.hasChanged('ip') or self.hasChanged('mac'):
2054
		if self.hasChanged('ip') or self.hasChanged('mac'):
2069
2070
			if len(self.info.get('ip', [])) == 1 and len(self.info.get('mac', [])) == 1 and len(self.info.get('dhcpEntryZone', [])):
2055
			if len(self.info.get('ip', [])) == 1 and len(self.info.get('mac', [])) == 1 and len(self.info.get('dhcpEntryZone', [])):
2071
				# In this special case, we assume the mapping between ip/mac address to be
2056
				# In this special case, we assume the mapping between ip/mac address to be
2072
				# unique. The dhcp entry needs to contain the mac address (as sepcified by
2057
				# unique. The dhcp entry needs to contain the mac address (as sepcified by
2073
				# the ldap search for dhcp entries), the ip address may not correspond to 
2058
				# the ldap search for dhcp entries), the ip address may not correspond to
2074
				# the ip address associated with the computer ldap object, but this would 
2059
				# the ip address associated with the computer ldap object, but this would
2075
				# be erroneous anyway. We therefore update the dhcp entry to correspond to 
2060
				# be erroneous anyway. We therefore update the dhcp entry to correspond to
2076
				# the current ip and mac address. (Bug #20315)
2061
				# the current ip and mac address. (Bug #20315)
2077
				dn, ip, mac = self.__split_dhcp_line( self.info['dhcpEntryZone'][0] )
2062
				dn, ip, mac = self.__split_dhcp_line( self.info['dhcpEntryZone'][0] )
2078
2063
 Lines 2173-2178   class simpleComputer( simpleLdap ): Link Here 
2173
			subnet=ldap.explode_dn(reverseDN, 1)[0].replace('.in-addr.arpa','').split('.')
2158
			subnet=ldap.explode_dn(reverseDN, 1)[0].replace('.in-addr.arpa','').split('.')
2174
			ip=sip.split('.')
2159
			ip=sip.split('.')
2175
			return self.calc_dns_reverse_entry_name_do(4, subnet, ip)
2160
			return self.calc_dns_reverse_entry_name_do(4, subnet, ip)
2161
2176
	def calc_dns_reverse_entry_name_do(self, maxLength, zoneNet, ip):
2162
	def calc_dns_reverse_entry_name_do(self, maxLength, zoneNet, ip):
2177
		zoneNet.reverse()
2163
		zoneNet.reverse()
2178
		if not ip[:len(zoneNet)] == zoneNet:
2164
		if not ip[:len(zoneNet)] == zoneNet:
 Lines 2204-2210   class simpleComputer( simpleLdap ): Link Here 
2204
			else:
2190
			else:
2205
				self.__modify_dhcp_object( dn, self[ 'name' ], ip, mac )
2191
				self.__modify_dhcp_object( dn, self[ 'name' ], ip, mac )
2206
2192
2207
2208
		for entry in self.__changes[ 'dnsEntryZoneForward' ][ 'remove' ]:
2193
		for entry in self.__changes[ 'dnsEntryZoneForward' ][ 'remove' ]:
2209
			dn, ip = self.__split_dns_line( entry )
2194
			dn, ip = self.__split_dns_line( entry )
2210
			if not ip and not self.__multiip:
2195
			if not ip and not self.__multiip:
 Lines 2296-2302   class simpleComputer( simpleLdap ): Link Here 
2296
			groupObject = univention.admin.objects.get(univention.admin.modules.get('groups/group'), self.co, self.lo, self.position, group)
2281
			groupObject = univention.admin.objects.get(univention.admin.modules.get('groups/group'), self.co, self.lo, self.position, group)
2297
			groupObject.fast_member_remove( [ self.dn ], self.oldattr.get('uid',[]), ignore_license=1 )
2282
			groupObject.fast_member_remove( [ self.dn ], self.oldattr.get('uid',[]), ignore_license=1 )
2298
2283
2299
2300
	def __update_groups_after_namechange(self):
2284
	def __update_groups_after_namechange(self):
2301
		oldname = self.oldinfo.get('name')
2285
		oldname = self.oldinfo.get('name')
2302
		newname = self.info.get('name')
2286
		newname = self.info.get('name')
 Lines 2338-2344   class simpleComputer( simpleLdap ): Link Here 
2338
2322
2339
			self.lo.modify(group, [('uniqueMember', oldUniqueMembers, newUniqueMembers), ('memberUid', oldMemberUids, newMemberUids)])
2323
			self.lo.modify(group, [('uniqueMember', oldUniqueMembers, newUniqueMembers), ('memberUid', oldMemberUids, newMemberUids)])
2340
2324
2341
2342
	def update_groups(self):
2325
	def update_groups(self):
2343
		if not self.hasChanged('groups') and \
2326
		if not self.hasChanged('groups') and \
2344
			   not ('oldPrimaryGroupDn' in self.__dict__ and self.oldPrimaryGroupDn) and \
2327
			   not ('oldPrimaryGroupDn' in self.__dict__ and self.oldPrimaryGroupDn) and \
 Lines 2382-2388   class simpleComputer( simpleLdap ): Link Here 
2382
				groupObject['hosts'].remove(self.dn)
2365
				groupObject['hosts'].remove(self.dn)
2383
				groupObject.modify(ignore_license=1)
2366
				groupObject.modify(ignore_license=1)
2384
2367
2385
2386
	def primary_group(self):
2368
	def primary_group(self):
2387
		if not self.hasChanged('primaryGroup'):
2369
		if not self.hasChanged('primaryGroup'):
2388
			return
2370
			return
 Lines 2560-2567   class simpleComputer( simpleLdap ): Link Here 
2560
		if raise_after:
2542
		if raise_after:
2561
			raise raise_after
2543
			raise raise_after
2562
2544
2563
class simpleLdapSub(simpleLdap):
2564
2545
2546
class simpleLdapSub(simpleLdap):
2565
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
2547
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
2566
		base.__init__(self, co, lo, position, dn, superordinate )
2548
		base.__init__(self, co, lo, position, dn, superordinate )
2567
2549
 Lines 2580-2588   class simpleLdapSub(simpleLdap): Link Here 
2580
		if hasattr(self,"_ldap_post_remove"):
2562
		if hasattr(self,"_ldap_post_remove"):
2581
			self._ldap_post_remove()
2563
			self._ldap_post_remove()
2582
2564
2565
2583
class simplePolicy(simpleLdap):
2566
class simplePolicy(simpleLdap):
2584
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
2567
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
2585
2586
		self.resultmode=0
2568
		self.resultmode=0
2587
		self.dn=dn
2569
		self.dn=dn
2588
2570
 Lines 2765-2771   class simplePolicy(simpleLdap): Link Here 
2765
		self.policy_result()
2747
		self.policy_result()
2766
2748
2767
		if self.polinfo.has_key(key):
2749
		if self.polinfo.has_key(key):
2768
2769
			if self.polinfo[key] != newvalue or self.polinfo_more[key]['policy'] == self.cloned or ( self.info.has_key( key ) and self.info[ key ] != newvalue ):
2750
			if self.polinfo[key] != newvalue or self.polinfo_more[key]['policy'] == self.cloned or ( self.info.has_key( key ) and self.info[ key ] != newvalue ):
2770
				if self.polinfo_more[key]['fixed'] and self.polinfo_more[key]['policy'] != self.cloned:
2751
				if self.polinfo_more[key]['fixed'] and self.polinfo_more[key]['policy'] != self.cloned:
2771
					raise univention.admin.uexceptions.policyFixedAttribute, key
2752
					raise univention.admin.uexceptions.policyFixedAttribute, key
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py (-9 / +9 lines)
 Lines 35-41   import univention.admin.localization Link Here 
35
from univention.admin.layout import Tab
35
from univention.admin.layout import Tab
36
from univention.admin.handlers import simpleLdap
36
from univention.admin.handlers import simpleLdap
37
37
38
translation = univention.admin.localization.translation( 'univention.admin.handlers.dhcp' )
38
translation = univention.admin.localization.translation('univention.admin.handlers.dhcp')
39
_ = translation.translate
39
_ = translation.translate
40
40
41
41
 Lines 52-66   _options = { Link Here 
52
52
53
_properties = {
53
_properties = {
54
	'option': univention.admin.property(
54
	'option': univention.admin.property(
55
		short_description = _( 'DHCP options' ),
55
		short_description=_('DHCP options'),
56
		long_description = _( 'Defines DHCP options for the subnet.' ),
56
		long_description=_('Defines additional DHCP options.'),
57
		syntax = univention.admin.syntax.string,
57
		syntax=univention.admin.syntax.string,
58
		multivalue = True,
58
		multivalue=True,
59
		options = ["options"],
59
		options=["options"],
60
		required = 0,
60
		required = 0,
61
		may_change = True,
61
		may_change=True,
62
		identifies = 0
62
		identifies = 0
63
		),
63
	),
64
}
64
}
65
65
66
66
 Lines 88-94   def add_dhcp_options(module_name): Link Here 
88
88
89
	mapping = getattr(module, "mapping")
89
	mapping = getattr(module, "mapping")
90
	for item in _mappings:
90
	for item in _mappings:
91
		mapping.register( *item )
91
		mapping.register(*item)
92
92
93
	layout = getattr(module, "layout")
93
	layout = getattr(module, "layout")
94
	layout.append(Tab(
94
	layout.append(Tab(
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/dhcp.py (-51 / +63 lines)
 Lines 44-118   import univention.admin.handlers.dhcp.sharedsubnet Link Here 
44
import univention.admin.handlers.dhcp.subnet
44
import univention.admin.handlers.dhcp.subnet
45
45
46
46
47
translation=univention.admin.localization.translation('univention.admin.handlers.dhcp')
47
translation = univention.admin.localization.translation('univention.admin.handlers.dhcp')
48
_=translation.translate
48
_ = translation.translate
49
49
50
50
51
module='dhcp/dhcp'
51
module = 'dhcp/dhcp'
52
52
53
childs=0
53
childs = 0
54
short_description=_('DHCP')
54
short_description = _('DHCP')
55
long_description=''
55
long_description = ''
56
operations=['search']
56
operations = ['search']
57
usewizard=1
57
usewizard = 1
58
wizardmenustring=_("DHCP")
58
wizardmenustring = _("DHCP")
59
wizarddescription=_("Add, edit and delete DHCP objects")
59
wizarddescription = _("Add, edit and delete DHCP objects")
60
wizardoperations={"add":[_("Add"), _("Add DHCP object")],"find":[_("Search"), _("Search DHCP object(s)")]}
60
wizardoperations = {
61
wizardpath="univentionDhcpObject"
61
	"add": [_("Add"), _("Add DHCP object")],
62
wizardsuperordinates = ( 'None', 'dhcp/service', 'dhcp/shared' )
62
	"find": [_("Search"), _("Search DHCP object(s)")],
63
}
64
wizardpath = "univentionDhcpObject"
65
wizardsuperordinates = ('None', 'dhcp/service', 'dhcp/shared')
63
wizardtypesforsuper = {
66
wizardtypesforsuper = {
64
	'None' : ( 'dhcp/service', ),
67
	'None': ('dhcp/service',),
65
	'dhcp/service' : ( 'dhcp/host', 'dhcp/server', 'dhcp/shared', 'dhcp/subnet' ),
68
	'dhcp/service': ('dhcp/host', 'dhcp/server', 'dhcp/shared', 'dhcp/subnet'),
66
	'dhcp/shared' : ( 'dhcp/sharedsubnet', )
69
	'dhcp/shared': ('dhcp/sharedsubnet',)
67
	}
70
}
68
71
69
childmodules=["dhcp/host","dhcp/pool","dhcp/server","dhcp/service","dhcp/shared","dhcp/sharedsubnet","dhcp/subnet"]
72
childmodules = [
70
virtual=1
73
	"dhcp/host",
71
options={
74
	"dhcp/pool",
75
	"dhcp/server",
76
	"dhcp/service",
77
	"dhcp/shared",
78
	"dhcp/sharedsubnet",
79
	"dhcp/subnet",
80
]
81
virtual = 1
82
83
options = {
72
}
84
}
73
property_descriptions={
85
86
property_descriptions = {
74
	'name': univention.admin.property(
87
	'name': univention.admin.property(
75
			short_description=_('Name'),
88
		short_description=_('Name'),
76
			long_description='',
89
		long_description='',
77
			syntax=univention.admin.syntax.string,
90
		syntax=univention.admin.syntax.string,
78
			multivalue=0,
91
		multivalue=0,
79
			include_in_default_search=1,
92
		include_in_default_search=1,
80
			options=[],
93
		options=[],
81
			required=1,
94
		required=1,
82
			may_change=1,
95
		may_change=1,
83
			identifies=1
96
		identifies=1
84
		)
97
	)
85
}
98
}
86
99
87
layout = [ Tab( _( 'General' ), _( 'Basic settings' ), layout = [ "name" ] ) ]
100
layout = [Tab(_('General'), _('Basic settings'), layout=["name"])]
88
101
89
mapping=univention.admin.mapping.mapping()
102
mapping = univention.admin.mapping.mapping()
90
103
91
104
92
class object(univention.admin.handlers.simpleLdap):
105
class object(univention.admin.handlers.simpleLdap):
93
	module=module
106
	module = module
94
107
95
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
108
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes=[]):
96
		self.mapping=mapping
109
		self.mapping = mapping
97
		self.descriptions=property_descriptions
110
		self.descriptions = property_descriptions
98
111
99
		super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes)
112
		super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes)
100
113
101
114
102
def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, required=0, timeout=-1, sizelimit=0):
115
def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, required=0, timeout=-1, sizelimit=0):
103
	ret=[]
116
	ret = []
104
	if superordinate:
117
	if superordinate:
105
		ret+=  univention.admin.handlers.dhcp.host.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit)
118
		ret += univention.admin.handlers.dhcp.host.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit)
106
		ret+= univention.admin.handlers.dhcp.pool.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit)
119
		ret += univention.admin.handlers.dhcp.pool.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit)
107
		ret+=univention.admin.handlers.dhcp.server.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit)
120
		ret += univention.admin.handlers.dhcp.server.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit)
108
		ret+= univention.admin.handlers.dhcp.shared.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit)
121
		ret += univention.admin.handlers.dhcp.shared.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit)
109
		ret+= univention.admin.handlers.dhcp.sharedsubnet.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit)
122
		ret += univention.admin.handlers.dhcp.sharedsubnet.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit)
110
		ret+= univention.admin.handlers.dhcp.subnet.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit)
123
		ret += univention.admin.handlers.dhcp.subnet.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit)
111
	else:
124
	else:
112
		ret+= univention.admin.handlers.dhcp.service.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit)
125
		ret += univention.admin.handlers.dhcp.service.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit)
113
	return ret
126
	return ret
114
127
128
115
def identify(dn, attr, canonical=0):
129
def identify(dn, attr, canonical=0):
116
	pass
130
	pass
117
118
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py (-55 / +67 lines)
 Lines 36-115   import univention.admin.handlers Link Here 
36
import univention.admin.localization
36
import univention.admin.localization
37
import univention.debug as ud
37
import univention.debug as ud
38
38
39
translation=univention.admin.localization.translation('univention.admin.handlers.dhcp')
39
translation = univention.admin.localization.translation('univention.admin.handlers.dhcp')
40
_=translation.translate
40
_ = translation.translate
41
41
42
module='dhcp/host'
42
module = 'dhcp/host'
43
operations=['add','edit','remove','search']
43
operations = ['add', 'edit', 'remove', 'search']
44
superordinate='dhcp/service'
44
superordinate = 'dhcp/service'
45
childs=0
45
childs = 0
46
usewizard=1
46
usewizard = 1
47
short_description=_('DHCP: Host')
47
short_description = _('DHCP: Host')
48
long_description=''
48
long_description = ''
49
options={
49
50
options = {
50
}
51
}
51
property_descriptions={
52
53
property_descriptions = {
52
	'host':  univention.admin.property(
54
	'host':  univention.admin.property(
53
			short_description=_('Hostname'),
55
		short_description=_('Hostname'),
54
			long_description='',
56
		long_description='',
55
			syntax=univention.admin.syntax.string,
57
		syntax=univention.admin.syntax.string,
56
			multivalue=0,
58
		multivalue=0,
57
			include_in_default_search=1,
59
		include_in_default_search=1,
58
			options=[],
60
		options=[],
59
			required=1,
61
		required=1,
60
			may_change=1,
62
		may_change=1,
61
			identifies=1
63
		identifies=1
62
		),
64
	),
63
	'hwaddress': univention.admin.property(
65
	'hwaddress': univention.admin.property(
64
			short_description=_('Hardware address'),
66
		short_description=_('Hardware address'),
65
			long_description=_('Currently, only the ethernet and token-ring types are recognized. \
67
		long_description=_(
66
The hardware-address should be a set of hexadecimal octets (numbers from 0 through ff) separated by colons.'),
68
			'Currently, only the ethernet and token-ring types are recognized.'
67
			syntax=univention.admin.syntax.DHCP_HardwareAddress,
69
			'The hardware-address should be a set of hexadecimal octets (numbers from 0 through ff) separated by colons.'),
68
			multivalue=0,
70
		syntax=univention.admin.syntax.DHCP_HardwareAddress,
69
			options=[],
71
		multivalue=0,
70
			required=1,
72
		options=[],
71
			may_change=1,
73
		required=1,
72
			identifies=0
74
		may_change=1,
73
		),
75
		identifies=0
76
	),
74
	'fixedaddress': univention.admin.property(
77
	'fixedaddress': univention.admin.property(
75
			short_description=_('Fixed IP addresses'),
78
		short_description=_('Fixed IP addresses'),
76
			long_description=_('Assign one or more fixed IP addresses. \
79
		long_description=_(
77
Each address should be either an IP address or a domain name that resolves to one or more IP addresses'),
80
			'Assign one or more fixed IP addresses.'
78
			syntax=univention.admin.syntax.string,
81
			'Each address should be either an IP address or a domain name that resolves to one or more IP addresses'),
79
			multivalue=1,
82
		syntax=univention.admin.syntax.string,
80
			options=[],
83
		multivalue=1,
81
			required=0,
84
		options=[],
82
			may_change=1,
85
		required=0,
83
			identifies=0
86
		may_change=1,
84
		),
87
		identifies=0
88
	),
85
}
89
}
86
layout=[
90
87
	Tab( _('General'), _('Basic settings'), layout = [
91
layout = [
88
		Group( _( 'General' ), layout = [
92
	Tab(_('General'), _('Basic settings'), layout=[
93
		Group(_('General'), layout=[
89
			'host',
94
			'host',
90
			'hwaddress',
95
			'hwaddress',
91
			'fixedaddress'
96
			'fixedaddress'
92
		] ),
97
		]),
93
	] )
98
	])
94
]
99
]
95
100
101
96
def unmapHWAddress(old):
102
def unmapHWAddress(old):
97
	ud.debug(ud.ADMIN, ud.INFO, 'host.py: unmapHWAddress: old: %s' % old)
103
	ud.debug(ud.ADMIN, ud.INFO, 'host.py: unmapHWAddress: old: %s' % old)
98
	if not old:
104
	if not old:
99
		return ['', '']
105
		return ['', '']
100
	return old[0].split(' ')
106
	return old[0].split(' ')
101
107
108
102
def mapHWAddress(old):
109
def mapHWAddress(old):
103
	ud.debug(ud.ADMIN, ud.INFO, 'host.py: mapHWAddress: old: %s' % old)
110
	ud.debug(ud.ADMIN, ud.INFO, 'host.py: mapHWAddress: old: %s' % old)
104
	if not old[0]:
111
	if not old[0]:
105
		return ''
112
		return ''
106
	else:
113
	else:
107
		if len (old) > 1:
114
		if len(old) > 1:
108
			return '%s %s' % (old[0], old[1])
115
			return '%s %s' % (old[0], old[1])
109
		else:
116
		else:
110
			return old
117
			return old
111
118
112
mapping=univention.admin.mapping.mapping()
119
120
mapping = univention.admin.mapping.mapping()
113
mapping.register('host', 'cn', None, univention.admin.mapping.ListToString)
121
mapping.register('host', 'cn', None, univention.admin.mapping.ListToString)
114
mapping.register('hwaddress', 'dhcpHWAddress', mapHWAddress, unmapHWAddress)
122
mapping.register('hwaddress', 'dhcpHWAddress', mapHWAddress, unmapHWAddress)
115
mapping.register('fixedaddress', 'univentionDhcpFixedAddress')
123
mapping.register('fixedaddress', 'univentionDhcpFixedAddress')
 Lines 119-129   add_dhcp_options(__name__) Link Here 
119
127
120
128
121
class object(DhcpOptions):
129
class object(DhcpOptions):
122
	module=module
130
	module = module
123
131
124
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
132
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes=[]):
125
		self.mapping=mapping
133
		self.mapping = mapping
126
		self.descriptions=property_descriptions
134
		self.descriptions = property_descriptions
127
135
128
		if not superordinate:
136
		if not superordinate:
129
			raise univention.admin.uexceptions.insufficientInformation, 'superordinate object not present'
137
			raise univention.admin.uexceptions.insufficientInformation, 'superordinate object not present'
 Lines 134-140   class object(DhcpOptions): Link Here 
134
		self.setup_options(options)
142
		self.setup_options(options)
135
143
136
	def _ldap_pre_create(self):
144
	def _ldap_pre_create(self):
137
		self.dn='%s=%s,%s' % (mapping.mapName('host'), mapping.mapValue('host', self.info['host']), self.position.getDn())
145
		self.dn = '%s=%s,%s' % (
146
			mapping.mapName('host'),
147
			mapping.mapValue('host', self.info['host']),
148
			self.position.getDn()
149
		)
138
150
139
	def _ldap_addlist(self):
151
	def _ldap_addlist(self):
140
		return [
152
		return [
 Lines 153-158   class object(DhcpOptions): Link Here 
153
lookup_filter = object.lookup_filter
165
lookup_filter = object.lookup_filter
154
lookup = object.lookup
166
lookup = object.lookup
155
167
156
def identify(dn, attr):
157
168
169
def identify(dn, attr):
158
	return 'univentionDhcpHost' in attr.get('objectClass', [])
170
	return 'univentionDhcpHost' in attr.get('objectClass', [])
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py (-93 / +100 lines)
 Lines 38-149   import univention.admin.handlers Link Here 
38
import univention.admin.localization
38
import univention.admin.localization
39
import univention.admin.uexceptions
39
import univention.admin.uexceptions
40
40
41
translation=univention.admin.localization.translation('univention.admin.handlers.dhcp')
41
translation = univention.admin.localization.translation('univention.admin.handlers.dhcp')
42
_=translation.translate
42
_ = translation.translate
43
43
44
module='dhcp/pool'
44
module = 'dhcp/pool'
45
operations=['add','edit','remove','search']
45
operations = ['add', 'edit', 'remove', 'search']
46
superordinate = 'dhcp/subnet'
46
superordinate = 'dhcp/subnet'
47
childs=0
47
childs = 0
48
usewizard=1
48
usewizard = 1
49
short_description=_('DHCP: Pool')
49
short_description = _('DHCP: Pool')
50
long_description=''
50
long_description = ''
51
options={
51
52
options = {
52
}
53
}
53
property_descriptions={
54
55
property_descriptions = {
54
	'name': univention.admin.property(
56
	'name': univention.admin.property(
55
			short_description=_('Name'),
57
		short_description=_('Name'),
56
			long_description=_('A unique name used to identify this pool, e.g. "known" or "guests"'),
58
		long_description=_('A unique name used to identify this pool, e.g. "known" or "guests"'),
57
			syntax=univention.admin.syntax.string,
59
		syntax=univention.admin.syntax.string,
58
			multivalue=0,
60
		multivalue=0,
59
			include_in_default_search=1,
61
		include_in_default_search=1,
60
			options=[],
62
		options=[],
61
			required=1,
63
		required=1,
62
			may_change=0,
64
		may_change=0,
63
			identifies=1
65
		identifies=1
64
		),
66
	),
65
	'range': univention.admin.property(
67
	'range': univention.admin.property(
66
			short_description=_('IP range for dynamic assignment'),
68
		short_description=_('IP range for dynamic assignment'),
67
			long_description='',
69
		long_description='',
68
			syntax=univention.admin.syntax.IPv4_AddressRange,
70
		syntax=univention.admin.syntax.IPv4_AddressRange,
69
			multivalue=1,
71
		multivalue=1,
70
			options=[],
72
		options=[],
71
			required=1,
73
		required=1,
72
			may_change=1,
74
		may_change=1,
73
			identifies=0
75
		identifies=0
74
		),
76
	),
75
	'failover_peer': univention.admin.property(
77
	'failover_peer': univention.admin.property(
76
			short_description=_('Failover peer'),
78
		short_description=_('Failover peer'),
77
			long_description=_('The name of a failover configuration manually configured in /etc/dhcp/local.conf.'),
79
		long_description=_('The name of a failover configuration manually configured in /etc/dhcp/local.conf.'),
78
			syntax=univention.admin.syntax.string,
80
		syntax=univention.admin.syntax.string,
79
			multivalue=0,
81
		multivalue=0,
80
			options=[],
82
		options=[],
81
			required=0,
83
		required=0,
82
			may_change=1,
84
		may_change=1,
83
			identifies=0,
85
		identifies=0,
84
		),
86
	),
85
	'known_clients': univention.admin.property(
87
	'known_clients': univention.admin.property(
86
			short_description=_('Give IP to known clients'),
88
		short_description=_('Give IP to known clients'),
87
			long_description=_('Addresses are allocated for client, which have a host entry matching their MAC address.'),
89
		long_description=_('Addresses are allocated for client, which have a host entry matching their MAC address.'),
88
			syntax=univention.admin.syntax.AllowDeny,
90
		syntax=univention.admin.syntax.AllowDeny,
89
			multivalue=0,
91
		multivalue=0,
90
			options=[],
92
		options=[],
91
			required=0,
93
		required=0,
92
			may_change=1,
94
		may_change=1,
93
			identifies=0
95
		identifies=0
94
		),
96
	),
95
	'unknown_clients': univention.admin.property(
97
	'unknown_clients': univention.admin.property(
96
			short_description=_('Give IP to unknown clients'),
98
		short_description=_('Give IP to unknown clients'),
97
			long_description=_('Addresses are allocated for clients, which do not have a host entry mating their MAC address.'),
99
		long_description=_('Addresses are allocated for clients, which do not have a host entry mating their MAC address.'),
98
			syntax=univention.admin.syntax.AllowDeny,
100
		syntax=univention.admin.syntax.AllowDeny,
99
			multivalue=0,
101
		multivalue=0,
100
			options=[],
102
		options=[],
101
			required=0,
103
		required=0,
102
			may_change=1,
104
		may_change=1,
103
			identifies=0
105
		identifies=0
104
		),
106
	),
105
	'dynamic_bootp_clients': univention.admin.property(
107
	'dynamic_bootp_clients': univention.admin.property(
106
			short_description=_('Give IP to dynamic BOOTP clients'),
108
		short_description=_('Give IP to dynamic BOOTP clients'),
107
			long_description=_(
109
		long_description=_(
108
				'Give addresses to clients using the legacy BOOTP protocol.'
110
			'Give addresses to clients using the legacy BOOTP protocol.'
109
				'Since BOOTP does not support an expiry date or a release mechanism, addresses are allocated indefinitely!'),
111
			'Since BOOTP does not support an expiry date or a release mechanism, addresses are allocated indefinitely!'),
110
			syntax=univention.admin.syntax.AllowDeny,
112
		syntax=univention.admin.syntax.AllowDeny,
111
			multivalue=0,
113
		multivalue=0,
112
			options=[],
114
		options=[],
113
			required=0,
115
		required=0,
114
			may_change=1,
116
		may_change=1,
115
			identifies=0
117
		identifies=0
116
		),
118
	),
117
	'all_clients': univention.admin.property(
119
	'all_clients': univention.admin.property(
118
			short_description=_('Give IP from this pool'),
120
		short_description=_('Give IP from this pool'),
119
			long_description=_('Give addresses from this pool at all or not.'),
121
		long_description=_('Give addresses from this pool at all or not.'),
120
			syntax=univention.admin.syntax.AllowDeny,
122
		syntax=univention.admin.syntax.AllowDeny,
121
			multivalue=0,
123
		multivalue=0,
122
			options=[],
124
		options=[],
123
			required=0,
125
		required=0,
124
			may_change=1,
126
		may_change=1,
125
			identifies=0
127
		identifies=0
126
		),
128
	),
127
}
129
}
128
130
129
layout = [
131
layout = [
130
	Tab(_('General'), _('Basic settings'), layout = [
132
	Tab(_('General'), _('Basic settings'), layout=[
131
		Group( _( 'General' ), layout = [
133
		Group(_('General'), layout=[
132
			'name',
134
			'name',
133
			'range'
135
			'range'
134
		] ),
136
		]),
135
	] ),
137
	]),
136
	Tab( _( 'Advanced' ), _('Advanced DHCP pool options'), advanced = True, layout = [
138
	Tab(_('Advanced'), _('Advanced DHCP pool options'), advanced=True, layout=[
137
		'failover_peer',
139
		'failover_peer',
138
		[ 'known_clients', 'unknown_clients' ],
140
		['known_clients', 'unknown_clients'],
139
		[ 'dynamic_bootp_clients', 'all_clients' ]
141
		['dynamic_bootp_clients', 'all_clients']
140
	] )
142
	])
141
]
143
]
142
144
143
145
144
from .__common import rangeMap, rangeUnmap, add_dhcp_options, DhcpOptions
146
from .__common import rangeMap, rangeUnmap, add_dhcp_options, DhcpOptions
145
147
146
mapping=univention.admin.mapping.mapping()
148
mapping = univention.admin.mapping.mapping()
147
mapping.register('name', 'cn', None, univention.admin.mapping.ListToString)
149
mapping.register('name', 'cn', None, univention.admin.mapping.ListToString)
148
mapping.register('range', 'dhcpRange', rangeMap, rangeUnmap)
150
mapping.register('range', 'dhcpRange', rangeMap, rangeUnmap)
149
mapping.register('failover_peer', 'univentionDhcpFailoverPeer', None, univention.admin.mapping.ListToString)
151
mapping.register('failover_peer', 'univentionDhcpFailoverPeer', None, univention.admin.mapping.ListToString)
 Lines 152-158   add_dhcp_options(__name__) Link Here 
152
154
153
155
154
class object(DhcpOptions):
156
class object(DhcpOptions):
155
	module=module
157
	module = module
156
158
157
	permits_udm2dhcp = {
159
	permits_udm2dhcp = {
158
		'known_clients': "known clients",
160
		'known_clients': "known clients",
 Lines 162-170   class object(DhcpOptions): Link Here 
162
	}
164
	}
163
	permits_dhcp2udm = dict((value, key) for (key, value) in permits_udm2dhcp.items())
165
	permits_dhcp2udm = dict((value, key) for (key, value) in permits_udm2dhcp.items())
164
166
165
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
167
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes=[]):
166
		self.mapping=mapping
168
		self.mapping = mapping
167
		self.descriptions=property_descriptions
169
		self.descriptions = property_descriptions
168
170
169
		if not superordinate:
171
		if not superordinate:
170
			raise univention.admin.uexceptions.insufficientInformation, 'superordinate object not present'
172
			raise univention.admin.uexceptions.insufficientInformation, 'superordinate object not present'
 Lines 184-192   class object(DhcpOptions): Link Here 
184
186
185
		self.save()
187
		self.save()
186
188
187
188
	def _ldap_pre_create(self):
189
	def _ldap_pre_create(self):
189
		self.dn='%s=%s,%s' % (mapping.mapName('name'), mapping.mapValue('name', self.info['name']), self.position.getDn())
190
		self.dn = '%s=%s,%s' % (
191
			mapping.mapName('name'),
192
			mapping.mapValue('name', self.info['name']),
193
			self.position.getDn()
194
		)
190
195
191
	def _ldap_addlist(self):
196
	def _ldap_addlist(self):
192
		return [
197
		return [
 Lines 196-203   class object(DhcpOptions): Link Here 
196
	def _ldap_modlist(self):
201
	def _ldap_modlist(self):
197
		ml = super(object, self)._ldap_modlist()
202
		ml = super(object, self)._ldap_modlist()
198
		if self.hasChanged(self.permits_udm2dhcp.keys()):
203
		if self.hasChanged(self.permits_udm2dhcp.keys()):
199
			old=self.oldattr.get('dhcpPermitList', [])
204
			old = self.oldattr.get('dhcpPermitList', [])
200
			new=copy.deepcopy(old)
205
			new = copy.deepcopy(old)
201
			for prop, value in self.permits_udm2dhcp.items():
206
			for prop, value in self.permits_udm2dhcp.items():
202
				try:
207
				try:
203
					permit = self.oldinfo[prop]
208
					permit = self.oldinfo[prop]
 Lines 210-217   class object(DhcpOptions): Link Here 
210
				except LookupError:
215
				except LookupError:
211
					pass
216
					pass
212
			ml.append(('dhcpPermitList', old, new))
217
			ml.append(('dhcpPermitList', old, new))
218
213
		if self.info.get('failover_peer', None) and not self.info.get('dynamic_bootp_clients', None) == 'deny':
219
		if self.info.get('failover_peer', None) and not self.info.get('dynamic_bootp_clients', None) == 'deny':
214
			raise univention.admin.uexceptions.bootpXORFailover
220
			raise univention.admin.uexceptions.bootpXORFailover
221
215
		return ml
222
		return ml
216
223
217
	@staticmethod
224
	@staticmethod
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py (-41 / +48 lines)
 Lines 35-76   import univention.admin.filter Link Here 
35
import univention.admin.handlers
35
import univention.admin.handlers
36
import univention.admin.localization
36
import univention.admin.localization
37
37
38
translation=univention.admin.localization.translation('univention.admin.handlers.dhcp')
38
translation = univention.admin.localization.translation('univention.admin.handlers.dhcp')
39
_=translation.translate
39
_ = translation.translate
40
40
41
module='dhcp/server'
41
module = 'dhcp/server'
42
operations=['add','edit','remove','search']
42
operations = ['add', 'edit', 'remove', 'search']
43
superordinate='dhcp/service'
43
superordinate = 'dhcp/service'
44
childs=0
44
childs = 0
45
usewizard=1
45
usewizard = 1
46
short_description=_('DHCP: Server')
46
short_description = _('DHCP: Server')
47
long_description=''
47
long_description = ''
48
options={
48
49
options = {
49
}
50
}
50
51
51
property_descriptions={
52
property_descriptions = {
52
	'server': univention.admin.property(
53
	'server': univention.admin.property(
53
			short_description=_('Server name'),
54
		short_description=_('Server name'),
54
			long_description='',
55
		long_description='',
55
			syntax=univention.admin.syntax.string,
56
		syntax=univention.admin.syntax.string,
56
			multivalue=0,
57
		multivalue=0,
57
			include_in_default_search=1,
58
		include_in_default_search=1,
58
			options=[],
59
		options=[],
59
			required=1,
60
		required=1,
60
			may_change=1,
61
		may_change=1,
61
			identifies=1
62
		identifies=1
62
		),
63
	),
63
}
64
}
64
65
65
layout = [
66
layout = [
66
	Tab( _( 'General' ), _('General settings'), layout = [
67
	Tab(_('General'), _('General settings'), layout=[
67
		Group( _( 'General' ), layout = [
68
		Group(_('General'), layout=[
68
			'server'
69
			'server'
69
		] ),
70
		]),
70
	] )
71
	])
71
]
72
]
72
73
73
mapping=univention.admin.mapping.mapping()
74
mapping = univention.admin.mapping.mapping()
74
mapping.register('server', 'cn', None, univention.admin.mapping.ListToString)
75
mapping.register('server', 'cn', None, univention.admin.mapping.ListToString)
75
76
76
from .__common import add_dhcp_options
77
from .__common import add_dhcp_options
 Lines 78-89   add_dhcp_options(__name__) Link Here 
78
79
79
80
80
class object(univention.admin.handlers.simpleLdap):
81
class object(univention.admin.handlers.simpleLdap):
81
	module=module
82
	module = module
82
83
83
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
84
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes=[]):
84
		self.superordinate=superordinate
85
		self.superordinate = superordinate
85
		self.mapping=mapping
86
		self.mapping = mapping
86
		self.descriptions=property_descriptions
87
		self.descriptions = property_descriptions
87
88
88
		if not superordinate:
89
		if not superordinate:
89
			raise univention.admin.uexceptions.insufficientInformation, 'superordinate object not present'
90
			raise univention.admin.uexceptions.insufficientInformation, 'superordinate object not present'
 Lines 93-102   class object(univention.admin.handlers.simpleLdap): Link Here 
93
		super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes)
94
		super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes)
94
95
95
	def _ldap_pre_create(self):
96
	def _ldap_pre_create(self):
96
		self.dn='%s=%s,%s' % (mapping.mapName('server'), mapping.mapValue('server', self.info['server']), self.position.getDn())
97
		self.dn = '%s=%s,%s' % (
98
			mapping.mapName('server'),
99
			mapping.mapValue('server', self.info['server']),
100
			self.position.getDn()
101
		)
97
102
98
	def _ldap_addlist(self):
103
	def _ldap_addlist(self):
99
		searchBase=self.position.getDomain()
104
		searchBase = self.position.getDomain()
100
		if self.lo.searchDn(base=searchBase, filter='(&(objectClass=dhcpServer)(cn=%s))' % (self.info['server'])):
105
		if self.lo.searchDn(base=searchBase, filter='(&(objectClass=dhcpServer)(cn=%s))' % (self.info['server'])):
101
			raise univention.admin.uexceptions.dhcpServerAlreadyUsed, self.info['server']
106
			raise univention.admin.uexceptions.dhcpServerAlreadyUsed, self.info['server']
102
107
 Lines 104-120   class object(univention.admin.handlers.simpleLdap): Link Here 
104
			('objectClass', ['top', 'dhcpServer']),
109
			('objectClass', ['top', 'dhcpServer']),
105
			('dhcpServiceDN', self.superordinate.dn),
110
			('dhcpServiceDN', self.superordinate.dn),
106
		]
111
		]
112
107
	def _ldap_post_move(self, olddn):
113
	def _ldap_post_move(self, olddn):
108
		'''edit dhcpServiceDN'''
114
		'''edit dhcpServiceDN'''
109
		oldServiceDN=self.lo.getAttr(self.dn, 'dhcpServiceDN')
115
		oldServiceDN = self.lo.getAttr(self.dn, 'dhcpServiceDN')
110
		module=univention.admin.modules.identifyOne(self.position.getDn(), self.lo.get(self.position.getDn()))
116
		module = univention.admin.modules.identifyOne(self.position.getDn(), self.lo.get(self.position.getDn()))
111
		object=univention.admin.objects.get(module, None, self.lo, self.position, dn=self.position.getDn())
117
		object = univention.admin.objects.get(module, None, self.lo, self.position, dn=self.position.getDn())
112
		shadow_module, shadow_object=univention.admin.objects.shadow(self.lo, module, object, self.position)
118
		shadow_module, shadow_object = univention.admin.objects.shadow(self.lo, module, object, self.position)
113
		self.lo.modify(self.dn, [('dhcpServiceDN', oldServiceDN[0], shadow_object.dn)])
119
		self.lo.modify(self.dn, [('dhcpServiceDN', oldServiceDN[0], shadow_object.dn)])
114
120
121
115
def lookup_filter(filter_s=None, lo=None):
122
def lookup_filter(filter_s=None, lo=None):
116
	filter_obj=univention.admin.filter.conjunction('&', [
123
	filter_obj = univention.admin.filter.conjunction('&', [
117
	univention.admin.filter.expression('objectClass', 'dhcpServer')
124
		univention.admin.filter.expression('objectClass', 'dhcpServer')
118
	])
125
	])
119
	filter_obj.append_unmapped_filter_string(filter_s, univention.admin.mapping.mapRewrite, mapping)
126
	filter_obj.append_unmapped_filter_string(filter_s, univention.admin.mapping.mapRewrite, mapping)
120
	return filter_obj
127
	return filter_obj
 Lines 132-137   def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, Link Here 
132
	]
139
	]
133
	return res
140
	return res
134
141
135
def identify(dn, attr):
136
142
143
def identify(dn, attr):
137
	return 'dhcpServer' in attr.get('objectClass', [])
144
	return 'dhcpServer' in attr.get('objectClass', [])
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py (-31 / +37 lines)
 Lines 35-74   import univention.admin.filter Link Here 
35
import univention.admin.handlers
35
import univention.admin.handlers
36
import univention.admin.localization
36
import univention.admin.localization
37
37
38
translation=univention.admin.localization.translation('univention.admin.handlers.dhcp')
38
translation = univention.admin.localization.translation('univention.admin.handlers.dhcp')
39
_=translation.translate
39
_ = translation.translate
40
40
41
module='dhcp/service'
41
module = 'dhcp/service'
42
operations=['add','edit','remove','search']
42
operations = ['add', 'edit', 'remove', 'search']
43
childs=1
43
childs = 1
44
usewizard=1
44
usewizard = 1
45
short_description=_('DHCP: Service')
45
short_description = _('DHCP: Service')
46
long_description=''
46
long_description = ''
47
options={
47
48
options = {
48
}
49
}
49
property_descriptions={
50
51
property_descriptions = {
50
	'service': univention.admin.property(
52
	'service': univention.admin.property(
51
			short_description=_('Service name'),
53
		short_description=_('Service name'),
52
			long_description='',
54
		long_description='',
53
			syntax=univention.admin.syntax.string,
55
		syntax=univention.admin.syntax.string,
54
			multivalue=0,
56
		multivalue=0,
55
			include_in_default_search=1,
57
		include_in_default_search=1,
56
			options=[],
58
		options=[],
57
			required=1,
59
		required=1,
58
			may_change=0,
60
		may_change=0,
59
			identifies=1
61
		identifies=1
60
		),
62
	),
61
}
63
}
62
64
63
layout = [
65
layout = [
64
	Tab( _( 'General' ), _( 'Basic settings' ), layout = [
66
	Tab(_('General'), _('Basic settings'), layout=[
65
		Group( _( 'General' ), layout = [
67
		Group(_('General'), layout=[
66
			'service',
68
			'service',
67
		] ),
69
		]),
68
	] ),
70
	]),
69
]
71
]
70
72
71
mapping=univention.admin.mapping.mapping()
73
mapping = univention.admin.mapping.mapping()
72
mapping.register('service', 'cn', None, univention.admin.mapping.ListToString)
74
mapping.register('service', 'cn', None, univention.admin.mapping.ListToString)
73
75
74
from .__common import add_dhcp_options, DhcpOptions
76
from .__common import add_dhcp_options, DhcpOptions
 Lines 76-86   add_dhcp_options(__name__) Link Here 
76
78
77
79
78
class object(DhcpOptions):
80
class object(DhcpOptions):
79
	module=module
81
	module = module
80
82
81
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
83
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes=[]):
82
		self.mapping=mapping
84
		self.mapping = mapping
83
		self.descriptions=property_descriptions
85
		self.descriptions = property_descriptions
84
86
85
		if not dn and not position:
87
		if not dn and not position:
86
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
88
			raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present'
 Lines 89-95   class object(DhcpOptions): Link Here 
89
		self.setup_options(options)
91
		self.setup_options(options)
90
92
91
	def _ldap_pre_create(self):
93
	def _ldap_pre_create(self):
92
		self.dn='%s=%s,%s' % (mapping.mapName('service'), mapping.mapValue('service', self.info['service']), self.position.getDn())
94
		self.dn = '%s=%s,%s' % (
95
			mapping.mapName('service'),
96
			mapping.mapValue('service', self.info['service']),
97
			self.position.getDn()
98
		)
93
99
94
	def _ldap_addlist(self):
100
	def _ldap_addlist(self):
95
		return [
101
		return [
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py (-33 / +37 lines)
 Lines 36-75   import univention.admin.handlers Link Here 
36
import univention.admin.ipaddress
36
import univention.admin.ipaddress
37
import univention.admin.localization
37
import univention.admin.localization
38
38
39
translation=univention.admin.localization.translation('univention.admin.handlers.dhcp')
39
translation = univention.admin.localization.translation('univention.admin.handlers.dhcp')
40
_=translation.translate
40
_ = translation.translate
41
41
42
module='dhcp/shared'
42
module = 'dhcp/shared'
43
operations=['add','edit','remove','search']
43
operations = ['add', 'edit', 'remove', 'search']
44
superordinate='dhcp/service'
44
superordinate = 'dhcp/service'
45
childs=1
45
childs = 1
46
short_description=_('DHCP: Shared network')
46
short_description = _('DHCP: Shared network')
47
long_description=''
47
long_description = ''
48
options={
48
49
options = {
49
}
50
}
50
property_descriptions={
51
52
property_descriptions = {
51
	'name': univention.admin.property(
53
	'name': univention.admin.property(
52
			short_description=_('Shared network name'),
54
		short_description=_('Shared network name'),
53
			long_description='',
55
		long_description='',
54
			syntax=univention.admin.syntax.uid,
56
		syntax=univention.admin.syntax.uid,
55
			multivalue=0,
57
		multivalue=0,
56
			include_in_default_search=1,
58
		include_in_default_search=1,
57
			options=[],
59
		options=[],
58
			required=1,
60
		required=1,
59
			may_change=0,
61
		may_change=0,
60
			identifies=1
62
		identifies=1
61
		)
63
	)
62
}
64
}
63
65
64
layout = [
66
layout = [
65
	Tab( _( 'General' ), _( 'Basic settings' ), layout = [
67
	Tab(_('General'), _('Basic settings'), layout=[
66
		Group( _( 'General' ), layout = [
68
		Group(_('General'), layout=[
67
			'name'
69
			'name'
68
		] ),
70
		]),
69
	] ),
71
	]),
70
]
72
]
71
73
72
mapping=univention.admin.mapping.mapping()
74
mapping = univention.admin.mapping.mapping()
73
mapping.register('name', 'cn', None, univention.admin.mapping.ListToString)
75
mapping.register('name', 'cn', None, univention.admin.mapping.ListToString)
74
76
75
from .__common import add_dhcp_options, DhcpOptions
77
from .__common import add_dhcp_options, DhcpOptions
 Lines 77-87   add_dhcp_options(__name__) Link Here 
77
79
78
80
79
class object(DhcpOptions):
81
class object(DhcpOptions):
80
	module=module
82
	module = module
81
83
82
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
84
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes=[]):
83
		self.mapping=mapping
85
		self.mapping = mapping
84
		self.descriptions=property_descriptions
86
		self.descriptions = property_descriptions
85
87
86
		if not superordinate:
88
		if not superordinate:
87
			raise univention.admin.uexceptions.insufficientInformation, 'superordinate object not present'
89
			raise univention.admin.uexceptions.insufficientInformation, 'superordinate object not present'
 Lines 92-98   class object(DhcpOptions): Link Here 
92
		self.setup_options(options)
94
		self.setup_options(options)
93
95
94
	def _ldap_pre_create(self):
96
	def _ldap_pre_create(self):
95
		self.dn='%s=%s,%s' % (mapping.mapName('name'), mapping.mapValue('name', self.info['name']), self.position.getDn())
97
		self.dn = '%s=%s,%s' % (
98
			mapping.mapName('name'),
99
			mapping.mapValue('name', self.info['name']),
100
			self.position.getDn(),
101
		)
96
102
97
	def _ldap_addlist(self):
103
	def _ldap_addlist(self):
98
		return [
104
		return [
 Lines 114-119   lookup = object.lookup Link Here 
114
120
115
121
116
def identify(dn, attr):
122
def identify(dn, attr):
117
	
118
	return 'dhcpSharedNetwork' in attr.get('objectClass', [])
123
	return 'dhcpSharedNetwork' in attr.get('objectClass', [])
119
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py (-60 / +66 lines)
 Lines 36-110   import univention.admin.handlers Link Here 
36
import univention.admin.ipaddress
36
import univention.admin.ipaddress
37
import univention.admin.localization
37
import univention.admin.localization
38
38
39
translation=univention.admin.localization.translation('univention.admin.handlers.dhcp')
39
translation = univention.admin.localization.translation('univention.admin.handlers.dhcp')
40
_=translation.translate
40
_ = translation.translate
41
41
42
module='dhcp/sharedsubnet'
42
module = 'dhcp/sharedsubnet'
43
operations=['add','edit','remove','search']
43
operations = ['add', 'edit', 'remove', 'search']
44
superordinate='dhcp/shared'
44
superordinate = 'dhcp/shared'
45
childs=1
45
childs = 1
46
short_description=_('DHCP: Shared subnet')
46
short_description = _('DHCP: Shared subnet')
47
long_description=''
47
long_description = ''
48
options={
48
49
options = {
49
}
50
}
50
property_descriptions={
51
52
property_descriptions = {
51
	'subnet': univention.admin.property(
53
	'subnet': univention.admin.property(
52
			short_description=_('Subnet address'),
54
		short_description=_('Subnet address'),
53
			long_description='',
55
		long_description='',
54
			syntax=univention.admin.syntax.ipv4Address,
56
		syntax=univention.admin.syntax.ipv4Address,
55
			multivalue=0,
57
		multivalue=0,
56
			include_in_default_search=1,
58
		include_in_default_search=1,
57
			options=[],
59
		options=[],
58
			required=1,
60
		required=1,
59
			may_change=0,
61
		may_change=0,
60
			identifies=1
62
		identifies=1
61
		),
63
	),
62
	'subnetmask': univention.admin.property(
64
	'subnetmask': univention.admin.property(
63
			short_description=_('Netmask'),
65
		short_description=_('Netmask'),
64
			long_description='',
66
		long_description='',
65
			syntax=univention.admin.syntax.v4netmask,
67
		syntax=univention.admin.syntax.v4netmask,
66
			multivalue=0,
68
		multivalue=0,
67
			options=[],
69
		options=[],
68
			required=1,
70
		required=1,
69
			may_change=1,
71
		may_change=1,
70
			identifies=0
72
		identifies=0
71
		),
73
	),
72
	'broadcastaddress': univention.admin.property(
74
	'broadcastaddress': univention.admin.property(
73
			short_description=_('Broadcast address'),
75
		short_description=_('Broadcast address'),
74
			long_description='',
76
		long_description='',
75
			syntax=univention.admin.syntax.ipv4Address,
77
		syntax=univention.admin.syntax.ipv4Address,
76
			multivalue=0,
78
		multivalue=0,
77
			options=[],
79
		options=[],
78
			required=0,
80
		required=0,
79
			may_change=1,
81
		may_change=1,
80
			identifies=0
82
		identifies=0
81
		),
83
	),
82
	'range': univention.admin.property(
84
	'range': univention.admin.property(
83
			short_description=_('Dynamic address assignment'),
85
		short_description=_('Dynamic address assignment'),
84
			long_description=_( 'Define a pool of addresses available for dynamic address assignment.'),
86
		long_description=_('Define a pool of addresses available for dynamic address assignment.'),
85
			syntax=univention.admin.syntax.IPv4_AddressRange,
87
		syntax=univention.admin.syntax.IPv4_AddressRange,
86
			multivalue=1,
88
		multivalue=1,
87
			options=[],
89
		options=[],
88
			required=0,
90
		required=0,
89
			may_change=1,
91
		may_change=1,
90
			identifies=0
92
		identifies=0
91
		),
93
	),
92
}
94
}
93
95
94
layout = [
96
layout = [
95
	Tab(_('General'), _('Basic settings'), layout = [
97
	Tab(_('General'), _('Basic settings'), layout=[
96
		Group( _( 'General' ), layout = [
98
		Group(_('General'), layout=[
97
			[ 'subnet', 'subnetmask' ],
99
			['subnet', 'subnetmask'],
98
			'broadcastaddress',
100
			'broadcastaddress',
99
			'range'
101
			'range'
100
		] ),
102
		]),
101
	] ),
103
	]),
102
]
104
]
103
105
104
106
105
from .__common import rangeMap, rangeUnmap, add_dhcp_options, DhcpOptions
107
from .__common import rangeMap, rangeUnmap, add_dhcp_options, DhcpOptions
106
108
107
mapping=univention.admin.mapping.mapping()
109
mapping = univention.admin.mapping.mapping()
108
mapping.register('subnet', 'cn', None, univention.admin.mapping.ListToString)
110
mapping.register('subnet', 'cn', None, univention.admin.mapping.ListToString)
109
mapping.register('range', 'dhcpRange', rangeMap, rangeUnmap)
111
mapping.register('range', 'dhcpRange', rangeMap, rangeUnmap)
110
mapping.register('subnetmask', 'dhcpNetMask', None, univention.admin.mapping.ListToString)
112
mapping.register('subnetmask', 'dhcpNetMask', None, univention.admin.mapping.ListToString)
 Lines 114-125   add_dhcp_options(__name__) Link Here 
114
116
115
117
116
class object(DhcpOptions):
118
class object(DhcpOptions):
117
	module=module
119
	module = module
118
120
119
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
121
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes=[]):
120
		self.superordinate=superordinate
122
		self.superordinate = superordinate
121
		self.mapping=mapping
123
		self.mapping = mapping
122
		self.descriptions=property_descriptions
124
		self.descriptions = property_descriptions
123
125
124
		if not superordinate:
126
		if not superordinate:
125
			raise univention.admin.uexceptions.insufficientInformation, 'superordinate object not present'
127
			raise univention.admin.uexceptions.insufficientInformation, 'superordinate object not present'
 Lines 130-136   class object(DhcpOptions): Link Here 
130
		self.setup_options(options)
132
		self.setup_options(options)
131
133
132
	def _ldap_pre_create(self):
134
	def _ldap_pre_create(self):
133
		self.dn='%s=%s,%s' % (mapping.mapName('subnet'), mapping.mapValue('subnet', self.info['subnet']), self.position.getDn())
135
		self.dn = '%s=%s,%s' % (
136
			mapping.mapName('subnet'),
137
			mapping.mapValue('subnet', self.info['subnet']),
138
			self.position.getDn()
139
		)
134
140
135
	def _ldap_addlist(self):
141
	def _ldap_addlist(self):
136
		return [
142
		return [
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py (-66 / +69 lines)
 Lines 36-110   import univention.admin.handlers Link Here 
36
import univention.admin.ipaddress
36
import univention.admin.ipaddress
37
import univention.admin.localization
37
import univention.admin.localization
38
38
39
translation=univention.admin.localization.translation('univention.admin.handlers.dhcp')
39
translation = univention.admin.localization.translation('univention.admin.handlers.dhcp')
40
_=translation.translate
40
_ = translation.translate
41
41
42
module='dhcp/subnet'
42
module = 'dhcp/subnet'
43
operations=['add','edit','remove','search']
43
operations = ['add', 'edit', 'remove', 'search']
44
superordinate='dhcp/service'
44
superordinate = 'dhcp/service'
45
childs=1
45
childs = 1
46
usewizard=1
46
usewizard = 1
47
short_description=_('DHCP: Subnet')
47
short_description = _('DHCP: Subnet')
48
long_description=''
48
long_description = ''
49
options={
49
50
options = {
50
}
51
}
51
property_descriptions={
52
53
property_descriptions = {
52
	'subnet': univention.admin.property(
54
	'subnet': univention.admin.property(
53
			short_description=_('Subnet address'),
55
		short_description=_('Subnet address'),
54
			long_description='',
56
		long_description='',
55
			syntax=univention.admin.syntax.ipv4Address,
57
		syntax=univention.admin.syntax.ipv4Address,
56
			multivalue=0,
58
		multivalue=0,
57
			include_in_default_search=1,
59
		include_in_default_search=1,
58
			options=[],
60
		options=[],
59
			required=1,
61
		required=1,
60
			may_change=0,
62
		may_change=0,
61
			identifies=1
63
		identifies=1
62
		),
64
	),
63
	'subnetmask': univention.admin.property(
65
	'subnetmask': univention.admin.property(
64
			short_description=_('Netmask'),
66
		short_description=_('Netmask'),
65
			long_description='',
67
		long_description='',
66
			syntax=univention.admin.syntax.v4netmask,
68
		syntax=univention.admin.syntax.v4netmask,
67
			multivalue=0,
69
		multivalue=0,
68
			options=[],
70
		options=[],
69
			required=1,
71
		required=1,
70
			may_change=1,
72
		may_change=1,
71
			identifies=0
73
		identifies=0
72
		),
74
	),
73
	'broadcastaddress': univention.admin.property(
75
	'broadcastaddress': univention.admin.property(
74
			short_description=_('Broadcast address'),
76
		short_description=_('Broadcast address'),
75
			long_description='',
77
		long_description='',
76
			syntax=univention.admin.syntax.ipv4Address,
78
		syntax=univention.admin.syntax.ipv4Address,
77
			multivalue=0,
79
		multivalue=0,
78
			options=[],
80
		options=[],
79
			required=0,
81
		required=0,
80
			may_change=1,
82
		may_change=1,
81
			identifies=0
83
		identifies=0
82
		),
84
	),
83
	'range': univention.admin.property(
85
	'range': univention.admin.property(
84
			short_description=_('Dynamic address assignment'),
86
		short_description=_('Dynamic address assignment'),
85
			long_description=_( 'Define a pool of addresses available for dynamic address assignment.' ),
87
		long_description=_('Define a pool of addresses available for dynamic address assignment.'),
86
			syntax=univention.admin.syntax.IPv4_AddressRange,
88
		syntax=univention.admin.syntax.IPv4_AddressRange,
87
			multivalue=1,
89
		multivalue=1,
88
			options=[],
90
		options=[],
89
			required=0,
91
		required=0,
90
			may_change=1,
92
		may_change=1,
91
			identifies=0
93
		identifies=0
92
		),
94
	),
93
}
95
}
94
96
95
layout = [
97
layout = [
96
	Tab( _( 'General' ), _('Basic settings'), layout = [
98
	Tab(_('General'), _('Basic settings'), layout=[
97
		Group( _( 'General' ), layout = [
99
		Group(_('General'), layout=[
98
			[ 'subnet', 'subnetmask' ],
100
			['subnet', 'subnetmask'],
99
			'broadcastaddress',
101
			'broadcastaddress',
100
			'range'
102
			'range'
101
		] ),
103
		]),
102
	] ),
104
	]),
103
]
105
]
104
106
105
from .__common import rangeUnmap, add_dhcp_options, DhcpOptions
107
from .__common import rangeUnmap, add_dhcp_options, DhcpOptions
106
108
107
mapping=univention.admin.mapping.mapping()
109
mapping = univention.admin.mapping.mapping()
108
mapping.register('subnet', 'cn', None, univention.admin.mapping.ListToString)
110
mapping.register('subnet', 'cn', None, univention.admin.mapping.ListToString)
109
mapping.register('subnetmask', 'dhcpNetMask', None, univention.admin.mapping.ListToString)
111
mapping.register('subnetmask', 'dhcpNetMask', None, univention.admin.mapping.ListToString)
110
mapping.register('broadcastaddress', 'univentionDhcpBroadcastAddress', None, univention.admin.mapping.ListToString)
112
mapping.register('broadcastaddress', 'univentionDhcpBroadcastAddress', None, univention.admin.mapping.ListToString)
 Lines 113-124   add_dhcp_options(__name__) Link Here 
113
115
114
116
115
class object(DhcpOptions):
117
class object(DhcpOptions):
116
	module=module
118
	module = module
117
119
118
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ):
120
	def __init__(self, co, lo, position, dn='', superordinate=None, attributes=[]):
119
		self.superordinate=superordinate
121
		self.superordinate = superordinate
120
		self.mapping=mapping
122
		self.mapping = mapping
121
		self.descriptions=property_descriptions
123
		self.descriptions = property_descriptions
122
124
123
		if not superordinate:
125
		if not superordinate:
124
			raise univention.admin.uexceptions.insufficientInformation, 'superordinate object not present'
126
			raise univention.admin.uexceptions.insufficientInformation, 'superordinate object not present'
 Lines 133-151   class object(DhcpOptions): Link Here 
133
		self.info['range'] = self.oldinfo['range'] = rangeUnmap(self.oldattr.get('dhcpRange', []))
135
		self.info['range'] = self.oldinfo['range'] = rangeUnmap(self.oldattr.get('dhcpRange', []))
134
136
135
	def _ldap_pre_create(self):
137
	def _ldap_pre_create(self):
136
		self.dn='%s=%s,%s' % (mapping.mapName('subnet'), mapping.mapValue('subnet', self.info['subnet']), self.position.getDn())
138
		self.dn = '%s=%s,%s' % (
139
			mapping.mapName('subnet'),
140
			mapping.mapValue('subnet', self.info['subnet']),
141
			self.position.getDn()
142
		)
137
143
138
	def _ldap_addlist(self):
144
	def _ldap_addlist(self):
139
		return [
145
		return [
140
			( 'objectClass', [ 'top', 'univentionDhcpSubnet' ] ),
146
			('objectClass', ['top', 'univentionDhcpSubnet']),
141
		]
147
		]
142
148
143
	def _ldap_modlist(self):
149
	def _ldap_modlist(self):
144
145
		ml = super(object, self)._ldap_modlist()
150
		ml = super(object, self)._ldap_modlist()
146
151
147
		if self.hasChanged('range'):
152
		if self.hasChanged('range'):
148
			dhcpRange=[]
153
			dhcpRange = []
149
			for i in self['range']:
154
			for i in self['range']:
150
				for j in self['range']:
155
				for j in self['range']:
151
					if i != j and univention.admin.ipaddress.is_range_overlapping(i, j):
156
					if i != j and univention.admin.ipaddress.is_range_overlapping(i, j):
152
- 
153
--
154
.../univention/admin/handlers/dhcp/__common.py     |  4 +-
157
.../univention/admin/handlers/dhcp/__common.py     |  4 +-
155
.../modules/univention/admin/handlers/dhcp/dhcp.py | 10 ++--
158
.../modules/univention/admin/handlers/dhcp/dhcp.py | 10 ++--
156
.../modules/univention/admin/handlers/dhcp/host.py | 26 +++++-----
159
.../modules/univention/admin/handlers/dhcp/host.py | 26 +++++-----
157
.../modules/univention/admin/handlers/dhcp/pool.py | 58 +++++++++++-----------
160
.../modules/univention/admin/handlers/dhcp/pool.py | 58 +++++++++++-----------
158
.../univention/admin/handlers/dhcp/server.py       | 10 ++--
161
.../univention/admin/handlers/dhcp/server.py       | 10 ++--
159
.../univention/admin/handlers/dhcp/service.py      | 10 ++--
162
.../univention/admin/handlers/dhcp/service.py      | 10 ++--
160
.../univention/admin/handlers/dhcp/shared.py       | 10 ++--
163
.../univention/admin/handlers/dhcp/shared.py       | 10 ++--
161
.../univention/admin/handlers/dhcp/sharedsubnet.py | 34 ++++++-------
164
.../univention/admin/handlers/dhcp/sharedsubnet.py | 34 ++++++-------
162
.../univention/admin/handlers/dhcp/subnet.py       | 34 ++++++-------
165
.../univention/admin/handlers/dhcp/subnet.py       | 34 ++++++-------
163
9 files changed, 98 insertions(+), 98 deletions(-)
166
9 files changed, 98 insertions(+), 98 deletions(-)
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py (-2 / +2 lines)
 Lines 57-65   _properties = { Link Here 
57
		syntax=univention.admin.syntax.string,
57
		syntax=univention.admin.syntax.string,
58
		multivalue=True,
58
		multivalue=True,
59
		options=["options"],
59
		options=["options"],
60
		required = 0,
60
		required=False,
61
		may_change=True,
61
		may_change=True,
62
		identifies = 0
62
		identifies=False,
63
	),
63
	),
64
}
64
}
65
65
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/dhcp.py (-5 / +5 lines)
 Lines 88-99   property_descriptions = { Link Here 
88
		short_description=_('Name'),
88
		short_description=_('Name'),
89
		long_description='',
89
		long_description='',
90
		syntax=univention.admin.syntax.string,
90
		syntax=univention.admin.syntax.string,
91
		multivalue=0,
91
		multivalue=False,
92
		include_in_default_search=1,
92
		include_in_default_search=True,
93
		options=[],
93
		options=[],
94
		required=1,
94
		required=True,
95
		may_change=1,
95
		may_change=True,
96
		identifies=1
96
		identifies=True
97
	)
97
	)
98
}
98
}
99
99
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py (-13 / +13 lines)
 Lines 55-66   property_descriptions = { Link Here 
55
		short_description=_('Hostname'),
55
		short_description=_('Hostname'),
56
		long_description='',
56
		long_description='',
57
		syntax=univention.admin.syntax.string,
57
		syntax=univention.admin.syntax.string,
58
		multivalue=0,
58
		multivalue=False,
59
		include_in_default_search=1,
59
		include_in_default_search=True,
60
		options=[],
60
		options=[],
61
		required=1,
61
		required=True,
62
		may_change=1,
62
		may_change=True,
63
		identifies=1
63
		identifies=True
64
	),
64
	),
65
	'hwaddress': univention.admin.property(
65
	'hwaddress': univention.admin.property(
66
		short_description=_('Hardware address'),
66
		short_description=_('Hardware address'),
 Lines 68-78   property_descriptions = { Link Here 
68
			'Currently, only the ethernet and token-ring types are recognized.'
68
			'Currently, only the ethernet and token-ring types are recognized.'
69
			'The hardware-address should be a set of hexadecimal octets (numbers from 0 through ff) separated by colons.'),
69
			'The hardware-address should be a set of hexadecimal octets (numbers from 0 through ff) separated by colons.'),
70
		syntax=univention.admin.syntax.DHCP_HardwareAddress,
70
		syntax=univention.admin.syntax.DHCP_HardwareAddress,
71
		multivalue=0,
71
		multivalue=False,
72
		options=[],
72
		options=[],
73
		required=1,
73
		required=True,
74
		may_change=1,
74
		may_change=True,
75
		identifies=0
75
		identifies=False
76
	),
76
	),
77
	'fixedaddress': univention.admin.property(
77
	'fixedaddress': univention.admin.property(
78
		short_description=_('Fixed IP addresses'),
78
		short_description=_('Fixed IP addresses'),
 Lines 80-90   property_descriptions = { Link Here 
80
			'Assign one or more fixed IP addresses.'
80
			'Assign one or more fixed IP addresses.'
81
			'Each address should be either an IP address or a domain name that resolves to one or more IP addresses'),
81
			'Each address should be either an IP address or a domain name that resolves to one or more IP addresses'),
82
		syntax=univention.admin.syntax.string,
82
		syntax=univention.admin.syntax.string,
83
		multivalue=1,
83
		multivalue=True,
84
		options=[],
84
		options=[],
85
		required=0,
85
		required=False,
86
		may_change=1,
86
		may_change=True,
87
		identifies=0
87
		identifies=False
88
	),
88
	),
89
}
89
}
90
90
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py (-29 / +29 lines)
 Lines 57-108   property_descriptions = { Link Here 
57
		short_description=_('Name'),
57
		short_description=_('Name'),
58
		long_description=_('A unique name used to identify this pool, e.g. "known" or "guests"'),
58
		long_description=_('A unique name used to identify this pool, e.g. "known" or "guests"'),
59
		syntax=univention.admin.syntax.string,
59
		syntax=univention.admin.syntax.string,
60
		multivalue=0,
60
		multivalue=False,
61
		include_in_default_search=1,
61
		include_in_default_search=True,
62
		options=[],
62
		options=[],
63
		required=1,
63
		required=True,
64
		may_change=0,
64
		may_change=False,
65
		identifies=1
65
		identifies=True
66
	),
66
	),
67
	'range': univention.admin.property(
67
	'range': univention.admin.property(
68
		short_description=_('IP range for dynamic assignment'),
68
		short_description=_('IP range for dynamic assignment'),
69
		long_description='',
69
		long_description='',
70
		syntax=univention.admin.syntax.IPv4_AddressRange,
70
		syntax=univention.admin.syntax.IPv4_AddressRange,
71
		multivalue=1,
71
		multivalue=True,
72
		options=[],
72
		options=[],
73
		required=1,
73
		required=True,
74
		may_change=1,
74
		may_change=True,
75
		identifies=0
75
		identifies=False
76
	),
76
	),
77
	'failover_peer': univention.admin.property(
77
	'failover_peer': univention.admin.property(
78
		short_description=_('Failover peer'),
78
		short_description=_('Failover peer'),
79
		long_description=_('The name of a failover configuration manually configured in /etc/dhcp/local.conf.'),
79
		long_description=_('The name of a failover configuration manually configured in /etc/dhcp/local.conf.'),
80
		syntax=univention.admin.syntax.string,
80
		syntax=univention.admin.syntax.string,
81
		multivalue=0,
81
		multivalue=False,
82
		options=[],
82
		options=[],
83
		required=0,
83
		required=False,
84
		may_change=1,
84
		may_change=True,
85
		identifies=0,
85
		identifies=False,
86
	),
86
	),
87
	'known_clients': univention.admin.property(
87
	'known_clients': univention.admin.property(
88
		short_description=_('Give IP to known clients'),
88
		short_description=_('Give IP to known clients'),
89
		long_description=_('Addresses are allocated for client, which have a host entry matching their MAC address.'),
89
		long_description=_('Addresses are allocated for client, which have a host entry matching their MAC address.'),
90
		syntax=univention.admin.syntax.AllowDeny,
90
		syntax=univention.admin.syntax.AllowDeny,
91
		multivalue=0,
91
		multivalue=False,
92
		options=[],
92
		options=[],
93
		required=0,
93
		required=False,
94
		may_change=1,
94
		may_change=True,
95
		identifies=0
95
		identifies=False
96
	),
96
	),
97
	'unknown_clients': univention.admin.property(
97
	'unknown_clients': univention.admin.property(
98
		short_description=_('Give IP to unknown clients'),
98
		short_description=_('Give IP to unknown clients'),
99
		long_description=_('Addresses are allocated for clients, which do not have a host entry mating their MAC address.'),
99
		long_description=_('Addresses are allocated for clients, which do not have a host entry mating their MAC address.'),
100
		syntax=univention.admin.syntax.AllowDeny,
100
		syntax=univention.admin.syntax.AllowDeny,
101
		multivalue=0,
101
		multivalue=False,
102
		options=[],
102
		options=[],
103
		required=0,
103
		required=False,
104
		may_change=1,
104
		may_change=True,
105
		identifies=0
105
		identifies=False
106
	),
106
	),
107
	'dynamic_bootp_clients': univention.admin.property(
107
	'dynamic_bootp_clients': univention.admin.property(
108
		short_description=_('Give IP to dynamic BOOTP clients'),
108
		short_description=_('Give IP to dynamic BOOTP clients'),
 Lines 110-130   property_descriptions = { Link Here 
110
			'Give addresses to clients using the legacy BOOTP protocol.'
110
			'Give addresses to clients using the legacy BOOTP protocol.'
111
			'Since BOOTP does not support an expiry date or a release mechanism, addresses are allocated indefinitely!'),
111
			'Since BOOTP does not support an expiry date or a release mechanism, addresses are allocated indefinitely!'),
112
		syntax=univention.admin.syntax.AllowDeny,
112
		syntax=univention.admin.syntax.AllowDeny,
113
		multivalue=0,
113
		multivalue=False,
114
		options=[],
114
		options=[],
115
		required=0,
115
		required=False,
116
		may_change=1,
116
		may_change=True,
117
		identifies=0
117
		identifies=False
118
	),
118
	),
119
	'all_clients': univention.admin.property(
119
	'all_clients': univention.admin.property(
120
		short_description=_('Give IP from this pool'),
120
		short_description=_('Give IP from this pool'),
121
		long_description=_('Give addresses from this pool at all or not.'),
121
		long_description=_('Give addresses from this pool at all or not.'),
122
		syntax=univention.admin.syntax.AllowDeny,
122
		syntax=univention.admin.syntax.AllowDeny,
123
		multivalue=0,
123
		multivalue=False,
124
		options=[],
124
		options=[],
125
		required=0,
125
		required=False,
126
		may_change=1,
126
		may_change=True,
127
		identifies=0
127
		identifies=False
128
	),
128
	),
129
}
129
}
130
130
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py (-5 / +5 lines)
 Lines 54-65   property_descriptions = { Link Here 
54
		short_description=_('Server name'),
54
		short_description=_('Server name'),
55
		long_description='',
55
		long_description='',
56
		syntax=univention.admin.syntax.string,
56
		syntax=univention.admin.syntax.string,
57
		multivalue=0,
57
		multivalue=False,
58
		include_in_default_search=1,
58
		include_in_default_search=True,
59
		options=[],
59
		options=[],
60
		required=1,
60
		required=True,
61
		may_change=1,
61
		may_change=True,
62
		identifies=1
62
		identifies=True
63
	),
63
	),
64
}
64
}
65
65
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py (-5 / +5 lines)
 Lines 53-64   property_descriptions = { Link Here 
53
		short_description=_('Service name'),
53
		short_description=_('Service name'),
54
		long_description='',
54
		long_description='',
55
		syntax=univention.admin.syntax.string,
55
		syntax=univention.admin.syntax.string,
56
		multivalue=0,
56
		multivalue=False,
57
		include_in_default_search=1,
57
		include_in_default_search=True,
58
		options=[],
58
		options=[],
59
		required=1,
59
		required=True,
60
		may_change=0,
60
		may_change=False,
61
		identifies=1
61
		identifies=True
62
	),
62
	),
63
}
63
}
64
64
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py (-5 / +5 lines)
 Lines 54-65   property_descriptions = { Link Here 
54
		short_description=_('Shared network name'),
54
		short_description=_('Shared network name'),
55
		long_description='',
55
		long_description='',
56
		syntax=univention.admin.syntax.uid,
56
		syntax=univention.admin.syntax.uid,
57
		multivalue=0,
57
		multivalue=False,
58
		include_in_default_search=1,
58
		include_in_default_search=True,
59
		options=[],
59
		options=[],
60
		required=1,
60
		required=True,
61
		may_change=0,
61
		may_change=False,
62
		identifies=1
62
		identifies=True
63
	)
63
	)
64
}
64
}
65
65
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py (-17 / +17 lines)
 Lines 54-95   property_descriptions = { Link Here 
54
		short_description=_('Subnet address'),
54
		short_description=_('Subnet address'),
55
		long_description='',
55
		long_description='',
56
		syntax=univention.admin.syntax.ipv4Address,
56
		syntax=univention.admin.syntax.ipv4Address,
57
		multivalue=0,
57
		multivalue=False,
58
		include_in_default_search=1,
58
		include_in_default_search=True,
59
		options=[],
59
		options=[],
60
		required=1,
60
		required=True,
61
		may_change=0,
61
		may_change=False,
62
		identifies=1
62
		identifies=True
63
	),
63
	),
64
	'subnetmask': univention.admin.property(
64
	'subnetmask': univention.admin.property(
65
		short_description=_('Netmask'),
65
		short_description=_('Netmask'),
66
		long_description='',
66
		long_description='',
67
		syntax=univention.admin.syntax.v4netmask,
67
		syntax=univention.admin.syntax.v4netmask,
68
		multivalue=0,
68
		multivalue=False,
69
		options=[],
69
		options=[],
70
		required=1,
70
		required=True,
71
		may_change=1,
71
		may_change=True,
72
		identifies=0
72
		identifies=False
73
	),
73
	),
74
	'broadcastaddress': univention.admin.property(
74
	'broadcastaddress': univention.admin.property(
75
		short_description=_('Broadcast address'),
75
		short_description=_('Broadcast address'),
76
		long_description='',
76
		long_description='',
77
		syntax=univention.admin.syntax.ipv4Address,
77
		syntax=univention.admin.syntax.ipv4Address,
78
		multivalue=0,
78
		multivalue=False,
79
		options=[],
79
		options=[],
80
		required=0,
80
		required=False,
81
		may_change=1,
81
		may_change=True,
82
		identifies=0
82
		identifies=False
83
	),
83
	),
84
	'range': univention.admin.property(
84
	'range': univention.admin.property(
85
		short_description=_('Dynamic address assignment'),
85
		short_description=_('Dynamic address assignment'),
86
		long_description=_('Define a pool of addresses available for dynamic address assignment.'),
86
		long_description=_('Define a pool of addresses available for dynamic address assignment.'),
87
		syntax=univention.admin.syntax.IPv4_AddressRange,
87
		syntax=univention.admin.syntax.IPv4_AddressRange,
88
		multivalue=1,
88
		multivalue=True,
89
		options=[],
89
		options=[],
90
		required=0,
90
		required=False,
91
		may_change=1,
91
		may_change=True,
92
		identifies=0
92
		identifies=False
93
	),
93
	),
94
}
94
}
95
95
(-)a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py (-18 / +17 lines)
 Lines 55-96   property_descriptions = { Link Here 
55
		short_description=_('Subnet address'),
55
		short_description=_('Subnet address'),
56
		long_description='',
56
		long_description='',
57
		syntax=univention.admin.syntax.ipv4Address,
57
		syntax=univention.admin.syntax.ipv4Address,
58
		multivalue=0,
58
		multivalue=False,
59
		include_in_default_search=1,
59
		include_in_default_search=True,
60
		options=[],
60
		options=[],
61
		required=1,
61
		required=True,
62
		may_change=0,
62
		may_change=False,
63
		identifies=1
63
		identifies=True
64
	),
64
	),
65
	'subnetmask': univention.admin.property(
65
	'subnetmask': univention.admin.property(
66
		short_description=_('Netmask'),
66
		short_description=_('Netmask'),
67
		long_description='',
67
		long_description='',
68
		syntax=univention.admin.syntax.v4netmask,
68
		syntax=univention.admin.syntax.v4netmask,
69
		multivalue=0,
69
		multivalue=False,
70
		options=[],
70
		options=[],
71
		required=1,
71
		required=True,
72
		may_change=1,
72
		may_change=True,
73
		identifies=0
73
		identifies=False
74
	),
74
	),
75
	'broadcastaddress': univention.admin.property(
75
	'broadcastaddress': univention.admin.property(
76
		short_description=_('Broadcast address'),
76
		short_description=_('Broadcast address'),
77
		long_description='',
77
		long_description='',
78
		syntax=univention.admin.syntax.ipv4Address,
78
		syntax=univention.admin.syntax.ipv4Address,
79
		multivalue=0,
79
		multivalue=False,
80
		options=[],
80
		options=[],
81
		required=0,
81
		required=False,
82
		may_change=1,
82
		may_change=True,
83
		identifies=0
83
		identifies=False
84
	),
84
	),
85
	'range': univention.admin.property(
85
	'range': univention.admin.property(
86
		short_description=_('Dynamic address assignment'),
86
		short_description=_('Dynamic address assignment'),
87
		long_description=_('Define a pool of addresses available for dynamic address assignment.'),
87
		long_description=_('Define a pool of addresses available for dynamic address assignment.'),
88
		syntax=univention.admin.syntax.IPv4_AddressRange,
88
		syntax=univention.admin.syntax.IPv4_AddressRange,
89
		multivalue=1,
89
		multivalue=True,
90
		options=[],
90
		options=[],
91
		required=0,
91
		required=False,
92
		may_change=1,
92
		may_change=True,
93
		identifies=0
93
		identifies=False
94
	),
94
	),
95
}
95
}
96
96
97
- 

Return to bug 33223