test(samba): refs #5770 try to use ldap to add group
This commit is contained in:
parent
d0e836b51e
commit
37ad179676
|
@ -119,6 +119,10 @@ module.exports = class SambaHelper {
|
|||
}
|
||||
|
||||
async syncFromDB() {
|
||||
// await this.adClient.del(
|
||||
// `cn=developer,${this.fullGroupsDn}`,
|
||||
|
||||
// );
|
||||
// OBTENER ROLES
|
||||
await this.getRoles();
|
||||
// const rolesKeys = Array.from(this.roles.keys()).sort();
|
||||
|
@ -156,6 +160,19 @@ module.exports = class SambaHelper {
|
|||
|
||||
if (this.rolesToInsert.length > 0) {
|
||||
// PROCEDIMIENTO PARA INSERTAR ROLES
|
||||
// for (const $role of this.rolesToInsert) {
|
||||
// const {name, description} = this.roles.get($role);
|
||||
|
||||
// const changed = await this.adClient.add(
|
||||
// `cn=${$role},${this.fullGroupsDn}`,
|
||||
// {
|
||||
// cn: $role,
|
||||
// description: description,
|
||||
// objectClass: ['top', 'posixGroup', 'sambaGroupMapping']
|
||||
// }
|
||||
// );
|
||||
// console.log(changed);
|
||||
// }
|
||||
const resultsRoleInsert = await Promise.all(
|
||||
this.rolesToInsert.map(role => this.addRole(this.roles.get(role))));
|
||||
printResults(resultsRoleInsert);
|
||||
|
@ -168,10 +185,13 @@ module.exports = class SambaHelper {
|
|||
const groupDescriptionAttribute = {
|
||||
description: this.roles.get(role).$description,
|
||||
};
|
||||
const changed = await this.adClient.modify(`cn=${role},${this.fullGroupsDn}`, new ldap.Change({
|
||||
const changed = await this.adClient.modify(
|
||||
`cn=${role},${this.fullGroupsDn}`,
|
||||
new ldap.Change({
|
||||
operation: 'replace',
|
||||
modification: groupDescriptionAttribute,
|
||||
}));
|
||||
})
|
||||
);
|
||||
console.log(changed);
|
||||
// await this.deleteRole(role);
|
||||
// await this.addRole(this.roles.get(role));
|
||||
|
|
Loading…
Reference in New Issue