+ return self.get_or_post (request, 'GET')
+
+ def get_or_post (self, wsgi_request, method):
+ """
+ """
+ errors = []
+ slice_name =''
+ purpose=''
+ exp_url=''
+ # Retrieve the list of authorities
+ authorities_query = Query.get('authority').select('name', 'authority_hrn')
+ authorities = execute_admin_query(wsgi_request, authorities_query)
+ if authorities is not None:
+ authorities = sorted(authorities)
+
+ # Get user_email (XXX Would deserve to be simplified)
+ user_query = Query().get('local:user').select('email','config')
+ user_details = execute_query(wsgi_request, user_query)
+ user_email = user_details[0].get('email')
+ # getting user_hrn
+ for user_detail in user_details:
+ user_config = json.loads(user_detail['config'])
+ user_authority = user_config.get('authority','N/A')
+ # getting the org from authority
+ for authority in authorities:
+ if authority['authority_hrn'] == user_authority:
+ authority_name = authority['name']
+
+ #
+ account_query = Query().get('local:account').select('user_id','platform_id','auth_type','config')
+ account_details = execute_query(wsgi_request, account_query)
+ #
+ platform_query = Query().get('local:platform').select('platform_id','platform','gateway_type','disabled')
+ platform_details = execute_query(wsgi_request, platform_query)
+ user_hrn = None
+ # getting user_hrn from local:account
+ for account_detail in account_details:
+ for platform_detail in platform_details:
+ if platform_detail['platform_id'] == account_detail['platform_id']:
+ # taking user_hrn only from myslice account
+ # NOTE: we should later handle accounts filter_by auth_type= managed OR user
+ if 'myslice' in platform_detail['platform']:
+ account_config = json.loads(account_detail['config'])
+ user_hrn = account_config.get('user_hrn','N/A')
+ acc_auth_cred = account_config.get('delegated_authority_credentials','N/A')
+
+
+ # checking if pi or not
+ if acc_auth_cred == {} or acc_auth_cred == 'N/A':
+ pi = "is_not_pi"
+ else:
+ pi = "is_pi"
+
+
+ # Page rendering
+ page = Page(wsgi_request)
+ page.add_js_files ( [ "js/jquery.validate.js", "js/jquery-ui.js" ] )
+ page.add_css_files ( [ "https://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" ] )
+
+ if method == 'POST':
+ # The form has been submitted