Request slice/project no authority name in fed4fire
authorLoic Baron <loic.baron@lip6.fr>
Fri, 24 Apr 2015 14:47:11 +0000 (16:47 +0200)
committerLoic Baron <loic.baron@lip6.fr>
Fri, 24 Apr 2015 14:47:11 +0000 (16:47 +0200)
portal/projectrequestview.py
portal/slicerequestview.py

index 37442f1..69941b3 100644 (file)
@@ -21,7 +21,7 @@ class ProjectRequestView(LoginRequiredAutoLogoutView, ThemeView):
     
     def getAuthorities(self, request):
         if self.theme == 'fed4fire':
-            authorities_query = Query.get('myslice:authority').select('name', 'authority_hrn')
+            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)
@@ -29,7 +29,8 @@ class ProjectRequestView(LoginRequiredAutoLogoutView, ThemeView):
             # 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):
@@ -90,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' :
 
index f9a540a..70ef4b7 100644 (file)
@@ -46,13 +46,14 @@ class SliceRequestView (LoginRequiredAutoLogoutView, ThemeView):
         authority_name = None
         # Retrieve the list of authorities
         if self.theme == 'fed4fire':
-            authorities_query = Query.get('myslice:authority').select('name', 'authority_hrn')
+            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:
             authorities = sorted(authorities, key=lambda k: k['authority_hrn'])
-            authorities = sorted(authorities, key=lambda k: k['name'])
+            if self.theme != 'fed4fire':
+                authorities = sorted(authorities, key=lambda k: k['name'])
 
         # Get user_email (XXX Would deserve to be simplified)
         user_query  = Query().get('local:user').select('email','config')
@@ -64,7 +65,7 @@ class SliceRequestView (LoginRequiredAutoLogoutView, ThemeView):
             user_authority = user_config.get('authority','N/A')              
         # getting the org from authority        
         for authority in authorities:
-            if authority['authority_hrn'] == user_authority:
+            if 'name' in authority and authority['authority_hrn'] == user_authority:
                 authority_name = authority['name']
 
         # Handle the case when we use only hrn and not name