Restructured LDAP role

This commit is contained in:
2025-04-25 11:34:14 +02:00
parent ec79cb8921
commit 72deb13d07
13 changed files with 137 additions and 110 deletions

View File

@@ -1,19 +1,4 @@
#######################################################################
# Generic container for Application roles
#######################################################################
dn: {{ldap.dn.application_roles}}
objectClass: organizationalUnit
ou: roles
description: Container for application access profiles
{#
This template generates two LDIF entries for each application in defaults_applications:
one for the administrator role and one for the standard user role.
Please adjust the base DN (dc=example,dc=com) and other attributes as necessary.
#}
{% for app, config in defaults_applications.items() %}
{% for app, config in applications.items() %}
dn: cn={{ app }}-administrator,{{ldap.dn.application_roles}}
objectClass: top
objectClass: organizationalRole
@@ -27,3 +12,31 @@ cn: {{ app }}-user
description: Standard user role for {{ app }} (automatically generated)
{% endfor %}
{% for username, user in users.items() %}
#######################################################################
# Assign {{ username }} to application user roles
#######################################################################
{% for app, config in applications.items() %}
# Assign {{ username }} to {{ app }}-users
dn: cn={{ app }}-user,{{ ldap.dn.application_roles }}
changetype: modify
add: roleOccupant
roleOccupant: {{ ldap.attributes.user_id }}={{ username }},{{ ldap.dn.users }}
{% if users.is_admin | default(false) | bool %}
# Assign {{ username }} to {{ app }}-administrator
dn: cn={{ app }}-administrator,{{ ldap.dn.application_roles }}
changetype: modify
add: roleOccupant
roleOccupant: {{ ldap.attributes.user_id }}={{ users.administrator.username }},{{ ldap.dn.users }}
{% endif %}
{% endfor %}
{% endfor %}