Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use special characters / template parameters / escape sequences in default values of custom attribute #227

Open
marcel-sachtleben opened this issue Sep 16, 2024 · 1 comment

Comments

@marcel-sachtleben
Copy link

Version
Latest Docker Image (Container SHA: sha256:5987992f57267ae4360b82caa40b2eb90598560e51f6826926f8f385cbcec52b)

Describe the bug
When I use default attributes with labels, values and defaults, I am neither able to use pre-defined variables like {first_name} or {last_name} nor can I use special characters like ":" since it is already the delimiter of the triplet "attribute:label:default"

How can I escape special characters and make default template substitution work?

Example 1:
LDAP_ACCOUNT_ADDITIONAL_ATTRIBUTES: "mailHomeDirectory:Mail Home Directory:/var/mail/alpha-architect.com/{first_name}.{last_name}"

If I use e.g.
First Name = Marcel
Last Name = Sachtleben

it will still fill the value "var/mail/alpha-architect.com/{first_name}.{last_name}" without replacing the template parameters.

I have tried escaping "{" and "}" with backslash \ and I have also tried adding a "$" in front of the curly braces with no success.

Example 2:
LDAP_ACCOUNT_ADDITIONAL_ATTRIBUTES: "mailStorageDirectory:Mail Storage Directory:maildir:~/mail"

Problem here is that the default value "maildir:~/mail" contains a colon ":" which I have no idea, how to escape.
Backslash is treated as normal character.

Meaning, the value is set to "maildir" because it cuts the last part with ":~/mail".
Probably the code is splitting by ":" and uses the first 3 parts, ignoring the 4th part in this case.

Can you please give me a solution to be able to use default template variables and special characters in custom attributes default values?

@marcel-sachtleben marcel-sachtleben changed the title Use special characters / template tarameters / escape sequences in default values of custom attribute Use special characters / template parameters / escape sequences in default values of custom attribute Sep 16, 2024
@wheelybird
Copy link
Owner

Hi. The additional attributes can only take literal strings, so it's not possible to use the template macro names for that. Only specific LDAP attributes are able to use the USERNAME_FORMAT template.
You're right that the code splits the additional attributes using the colon, and so anything past the third colon will be ignored. I'll update the code to allow for escaping colons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants