Skip to content

Commit

Permalink
Fix getvos
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed Mar 12, 2024
1 parent 7b7f59c commit f1d8779
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down
6 changes: 2 additions & 4 deletions app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit f1d8779

Please sign in to comment.