RocketChat / RocketChat/Rocket.Chat
LDAP - User Data Field Map - Email field does not allow templating despite implication
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description:
When performing LDAP user synchronisation, user data is mapped from the LDAP server according to the mapping set in the "User Data Field Map" configuration option.
The help text implies templating is available for both fields ("name" and "email"):
Configure how user account fields (like email) are populated from a record in LDAP (once found).
As an example,{"cn":"name", "mail":"email"}will choose a person's human readable name from the cn attribute, and their email from the mail attribute. Additionally it is possible to use variables, for example:{ "#{givenName} #{sn}": "name", "mail": "email" }uses a combination of the user's first name and last name for the rocket chatnamefield.
Available fields in Rocket.Chat:name,customFields.
However, templating doesn't work on the "email" field.
Steps to reproduce:
- Set the "User Data Field Map" to the value
{ "#{cn}":"name", "#{givenName}.#{sn}@anotherdomain.com":"email" } - Log in as a newly created (unsynchronised) LDAP user. E.g:
User with an LDAP "cn" field name of "joe"
"givenName" of "Joe"
"sn" of "Bloggs" - Attempt to log in as newly created "joe" user
- Login fails
- View the debug logs (see below)
Expected behavior:
A new user gets synchronised with the following values:
name -> joe
email -> Joe.Bloggs@anotherdomain.com
Actual behavior:
Login error occurs, because the LDAP user is not synchronised. See log below.
Server Setup Information:
- Version of Rocket.Chat Server: 0.74.3
- Operating System: Ubuntu 18.04.2 LTS
- Deployment Method: Snap
- Number of Running Instances: 1
- DB Replicaset Oplog:
- NodeJS Version: v8.11.4
- MongoDB Version:
Relevant code
Relevant logs:
[34mI20190411-00:22:55.084(0) LDAPHandler ➔ debug userQuery { username: 'joe' }
[34mI20190411-00:22:55.090(0) LDAPHandler ➔ info User does not exist, creating joe
[34mI20190411-00:22:55.101(0) TemplateVarHandler ➔ debug template found. replacing values
[34mI20190411-00:22:55.104(0) TemplateVarHandler ➔ debug replacing template var: #{cn} with value: joe
[34mI20190411-00:22:55.108(0) LDAPSync ➔ debug user.name changed to: joe
[34mI20190411-00:22:55.111(0) LDAPSync ➔ debug user does not have attribute: #{givenName}.#{sn}@anotherdomain.com
[34mI20190411-00:22:55.138(0) rocketchat:logger server.js:199 LDAPSync ➔ error...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.