Skip to content

Commit

Permalink
Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
williambelle committed Oct 30, 2023
1 parent 011d999 commit 5cf3748
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/services/unit.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ async function getUnit (acro, lang) {
}
if (dict.has_accreds) {
const ldapUnitPersons = await peopleService.getPersonByUnit(dict.sigle);
const UnitPersons = ldapUtil.ldap2unit(ldapUnitPersons, lang);
const UnitPersons = ldapUtil.ldapUnit2api(ldapUnitPersons, lang);
if (UnitPersons.length > 0) {
unitFullDetails.people = UnitPersons;
}
Expand Down
15 changes: 13 additions & 2 deletions src/utils/ldap.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,18 @@ function ldapAddress2api (ldapResults) {
return person;
}

function ldap2unit (ldapResults, hl) {
/**
* Convert LDAP Unit result into API result.
*
* @example
* const ldapUtil = require('../utils/ldap.util');
* const persons = ldapUtil.ldapUnit2api(ldapResults, 'en');
*
* @param {object} ldapResults The result from the LDAP Unit search.
* @param {string} hl The user interface language.
* @returns {object} Return the result for the API.
*/
function ldapUnit2api (ldapResults, hl) {
const list = [];
const ldapUnitMapper = newLdapUnitMapper(hl);

Expand Down Expand Up @@ -336,5 +347,5 @@ module.exports = {
getProfile,
ldap2api,
ldapAddress2api,
ldap2unit
ldapUnit2api
};

0 comments on commit 5cf3748

Please sign in to comment.