1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-02-10 13:57:36 +03:00

Merge remote-tracking branch 'origin/v2.2'

This commit is contained in:
Adolfo Gómez García 2018-10-22 10:56:35 +02:00
commit 259bfc31c4

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
@ -58,6 +58,7 @@ logger = logging.getLogger(__name__)
# Details of /auth
def getGroupsFromMeta(groups):
for g in groups:
if g.is_meta:
@ -68,9 +69,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):
@ -195,7 +195,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,
@ -220,7 +221,6 @@ class Users(DetailHandler):
return res
class Groups(DetailHandler):
custom_methods = ['servicesPools', 'users']