From c1e2e12dd91735fa8d7d8e729c8ecf14fcae1645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Mon, 22 Oct 2018 10:54:24 +0200 Subject: [PATCH] Fixed "meta group" pools on information --- server/src/uds/REST/methods/users_groups.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/src/uds/REST/methods/users_groups.py b/server/src/uds/REST/methods/users_groups.py index b924bca57..e4925a4f4 100644 --- a/server/src/uds/REST/methods/users_groups.py +++ b/server/src/uds/REST/methods/users_groups.py @@ -42,7 +42,7 @@ from uds.core.util.State import State from uds.core.auths.Exceptions import AuthenticatorException from uds.core.util import log from uds.core.util.model import processUuid -from uds.models import Authenticator, User, Group +from uds.models import Authenticator, User, Group, ServicePool from uds.core.auths.User import User as aUser from uds.core.managers import cryptoManager from uds.REST import RequestError @@ -57,6 +57,7 @@ logger = logging.getLogger(__name__) # Details of /auth + def getGroupsFromMeta(groups): for g in groups: if g.is_meta: @@ -67,9 +68,8 @@ def getGroupsFromMeta(groups): def getPoolsForGroups(groups): - for g in groups: - for servicePool in g.deployedServices.all(): - yield servicePool + for servicePool in ServicePool.getDeployedServicesForGroups(groups): + yield servicePool class Users(DetailHandler): @@ -192,7 +192,8 @@ class Users(DetailHandler): uuid = processUuid(item) user = parent.users.get(uuid=processUuid(uuid)) res = [] - for i in getPoolsForGroups(user.groups.all()): + groups = list(user.getGroups()) + for i in getPoolsForGroups(groups): res.append({ 'id': i.uuid, 'name': i.name, @@ -217,7 +218,6 @@ class Users(DetailHandler): return res - class Groups(DetailHandler): custom_methods = ['servicesPools', 'users']