Problem: UMC Complains About Missing Defaults

python
umc
problem

#1

Problem

Univention Management Console (UMC) complains about missing default values and informs to set them as shown in the following screenshot:
screenshot_2018-11-27_094750

The following empty properties were set to default values in the form. 
These values will be applied when saving.
* Account .....

Solution

Create and execute the following Python script. It will set all empty attributes to the default values; this can be done for users as well as for groups.

Users

import univention.admin.modules as modules
from univention.admin.uldap import getAdminConnection

FILTER_STRING = ''

modules.update()
lo,po=getAdminConnection()
user_mod = modules.get('users/user')
modules.init(lo,po,user_mod)


users = user_mod.lookup(None, lo, FILTER_STRING)

for user in users:
	user.open()
	print("Setting default values for user '{}'".format(user['username']))
	user.set_defaults = 1
	user.set_default_values()
	user.modify()

Groups

You can do this similar with groups

import univention.admin.modules as modules
from univention.admin.uldap import getAdminConnection

FILTER_STRING = ''

modules.update()
lo,po=getAdminConnection()
group_mod = modules.get('groups/group')
modules.init(lo,po,group_mod)


groups = group_mod.lookup(None, lo, FILTER_STRING)

for group in groups:
	group.open()
	print("Setting default values for group '{}'".format(group['name']))
	group.set_defaults = 1
	group.set_default_values()
	group.modify()

Problem: permissionDenied reject on a school slave