Q&A: Can I set record_UID and/or source_UID to users, who were added manually?

Question

Can I set record_UID and/or source_UID to users, who were added manually?

Answer:

To get users (students) without Record_uid, you can use this command

univention-ldapsearch -LLL '(&(!(ucsschoolRecordUID=*))(univentionObjectType=users/user)(ucsschoolRole=student:school:*))' dn|sed -n 's/dn: //p'

To modify use:

udm users/user modify --dn <dn from the above command above> --set ucsschoolSourceUID=<may be needs to be set> --set ucsschoolRecordUID=<get the ID from the CSV import file>

Addition:

If you use counters in your import, make also sure the counter is initialized for the manual adjusted users.

You can reset the Counter for a specific user e.g.

Get the user via
univention-ldapsearch -LLL 'cn=username'
watch the cn!

univention-ldapsearch -LLL 'cn=username'
dn: cn=username,cn=unique-usernames,cn=ucsschool,cn=univention,dc=schein,dc=me
objectClass: ucsschoolUsername
cn: username
ucsschoolUsernameNextNumber: 3

To modify use:

ldapmodify -x -D "cn=admin,$(ucr get ldap/base)" -y /etc/ldap.secret <<%EOR
dn: cn=username,cn=unique-usernames,cn=ucsschool,cn=univention,dc=schein,dc=me
changetype: modify
replace: ucsschoolUsernameNextNumber
ucsschoolUsernameNextNumber: 2
%EOR
1 Like