diff --git a/app/tests/test_utils.py b/app/tests/test_utils.py index fce469495..0843b76de 100644 --- a/app/tests/test_utils.py +++ b/app/tests/test_utils.py @@ -27,6 +27,7 @@ class TestUtils(unittest.TestCase): def test_getUserVOs(self): entitlements = ['urn:mace:egi.eu:group:vo.test.egi.eu:role=member#aai.egi.eu', + 'urn:mace:egi.eu:group:vo.test.egi.eu:role=vm_operator#aai.egi.eu', 'urn:mace:egi.eu:group:vo.test2.egi.eu:role=member#aai.egi.eu'] res = utils.getUserVOs(entitlements) self.assertEquals(res, ['vo.test.egi.eu', 'vo.test2.egi.eu']) diff --git a/app/utils.py b/app/utils.py index 58c029955..72a1567a9 100644 --- a/app/utils.py +++ b/app/utils.py @@ -125,12 +125,10 @@ def getUserVOs(entitlements, vo_role=None): # format: urn:mace:egi.eu:group:eosc-synergy.eu:role=vm_operator#aai.egi.eu if elem.startswith('urn:mace:egi.eu:group:'): vo = elem[22:22 + elem[22:].find(':')] - if vo and (not vo_role or ":role=%s#" % vo_role in elem): + if vo and (not vo_role or ":role=%s#" % vo_role in elem) and vo not in vos: vos.append(vo) - elif elem in g.settings.vo_map: + elif elem in g.settings.vo_map and g.settings.vo_map[elem] not in vos: vos.append(g.settings.vo_map[elem]) - - vos = list(set(vos)) vos.sort() return vos