X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Factions.py;h=ec4b2888335dc13de4d346b99baeffe517b8997f;hb=929f8979e42188a6dd7c7afed81342d4b1ef99e5;hp=0e003120d6b67d26ec7cb1246374b95e6b4250f3;hpb=832a69800ec6ef9463cd0d937d635fa59da6d803;p=unfold.git diff --git a/portal/actions.py b/portal/actions.py index 0e003120..ec4b2888 100644 --- a/portal/actions.py +++ b/portal/actions.py @@ -81,10 +81,15 @@ def get_jfed_identity(request): return None def getAuthorities(request, admin = False): - result = sfa_client(request,'List',hrn='onelab',object_type='authority',platforms=['myslice'],admin=admin) + # XXX theme has to be the same as the root authority + result = sfa_client(request,'List',hrn=theme.theme,object_type='authority',platforms=['myslice'],admin=admin) authorities = list() for item in result['myslice']: - authorities.append({'authority_hrn':item['hrn']}) + t_hrn = item['hrn'].split('.') + if 'name' in item: + authorities.append({'authority_hrn':item['hrn'], 'name':item['name'], 'shortname':t_hrn[-1].upper()}) + else: + authorities.append({'authority_hrn':item['hrn']}) return sorted(authorities) @@ -392,7 +397,7 @@ def manifold_add_user(wsgi_request, request): if not results: raise Exception, "Failed creating manifold user: %s" % user_params['email'] result = results[0] - return result['email'] + return result['user_id'] def manifold_update_user(request, email, user_params): # user_params: password, config e.g., @@ -670,19 +675,17 @@ def portal_validate_request(wsgi_request, request_ids): elif request['type'] == 'authority': #hrn = "%s.%s" % (request['authority_hrn'], request['site_authority']) hrn = request['site_authority'] + name = request['site_name'] # XXX tmp sfa dependency from sfa.util.xrn import Xrn urn = Xrn(hrn, request['type']).get_urn() # Only hrn is required for Manifold Query sfa_authority_params = { - 'authority_hrn' : hrn, - #'authority_urn' : urn, - #'type' : request['type'], - #'pi' : None, - #'enabled' : True + 'authority_hrn' : hrn, + 'name' : name } - logger.info("ADD Authority") + #logger.info("ADD Authority") sfa_add_authority(wsgi_request, sfa_authority_params) request_status['SFA authority'] = {'status': True } a = PendingAuthority.objects.get(id=request['id']) @@ -1294,8 +1297,6 @@ def create_pending_user(wsgi_request, request, user_detail): if request['private_key']: account_config['user_private_key'] = request['private_key'] - user_id = user_detail['user_id'] + 1 # the user_id for the newly created user in local:user - # XXX TODO: Require a myslice platform # ALERT: this will disapear with ROUTERV2 of Manifold # We have to consider the case where several registries can be used