Merge remote-tracking branch 'origin/development' into development

This commit is contained in:
Tomas Bures 2019-08-23 13:57:22 +02:00
commit 3a17d7fd75
2 changed files with 9 additions and 5 deletions

View file

@ -187,15 +187,15 @@ if (LdapStrategy) {
return { return {
id: user.id, id: user.id,
username: user.username, username: profile[config.ldap.uidTag],
name: profile[config.ldap.nameTag], name: profile[config.ldap.nameTag],
email: profile.mail, email: profile[config.ldap.mailTag],
role: user.role role: user.role
}; };
} catch (err) { } catch (err) {
if (err instanceof interoperableErrors.NotFoundError) { if (err instanceof interoperableErrors.NotFoundError) {
const userId = await users.create(null, { const userId = await users.create(contextHelpers.getAdminContext(), {
username: profile[config.ldap.uidTag], username: profile[config.ldap.uidTag],
role: config.ldap.newUserRole, role: config.ldap.newUserRole,
namespace: config.ldap.newUserNamespaceId namespace: config.ldap.newUserNamespaceId
@ -205,7 +205,7 @@ if (LdapStrategy) {
id: userId, id: userId,
username: profile[config.ldap.uidTag], username: profile[config.ldap.uidTag],
name: profile[config.ldap.nameTag], name: profile[config.ldap.nameTag],
email: profile.mail, email: profile[config.ldap.mailTag],
role: config.ldap.newUserRole role: config.ldap.newUserRole
}; };
} else { } else {

View file

@ -258,7 +258,11 @@ async function getByAccessToken(accessToken) {
} }
async function getByUsername(username) { async function getByUsername(username) {
return await _getBy(contextHelpers.getAdminContext(), 'username', username); try{
return await _getBy(contextHelpers.getAdminContext(), 'username', username);
}catch(err){
throw new interoperableErrors.NotFoundError();
}
} }
async function getByUsernameIfPasswordMatch(context, username, password) { async function getByUsernameIfPasswordMatch(context, username, password) {