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

Collapse All | Expand All

(-)scripts/ip-phone-tool (-13 / +8 lines)
 Lines 42-48    Link Here 
42
import univention.admin.filter
42
import univention.admin.filter
43
import univention.admin.uexceptions
43
import univention.admin.uexceptions
44
import univention.admin.localization
44
import univention.admin.localization
45
import univention.admin.handlers.test.ip_phone
46
from optparse import OptionParser, OptionValueError
45
from optparse import OptionParser, OptionValueError
47
46
48
translation=univention.admin.localization.translation('univention.admin.handlers.test')	## missing in this example
47
translation=univention.admin.localization.translation('univention.admin.handlers.test')	## missing in this example
 Lines 76-96    Link Here 
76
			print 'authentication error: %s' % str(e)
75
			print 'authentication error: %s' % str(e)
77
			sys.exit(1)
76
			sys.exit(1)
78
77
78
		self.position = univention.admin.uldap.position(self.ldap_base)
79
		self.co = univention.admin.config.config()
79
		self.co = univention.admin.config.config()
80
		# Get univention.admin.handlers.test.ip_phone + custom/extended attributes + UCR modificaations
81
		self.module = univention.admin.modules.get('test/ip_phone')
82
		univention.admin.modules.init(self.lo, self.position, self.module)
80
83
81
82
	def set(self, options, name, ip, priuser):
84
	def set(self, options, name, ip, priuser):
83
		"""This uses the lookup function of the udm module, allowing filtering in terms of UDM properties
85
		"""This uses the lookup function of the udm module, allowing filtering in terms of UDM properties
84
		"""
86
		"""
85
87
86
		filter=univention.admin.filter.expression('name', name)
88
		filter=univention.admin.filter.expression('name', name)
87
		position=univention.admin.uldap.position(self.ldap_base)
88
89
89
		objs = univention.admin.handlers.test.ip_phone.lookup(self.co, self.lo, filter, scope='domain', base=position.getDomain(), unique=1)
90
		objs = self.module.lookup(self.co, self.lo, filter, scope='domain', base=self.position.getDomain(), unique=1)
90
		if objs:
91
		if objs:
91
			obj=objs[0]
92
			obj=objs[0]
92
		else:
93
		else:
93
			obj=univention.admin.handlers.test.ip_phone.object(self.co, self.lo, position)
94
			obj = self.module.object(self.co, self.lo, self.position)
94
			obj['name']=name
95
			obj['name']=name
95
96
96
		if not ip == obj['ip']:
97
		if not ip == obj['ip']:
 Lines 115-123    Link Here 
115
		"""remove the object, no safty belt in this example"""
116
		"""remove the object, no safty belt in this example"""
116
117
117
		filter=univention.admin.filter.expression('name', name)
118
		filter=univention.admin.filter.expression('name', name)
118
		position=univention.admin.uldap.position(self.ldap_base)
119
119
120
		objs = univention.admin.handlers.test.ip_phone.lookup(self.co, self.lo, filter, scope='domain', base=position.getDomain(), unique=1)
120
		objs = self.module.lookup(self.co, self.lo, filter, scope='domain', base=self.position.getDomain(), unique=1)
121
		if objs:
121
		if objs:
122
			obj=objs[0]
122
			obj=objs[0]
123
			obj.remove()
123
			obj.remove()
 Lines 132-142    Link Here 
132
				print "No object found matching filter %s" % filter
132
				print "No object found matching filter %s" % filter
133
				sys.exit(1)
133
				sys.exit(1)
134
134
135
			module=univention.admin.modules.get('test/ip_phone')	## retrive the module
135
			object = univention.admin.objects.get(self.module, self.co, self.lo, position=self.position, dn=dn[0])
136
			position=univention.admin.uldap.position(self.ldap_base)
137
			univention.admin.modules.init(self.lo, position, module)	## inititalize it
138
139
			object=univention.admin.objects.get(module, self.co, self.lo, position=position, dn=dn[0])
140
			object.open()						## open the object
136
			object.open()						## open the object
141
137
142
			if 'redirection' in object.options:
138
			if 'redirection' in object.options:
 Lines 198-204    Link Here 
198
		univention.debug.set_level(univention.debug.LDAP, options.debuglevel)
194
		univention.debug.set_level(univention.debug.LDAP, options.debuglevel)
199
		univention.debug.set_level(univention.debug.ADMIN, options.debuglevel)
195
		univention.debug.set_level(univention.debug.ADMIN, options.debuglevel)
200
196
201
202
	ucr = univention.config_registry.ConfigRegistry()
197
	ucr = univention.config_registry.ConfigRegistry()
203
	ucr.load()
198
	ucr.load()
204
199

Return to bug 17915