Created
August 18, 2021 09:10
-
-
Save saltukalakus/862e9f02082fdba0177397c4d9749a10 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (raw_data) { | |
var profile = { | |
id: raw_data.objectGUID || raw_data.uid || raw_data.cn, | |
displayName: raw_data.displayName, | |
name: { | |
familyName: raw_data.sn, | |
givenName: raw_data.givenName | |
}, | |
nickname: raw_data['sAMAccountName'] || raw_data['cn'] || raw_data['commonName'], | |
groups: raw_data['groups'], | |
emails: (raw_data.mail ? [{value: raw_data.mail }] : undefined) | |
}; | |
profile['dn'] = raw_data['dn']; | |
profile['st'] = raw_data['st']; | |
profile['description'] = raw_data['description']; | |
profile['postalCode'] = raw_data['postalCode']; | |
profile['telephoneNumber'] = raw_data['telephoneNumber']; | |
profile['distinguishedName'] = raw_data['distinguishedName']; | |
profile['co'] = raw_data['co']; | |
profile['department'] = raw_data['department']; | |
profile['company'] = raw_data['company']; | |
profile['mailNickname'] = raw_data['mailNickname']; | |
profile['sAMAccountName'] = raw_data['sAMAccountName']; | |
profile['sAMAccountType'] = raw_data['sAMAccountType']; | |
profile['userPrincipalName'] = raw_data['userPrincipalName']; | |
profile['manager'] = raw_data['manager']; | |
profile['organizationUnits'] = raw_data['organizationUnits']; | |
// if your LDAP service provides verified email addresses, uncomment this: | |
// profile['email_verified'] = true; | |
// This will make the profile huge: | |
// if (raw_data['thumbnailPhoto']) { | |
// profile['picture'] = 'data:image/bmp;base64,' + | |
// raw_data['thumbnailPhoto'].toString('base64'); | |
// } | |
console.dir(raw_data); | |
return profile; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment