Skip to content

Commit

Permalink
add support for an async profile mapper
Browse files Browse the repository at this point in the history
  • Loading branch information
jfromaniello committed Mar 9, 2016
1 parent 294d03a commit 2b3448b
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions lib/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ var ldap_clients = require('./ldap');
var cb = require('cb');
var graph = require('./graph');

var AccountDisabled = require('./errors/AccountDisabled');
var AccountExpired = require('./errors/AccountExpired');
var AccountLocked = require('./errors/AccountLocked');
var AccountDisabled = require('./errors/AccountDisabled');
var AccountExpired = require('./errors/AccountExpired');
var AccountLocked = require('./errors/AccountLocked');
var PasswordChangeRequired = require('./errors/PasswordChangeRequired');
var PasswordExpired = require('./errors/PasswordExpired');
var WrongPassword = require('./errors/WrongPassword');
var WrongUsername = require('./errors/WrongUsername');
var UnexpectedError = require('./errors/UnexpectedError');
var PasswordExpired = require('./errors/PasswordExpired');
var WrongPassword = require('./errors/WrongPassword');
var WrongUsername = require('./errors/WrongUsername');
var UnexpectedError = require('./errors/UnexpectedError');

var profileMapper = require('./profileMapper');
var _ = require('lodash');

Expand Down Expand Up @@ -271,9 +272,12 @@ Users.prototype.enrichProfile = function (profile, noGroups, callback) {
profile.groups = results[0];
profile.organizationUnits = results[1] && results[1].length > 0 ? results[1] : undefined;

var result = profileMapper(profile);

callback(null, result);
if (profileMapper.length === 1) {
var result = profileMapper(profile);
callback(null, result);
} else {
profileMapper(profile, callback);
}
});
};

Expand Down

0 comments on commit 2b3448b

Please sign in to comment.