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

(-)a/management/univention-self-service/umc/python/passwordreset/__init__.py (-5 / +5 lines)
Lines 296-308 def get_user_attributes(self, username, password): Link Here
296
296
297
		user_attributes = [attr.strip() for attr in ucr.get('self-service/udm_attributes', '').split(',')]
297
		user_attributes = [attr.strip() for attr in ucr.get('self-service/udm_attributes', '').split(',')]
298
298
299
		user = self.get_udm_user(username=username)
299
		widget_descriptions = []
300
		widget_descriptions = []
300
		label_overwrites = {
301
		label_overwrites = {
301
			'jpegPhoto': _('Your picture')
302
			'jpegPhoto': _('Your picture')
302
		}
303
		}
303
		for propname in user_attributes:
304
		for propname in user_attributes:
304
			prop = self.usersmod.property_descriptions.get(propname)
305
			prop = self.usersmod.property_descriptions.get(propname)
305
			if not prop:
306
			if not prop or not user.has_property(propname):
306
				continue
307
				continue
307
308
308
			widget_description = {
309
			widget_description = {
Lines 314-319 def get_user_attributes(self, username, password): Link Here
314
				'required': bool(prop.required),
315
				'required': bool(prop.required),
315
				'readonly': not bool(prop.editable),
316
				'readonly': not bool(prop.editable),
316
				'multivalue': bool(prop.multivalue),
317
				'multivalue': bool(prop.multivalue),
318
				'value': user[propname],
317
			}
319
			}
318
			widget_description.update(widget(prop.syntax, widget_description))
320
			widget_description.update(widget(prop.syntax, widget_description))
319
			if 'udm' in widget_description['type']:
321
			if 'udm' in widget_description['type']:
Lines 327-335 def get_user_attributes(self, username, password): Link Here
327
		layout = [propname for propname in user_attributes if propname in [wd['id'] for wd in widget_descriptions]]
329
		layout = [propname for propname in user_attributes if propname in [wd['id'] for wd in widget_descriptions]]
328
330
329
		values = {}
331
		values = {}
330
		user = self.get_udm_user(username=username)
331
		for propname in user_attributes:
332
		for propname in user_attributes:
332
			if propname in user:
333
			if user.has_property(propname):
333
				values[propname] = user[propname]
334
				values[propname] = user[propname]
334
335
335
		return {
336
		return {
Lines 400-411 def set_user_attributes(self, username, password, attributes): Link Here
400
		user_attributes = [attr.strip() for attr in ucr.get('self-service/udm_attributes', '').split(',')]
401
		user_attributes = [attr.strip() for attr in ucr.get('self-service/udm_attributes', '').split(',')]
401
		user = self.get_udm_user_by_dn(userdn=dn, admin=True)
402
		user = self.get_udm_user_by_dn(userdn=dn, admin=True)
402
		for propname, value in attributes.items():
403
		for propname, value in attributes.items():
403
			if propname in user_attributes:
404
			if propname in user_attributes and user.has_property(propname):
404
				user[propname] = value
405
				user[propname] = value
405
		user.modify()
406
		user.modify()
406
		return _("Successfully changed your contact data.")
407
		return _("Successfully changed your contact data.")
407
408
408
409
	@forward_to_master
409
	@forward_to_master
410
	@prevent_denial_of_service
410
	@prevent_denial_of_service
411
	@sanitize(
411
	@sanitize(

Return to bug 48710