No Credentials: warning message added for all cases (manual+auto delegation)
authorYasin <mohammed-yasin.rahman@lip6.fr>
Wed, 3 Sep 2014 15:18:31 +0000 (17:18 +0200)
committerYasin <mohammed-yasin.rahman@lip6.fr>
Wed, 3 Sep 2014 15:18:31 +0000 (17:18 +0200)
portal/accountview.py
portal/templates/onelab/onelab_account-view.html
portal/templates/onelab/onelab_registration_view.html

index bf033e6..5048383 100644 (file)
@@ -189,29 +189,36 @@ class AccountView(LoginRequiredAutoLogoutView, ThemeView):
 
 
         ## check user is pi or not
-        platform_query  = Query().get('local:platform').select('platform_id','platform','gateway_type','disabled')
-        account_query  = Query().get('local:account').select('user_id','platform_id','auth_type','config')
-        platform_details = execute_query(self.request, platform_query)
-        account_details = execute_query(self.request, account_query)
-        for platform_detail in platform_details:
-            for account_detail in account_details:
-                if platform_detail['platform_id'] == account_detail['platform_id']:
-                    if 'config' in account_detail and account_detail['config'] is not '':
-                        account_config = json.loads(account_detail['config'])
-                        if 'myslice' in platform_detail['platform']:
-                            acc_auth_cred = account_config.get('delegated_authority_credentials','N/A')
+      #  platform_query  = Query().get('local:platform').select('platform_id','platform','gateway_type','disabled')
+      #  account_query  = Query().get('local:account').select('user_id','platform_id','auth_type','config')
+      #  platform_details = execute_query(self.request, platform_query)
+      #  account_details = execute_query(self.request, account_query)
+      #  for platform_detail in platform_details:
+      #      for account_detail in account_details:
+      #          if platform_detail['platform_id'] == account_detail['platform_id']:
+      #              if 'config' in account_detail and account_detail['config'] is not '':
+      #                  account_config = json.loads(account_detail['config'])
+      #                  if 'myslice' in platform_detail['platform']:
+      #                      acc_auth_cred = account_config.get('delegated_authority_credentials','N/A')
         # assigning values
         if acc_auth_cred == {} or acc_auth_cred == 'N/A':
             pi = "is_not_pi"
         else:
             pi = "is_pi"
 
+        # check if the user has creds or not
+        if acc_user_cred == {} or acc_user_cred == 'N/A':
+            user_cred = 'no_creds'
+        else:
+            user_cred = 'has_creds'
+
         context = super(AccountView, self).get_context_data(**kwargs)
         context['principal_acc'] = principal_acc_list
         context['ref_acc'] = ref_acc_list
         context['platform_list'] = platform_list
         context['my_users'] = my_users
         context['pi'] = pi
+        context['user_cred'] = user_cred
         context['my_slices'] = my_slices
         context['my_auths'] = my_auths
         context['user_status'] = user_status
index 585e39b..5aa4fc3 100644 (file)
                <div class="col-md-12">
                <h3>Credentials <small>Delegated to Principal Account</small></h3>
                        <table class="table">
+                                        {%if 'no_creds'  in user_cred %}
+                                               <p><a href="#" style="color:red" data-toggle="modal" data-target="#myModal">NO CREDENTIALS</a> are delegated to the portal!</p>
+                                       {%endif%}       
                                        <caption><b>Delegated User Credential</b></caption> 
                            <tr class="odd"> 
                                <th>Expiration Date</th>
                                {%endif%}
                </div>
        </div>
+<!-- Modal- No credentials -->
+<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
+            <div class="modal-dialog">
+                <div class="modal-content">
+                    <div class="modal-header">
+                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+                            <h4 class="modal-title" id="myModalLabel">No credentials are delegated to the portal</h4>
+                    </div>
+                    <div class="modal-body">
+                                       <p>You may get this message for several reasons.</p>
+                                       <h3>Account Delegation: Automatic</h3>
+                                       <ul>
+                                               <li>If you press the "Clear Credentials" button</li>
+                                               <li>If you "Generate a new key pair"</li>
+                                               <li>If a new slice is added to your account</li>
+                                       </ul>
+                                       <p>In all the above mentioned cases, it is sufficient to refresh the page or go back to home page. The portal will regenrate your credentials.
+                                        In some cases it may take more time than usual.</p>
+                                       <h3>Account Delegation: Manual</h3>
+                                               <p>As you have uploaded your own public key, the portal can no longer generate your credentials automatically.</p>
+                                               <p>In order for the portal to contact testbeds on your behalf, so as to list and reserve resources, you will need to
+                                               <a href="http://trac.myslice.info/wiki/InstallSfa" target="_blank">delegate your credentials to the portal.</a>
+                                       </p>
+                                       <h5>Contact support</h5>
+                                       <p>If you don't have the above mentioned cases and still have this message, please  <a href="/contact/" target="_blank">contact us</a>.</p>
+                    </div>
+                    <div class="modal-footer">
+                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
+                    </div>
+                </div>
+            </div>
+</div>
+
 
        <div class="tab-pane row" id="access">
                <div class="col-md-12">
index ad72540..fddf6ab 100644 (file)
@@ -83,7 +83,7 @@
                <br />
                        <div class="alert alert-danger" id="pkey_del_msg">
                                In order for the portal to contact testbeds on your behalf, so as to list and reserve resources, you will need to 
-                               <a href="http://trac.myslice.info/wiki/InstallSfa" target="_blank">delegate your public key to the portal.</a>
+                               <a href="http://trac.myslice.info/wiki/InstallSfa" target="_blank">delegate your credentials to the portal.</a>
                        </div>
            </div>
        </div>