WIP: #5770 - Sync Groups Samba #1946

Draft
jsegarra wants to merge 38 commits from 5770_sambaGroups into dev
1 changed files with 13 additions and 2 deletions
Showing only changes of commit 52e4d3aed8 - Show all commits

View File

@ -1,4 +1,5 @@
const {differences, printResults} = require('../util/helpers'); const {differences, printResults} = require('../util/helpers');
const ldap = require('../util/ldapjs-extra');
const ROLE_PREFIX = '$'; const ROLE_PREFIX = '$';
const app = require('vn-loopback/server/server'); const app = require('vn-loopback/server/server');
@ -163,8 +164,18 @@ module.exports = class SambaHelper {
if (this.rolesToUpdate.length > 0) { if (this.rolesToUpdate.length > 0) {
for await (const role of this.rolesToUpdate) { for await (const role of this.rolesToUpdate) {
await this.deleteRole(role); if (this.roles.get(role).$description != sambaCurrentGroups.get(role).description) {
await this.addRole(this.roles.get(role)); const groupDescriptionAttribute = {
description: this.roles.get(role).$description,
};
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));
}
} }
} }
} }