user edit

This commit is contained in:
2020-05-15 15:17:57 -04:00
parent 0889832efc
commit b8f632e644
16 changed files with 411 additions and 163 deletions

View File

@ -7,11 +7,14 @@ const client = new Client({
url: conf.url,
});
async function getGroups(client){
async function getGroups(client, member){
try{
let memberFilter = member ? `(member=${member})`: ''
let groups = (await client.search(conf.groupBase, {
scope: 'sub',
filter: '(&(objectClass=groupOfNames))',
filter: `(&(objectClass=groupOfNames)${memberFilter})`,
attributes: ['*', 'createTimestamp', 'modifyTimestamp'],
})).searchEntries;
@ -81,11 +84,11 @@ async function removeMember(client, group, user){
var Group = {};
Group.list = async function(){
Group.list = async function(member){
try{
await client.bind(conf.bindDN, conf.bindPassword);
let groups = await getGroups(client)
let groups = await getGroups(client, member)
await client.unbind();
@ -95,11 +98,11 @@ Group.list = async function(){
}
}
Group.listDetail = async function(){
Group.listDetail = async function(member){
try{
await client.bind(conf.bindDN, conf.bindPassword);
let groups = await getGroups(client)
let groups = await getGroups(client, member)
await client.unbind();
@ -207,7 +210,4 @@ Group.remove = async function(){
}
}
module.exports = {Group};