LDAP sync hotfix
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Juan Ferrer 2020-11-30 18:50:04 +01:00
parent 3acc943d85
commit b2a3adc96f
1 changed files with 10 additions and 5 deletions

View File

@ -146,17 +146,22 @@ module.exports = Self => {
if (!info.hasAccount) return;
reqs = [];
for (let role of info.user.roles()) {
let roleName = role.inherits().name;
let dn = `cn=${roleName},${this.groupDn}`;
let change = new ldap.Change({
operation: 'add',
modification: {memberUid: userName}
});
let roleName = role.inherits().name;
let dn = `cn=${roleName},${this.groupDn}`;
reqs.push(client.modify(dn, change));
try {
await client.modify(dn, change);
} catch (err) {
if (err.name !== 'NoSuchObjectError')
throw err;
}
}
await Promise.all(reqs);
},
async getUsers(usersToSync) {