From 52e4d3aed84531c2a64fb6a22008ed066598fc3a Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 13 May 2024 19:13:35 +0200 Subject: [PATCH] test(samba): refs #5770 update group when change description --- modules/account/back/models/samba-helper.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/account/back/models/samba-helper.js b/modules/account/back/models/samba-helper.js index 93ec2e3c7..14388fc28 100644 --- a/modules/account/back/models/samba-helper.js +++ b/modules/account/back/models/samba-helper.js @@ -1,4 +1,5 @@ const {differences, printResults} = require('../util/helpers'); +const ldap = require('../util/ldapjs-extra'); const ROLE_PREFIX = '$'; const app = require('vn-loopback/server/server'); @@ -163,8 +164,18 @@ module.exports = class SambaHelper { if (this.rolesToUpdate.length > 0) { for await (const role of this.rolesToUpdate) { - await this.deleteRole(role); - await this.addRole(this.roles.get(role)); + if (this.roles.get(role).$description != sambaCurrentGroups.get(role).description) { + 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)); + } } } }