1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-10 01:17:59 +03:00

Fixed "meta group" pools on information

This commit is contained in:
Adolfo Gómez García 2018-10-22 10:54:24 +02:00
parent 265d2d8702
commit c1e2e12dd9

View File

@ -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']