X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Fprojectrequestview.py;h=69941b321841005da0991fb8bef97a0a0742f9be;hb=6eb98c83dccb555e576740d8000d6fad8044763f;hp=086d60cf948df4db92125dc4b478aa0c876753a6;hpb=ad016322ae3f21b27cda0e942fa48a10c3c728a3;p=myslice.git diff --git a/portal/projectrequestview.py b/portal/projectrequestview.py index 086d60cf..69941b32 100644 --- a/portal/projectrequestview.py +++ b/portal/projectrequestview.py @@ -20,13 +20,17 @@ class ProjectRequestView(LoginRequiredAutoLogoutView, ThemeView): template_name = 'projectrequest_view.html' def getAuthorities(self, request): - authorities_query = Query.get('authority').select('name', 'authority_hrn') + if self.theme == 'fed4fire': + authorities_query = Query.get('myslice:authority').select('authority_hrn') + else: + authorities_query = Query.get('authority').select('name', 'authority_hrn') authorities = execute_admin_query(request, authorities_query) if authorities is not None: # Remove the root authority from the list matching = [s for s in authorities if "." in s['authority_hrn']] authorities = sorted(matching, key=lambda k: k['authority_hrn']) - authorities = sorted(matching, key=lambda k: k['name']) + if self.theme != 'fed4fire': + authorities = sorted(matching, key=lambda k: k['name']) return authorities def getUserAuthority(self, request): @@ -87,9 +91,9 @@ class ProjectRequestView(LoginRequiredAutoLogoutView, ThemeView): user_authority = self.getUserAuthority(wsgi_request) # getting the org from authority - for authority in authorities: - if authority['authority_hrn'] == user_authority: - authority_name = authority['name'] + #for authority in authorities: + # if authority['authority_hrn'] == user_authority: + # authority_name = authority['name'] if method == 'POST' : @@ -139,8 +143,10 @@ class ProjectRequestView(LoginRequiredAutoLogoutView, ThemeView): if is_pi(wsgi_request, user_hrn, user_authority): # PIs can directly create/join project in their own authority... if 'join' in wsgi_request.POST: + # join existing project authority_add_pis(wsgi_request, post['project_name'], user_hrn) else: + # Create project hrn = post['authority_hrn'] + '.' + post['project_name'] sfa_add_authority(wsgi_request, {'authority_hrn':hrn}) authority_add_pis(wsgi_request, hrn, user_hrn)