LDAP sync hotfix
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
2a2104936c
commit
61bb2f14ba
|
@ -146,17 +146,22 @@ module.exports = Self => {
|
||||||
|
|
||||||
if (!info.hasAccount) return;
|
if (!info.hasAccount) return;
|
||||||
|
|
||||||
reqs = [];
|
|
||||||
for (let role of info.user.roles()) {
|
for (let role of info.user.roles()) {
|
||||||
|
let roleName = role.inherits().name;
|
||||||
|
|
||||||
|
let dn = `cn=${roleName},${this.groupDn}`;
|
||||||
let change = new ldap.Change({
|
let change = new ldap.Change({
|
||||||
operation: 'add',
|
operation: 'add',
|
||||||
modification: {memberUid: userName}
|
modification: {memberUid: userName}
|
||||||
});
|
});
|
||||||
let roleName = role.inherits().name;
|
|
||||||
let dn = `cn=${roleName},${this.groupDn}`;
|
try {
|
||||||
reqs.push(client.modify(dn, change));
|
await client.modify(dn, change);
|
||||||
|
} catch (err) {
|
||||||
|
if (err.name !== 'NoSuchObjectError')
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
await Promise.all(reqs);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async getUsers(usersToSync) {
|
async getUsers(usersToSync) {
|
||||||
|
|
Loading…
Reference in New Issue