diff --git a/src/graphql/schema.js b/src/graphql/schema.js index ca3ad8005f2ba51238876d470b8aa896d7129c5e..7d3050451767367becd444471967e319384e7158 100644 --- a/src/graphql/schema.js +++ b/src/graphql/schema.js @@ -55,7 +55,7 @@ const typeDefs = ` */ const getAllVisibleGroups = (user) => { - return listGroups(user.uid, user).then(group_ids => { + return listGroups(user, user.uid).then(group_ids => { if(typeof group_ids == "undefined") throw "invalid user"; var membered_groups = qb => qb.select().from('groups').whereIn('uid', group_ids.concat(['kes'])); @@ -92,8 +92,8 @@ const getGroupIfVisible = (user, uid) => { * @arg {String} uid - L'uid du groupe dont on veut les administrateurs. * @return {Promise} Retour de requête knex. Promise qui renvera une liste de tous les utilisateurs ayant droit d'admin sur le groupe */ -const getUsersWithAdminRights = (uid, user) => { - return listAdmins(uid, user); +const getUsersWithAdminRights = (user, uid) => { + return listAdmins(user, uid); }; /** @@ -116,7 +116,7 @@ const getAvailableGroupUID = (initialUID) => { const createGroupIfLegal = (user, args) => { if(typeof args.parentuid != 'string') throw "Illegal argument : parentuid must be a string"; - return getUsersWithAdminRights(args.parentuid, user).then( admin_list => { + return getUsersWithAdminRights(user, args.parentuid).then( admin_list => { if(typeof admin_list == undefined) throw "invalid argument : no group with id " + args.parentuid; admin_list = admin_list.concat(['anatole.romon']); // pour les besoins des tests, anatole romon a tout les droits