Skip to content
Snippets Groups Projects
Commit acd7e6f8 authored by Elia AZAR's avatar Elia AZAR
Browse files

created and implemented simpleGroupsOfGroups in tool.ts to facilitate the...

created and implemented simpleGroupsOfGroups in tool.ts to facilitate the implementation of other functions
parent f724429f
No related branches found
No related tags found
No related merge requests found
......@@ -160,7 +160,10 @@ export class GroupModel {
* @rights connectedOrOnplatal
*/
getAllSimpleGroupsFromMeta(gid: string): Promise<GroupSet> {
throw "Not implemented";
let arg=new GroupSet();
arg.add(gid);
let res=Tools.simpleGroupsOfGroups(arg);
return res;
}
/**
......
......@@ -119,6 +119,21 @@ export class Tools {
}));
}
/**
* @memberof GraphQL
* @summary Fonction qui renvoit tous les simple-groupes dont ces groupes sont membres.
* @arg {GroupSet} groups - Un ensemble de gid des groupes a considérer.
* @return {Promise(GroupSet)} Renvoie un GroupSet contenant le nom des simple-groupes.
* @static
* @async
*/
static async simpleGroupsOfGroups(groups: GroupSet): Promise<GroupSet> {
let simples = await knex.select('simple_group_gid').from('metagroup_memberships').whereIn('meta_group_gid', [...groups]);
return new GroupSet(simples.map( elt => {
return elt.simple_group_gid;
}));
}
/**
* @memberof GraphQL
* @summary Fonction qui renvoit tous les groupes (simples ou méta) dont le user est membre.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment