From 43398cd125aa4c16dd84105fad94e933ca81e8bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Thu, 20 Dec 2018 16:38:00 +0100 Subject: [PATCH] Fixed user edition (user assignation) --- server/src/uds/REST/methods/user_services.py | 2 +- server/src/uds/static/adm/js/gui-d-servicespools.coffee | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/server/src/uds/REST/methods/user_services.py b/server/src/uds/REST/methods/user_services.py index d0d88d9a..03c771a7 100644 --- a/server/src/uds/REST/methods/user_services.py +++ b/server/src/uds/REST/methods/user_services.py @@ -180,7 +180,7 @@ class AssignedService(DetailHandler): logStr = 'Changing ownership of service from {} to {} by {}'.format(service.user.pretty_name, user.pretty_name, self._user.pretty_name) # If there is another service that has this same owner, raise an exception - if parent.userServices.filter(user=user).exclude(uuid=service.uuid).count() > 0: + if parent.userServices.filter(user=user).exclude(uuid=service.uuid).exclude(state__in=State.INFO_STATES).count() > 0: raise self.invalidResponseException('There is already another user service assigned to {}'.format(user.pretty_name)) service.user = user diff --git a/server/src/uds/static/adm/js/gui-d-servicespools.coffee b/server/src/uds/static/adm/js/gui-d-servicespools.coffee index c9ef8dba..256dd9aa 100644 --- a/server/src/uds/static/adm/js/gui-d-servicespools.coffee +++ b/server/src/uds/static/adm/js/gui-d-servicespools.coffee @@ -438,6 +438,8 @@ gui.servicesPools.link = (event) -> onEdit: (item, event, table, refreshFnc) -> gui.doLog(item) + if item.state in ['E', 'R', 'C'] + return api.templates.get "pool_edit_assigned", (tmpl) -> api.authenticators.overview (data) -> # Sorts groups, expression means that "if a > b returns 1, if b > a returns -1, else returns 0"