7ac957827c395891651fd4cc3e4c9b9279d06c6d
[myslice.git] / portal / templates / onelab / onelab_account-view.html
1 {% extends "layout.html" %}
2 {% block content %}
3
4 <div class="row">
5         <div class="col-md-12">
6                  <div class="breadcrumbs">
7                          Account &nbsp;>&nbsp; <a href="/account">{{ person.email }}</a>
8                  </div>
9         </div>
10          {%if 'no_creds'  in user_cred %}
11     <p class="command"><a href="#" style="color:red" data-toggle="modal" data-target="#myModal">NO CREDENTIALS</a> are delegated to the portal!</p>
12     {%endif%}
13          {%if 'creds_expired'  in user_cred %}
14     <p class="command"><a href="#" style="color:red" data-toggle="modal" data-target="#myModal">EXPIRED CREDENTIALS</a> Please delegate again your credentials to the portal!</p>
15     {%endif%}
16
17 </div>
18 {% if messages %}
19 <ul class="messages">
20     {% for message in messages %}
21     <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
22     {% endfor %}
23 </ul>
24 {% endif %}
25 <div class="row">
26         <div class="col-md-12">
27                 <ul class="nav nav-tabs nav-section">
28                         <li class="active"><a href="#profile">User Profile</a></li>
29                         <li><a href="#account">Account</a></li>
30                         <li><a href="#access">Testbed Access</a></li>
31                 </ul>
32     </div>
33 </div>
34 <div class="tab-content">
35         <div class="tab-pane active row" id="profile">
36                 
37                 <div class="col-md-12">
38
39                         <form id="editForm" method="post" action="account_process" enctype="multipart/form-data">
40                                 {% csrf_token %}
41                                         <table class="profile">          
42                                         <tr>
43                                                 <td colspan="2">
44                                                                 <div><h3>Platform: Myslice</h3></div>
45                                                 </td>
46                                         </tr>
47                                         <tr>
48                                                 <td class="key">Email</td>
49                                                 <td class="value">
50                                                                 <span id="emailval" class="value" >{{ person.email }}</span>
51                                                                 <button class="btn btn-default" type="button" id="edit_email" onclick="editAlert();"  title="To change your affiliation please contact the administrator">
52                                                                 <span class="glyphicon glyphicon-question-sign"></span> Edit
53                                                                 </button>
54                                                         </td>
55                                         </tr>
56                                         <tr class="odd">
57                                                         <td class="key">Password</td>
58                                                         <td class="value"> 
59                                                                 <button class="btn btn-default btn-xs" type="button" title="Password" name="edit_pass" id="edit_pass">
60                                                                         <span class="glyphicon glyphicon-edit"></span> Edit
61                                                                 </button>
62                                                                 <span id="passval"class="value">******** </span>
63                                                                 <span class="hide_this" id="span_pass">
64                                                                 <button type="button" class="btn btn-default btn-xs" title="Cancel" id="cancel_pass_change"> Cancel </button>
65                                                                 <div style='display:none;' id="pass_form">
66                                                                 <input type='hidden'  value='' /></div>
67                                                                 <table id="edit_password">
68                                                                         <tr>
69                                                                                         <td>Enter password: </td>
70                                                                                         <td class="field"> <input type="password" name="password" id="password" /> </td>
71                                                                                 </tr>
72                                                                                 <tr>
73                                                                                         <td>Confirm password: </td>
74                                                                                         <td class="field"> 
75                                                                                                 <input type="password" name="confirmpassword" id="confirmpassword" /> 
76                                                                                                 <input type="submit" class="btn btn-default btn-xs" name="submit_pass" value="Save"/> 
77                                                                                         </td>
78                                                                         </tr>
79                                                                 </table>
80                                                                 </span> 
81                                                         </td>
82                                         </tr>
83                                         <tr class="even">
84                                                         <td class="key">Full Name</td>
85                                                         <td class="value">
86                                                                 <span id="nameval" class="value" >{{ fullname }} </span>
87                                                                 <span class="hide_this" id="span_name">
88                                                                 <button type="button" class="btn btn-default btn-xs" title="Cancel" id="cancel_name_change"> Cancel </button> 
89                                                                 <div style='display:none;'><input type='hidden'  name='nameform'  /></div>
90                                                                 <input id="fname" type="text" name="fname" class="required"  maxlength="200" value="{{firstname}}" />
91                                                                 <input id="lname" type="text" name="lname" class="required"  maxlength="200" value="{{lastname}}" />
92                                                                 <input type="submit" class="btn btn-default btn-xs" name="submit_name" value="Save"/>
93                                                                 </span>
94                                                                 <button class="btn btn-default btn-xs" type="button"title="Full Name" id="edit_name">
95                                                                         <span class="glyphicon glyphicon-edit"></span> Edit
96                                                                 </button>
97                                                         </td>
98                                         </tr>
99                                         <tr class="odd">
100                                                         <td class="key">Authority</td>
101                                                         <td class="value">
102                                                                 <span id="affval" class="value">{{ authority }}</span>
103                                                                  <button class="btn btn-default btn-xs" type="button" id="edit_auth" onclick="editAlert()"  title="To change your authority please contact the administrator">
104                                                                 <span class="glyphicon glyphicon-question-sign"></span> Edit
105                                                                  </button>
106                                                         </td>
107                                                 </tr>
108                                                 {%if 'Enabled'  in user_status %}
109                                                 <tr class="even">
110                                                         <td class="key">Generate Keys</td>
111                                                         <td>
112                                                                 <input type="submit" name="generate" class="btn btn-primary" value="Generate a new Key Pair" id="generate_keypair" 
113                                                                            onclick="return confirm('Are you sure? If you do so, your current credentials will be overwritten.');" 
114                                                                            title="It will generate a new key Pair and your current credentials will be overwritten."/>
115                                                 </td> 
116                                         </tr>
117                                         <tr class="odd">
118                                                 <td class="key">Public Key</td>
119                                                 <td class="value">
120                                                                 <span id="keyval" class="value">******** </span>
121                                                                 <span class="hide_this" id="span_upload">
122                                                                         <button type="button" class="btn btn-default" title="Cancel" id="cancel_upload"> Cancel </button>
123                                                                         <div style='display:none;'>
124                                                                                 <input type='hidden'  name='upload'  /></div>
125                                                                                 <input type="file" name="pubkey" class="required" id="pubkey"/>  
126                                                                                 <input class="btn btn-default btn-xs" name="upload_key" id="upload_key"  type="submit" title="Upload your public key" value="Upload"
127                                                                                    onclick="return confirm('Are you sure? It will overwrite your current credentials and you have delegate it manually.');"/>
128                                                                 </span>
129                                                                 <div style='display:none;'> <input type='hidden'  name='dload'  /> </div> 
130                                                                 <button type="submit" name="dl_pubkey" class="btn btn-default btn-xs" title="Download your public key" id="dl_file">
131                                                                         <span class="glyphicon glyphicon-download"></span> Download
132                                                                 </button>
133                                                                 <button class="btn btn-default btn-xs" id="upload_file" type="button" title="Upload a public key">
134                                                                         <span class="glyphicon glyphicon-upload"></span> Upload
135                                                                 </button>       
136                                                 </td>
137                                         </tr>
138                                         <tr class="even" id="pkey_row">
139                                                  {%if 'N/A' not in user_private_key%}
140                                                 <td class="key">Private Key </td> <!-- Hide if priv_key doesn't exist in myslice platform   -->
141                                                 <td class="value">********<a href="#"></a>
142                                                         <button type="submit" name="dl_pkey" class="btn btn-default" title="Download your privaye key" id="dl_pkey">
143                                                                         <span class="glyphicon glyphicon-download"></span> Download     
144                                                                 </button>
145                                                         <input class="btn btn-danger btn-xs" id="delete" name="delete" type="submit"  value="Delete" title="Delete your private key"
146                                                                                 onclick="return confirm('Are you sure? If you do so, you have to delegate your credentials manually.');"/> 
147                                                 </td>
148                                                   {%else%}
149                                                         <td class="key">Private Key </td> <!-- Hide if priv_key doesn't exist in myslice platform   -->
150                                                         <td class="value">********<a href="#"></a>
151                                                         <button type="submit" name="dl_pkey" class="btn btn-default disabled" title="Download your privaye key" id="dl_pkey">
152                                                                 <span class="glyphicon glyphicon-download"></span> Download 
153                                                         </button>
154                                                         <input class="btn btn-danger btn-xs disabled" id="delete" name="delete" type="submit" title="Delete your private key" value="Delete" />
155                                                         </td>
156                                                  {%endif%}              
157                                                 </tr>
158                                                 <tr class="even">
159                                                 <td colspan="2">
160                                                                 <p class="command">
161                                                                         <a href="#" style="color:green" data-toggle="modal" data-target="#tradeoffmodal">Automatic vs. Manual delegation of credentials:</a>
162                                                                         Trade-off between ease-of-use & security</p>
163                                                                 </p>
164                                                 </td>
165                                                 </tr>
166                                                 {%endif%}
167                                         </table>
168                         
169                 </div>
170         </div>
171
172         <div class="tab-pane row" id="account">
173                 <div class="col-md-12">
174         
175                 <h3>Principal Account <small>Account used for delegating credentials</small></h3>
176                 <table class="table"> 
177                         <tr class="odd"> 
178                         <th>Platform</th> 
179                         <th>Account Type</th>
180                                 <th>Account Delegation</th>
181                         <th>User hrn</th>
182                                 <th>User Status</th>
183                         <!--<th>Pub Key</th> -->
184                 </tr>   
185                         {% for row in principal_acc %}         
186                         <tr class="border_bottom">
187                         <td class="odd"> {{ row.platform_name }} </td>
188                         <td class="odd"> {{ row.account_type }} </td>
189                                 <td class="odd"> {{ row.delegation_type }} </td>
190                         <td class="odd"> {{ row.usr_hrn }}  </td>
191                                 <td class="odd"> {{ row.user_status }}  </td>
192                 <!--    <td class="even"> {{ row.usr_pubkey }} </td> -->
193                 </tr> 
194                         {%endfor%}               
195                 </table>
196         
197                 </div>
198         
199
200         {%if 'Enabled'  in user_status %}
201                 <div class="col-md-12">
202                 <h3>Credentials <small>Delegated to Principal Account</small></h3>
203                         <table class="table">
204                                         <caption><b>Delegated User Credential</b></caption> 
205                             <tr class="odd"> 
206                                 <th>Expiration Date</th>
207                                                 <th>Download</th>
208                             </tr>
209                                         {% for row in my_users %}         
210                                         <tr class="border_bottom">
211                                         <td class="odd"> {{ row.cred_exp }} </td>
212                                                 <td class="odd">
213                                                         <button class="btn btn-default btn-xs" name= "dl_user_cred" type="submit" title="Download User Credential">
214                                                                 <span class="glyphicon glyphicon-download"></span> Credential
215                                                         </button>
216                                                         <button class="btn btn-default btn-xs" name= "dl_user_cert" type="submit" title="Download User Certificate">
217                                                                 <span class="glyphicon glyphicon-download"></span> Certificate
218                                                         </button>
219                              <button class="btn btn-default btn-xs" name= "dl_user_p12" type="submit" title="Download User PKCS12">
220                                  <span class="glyphicon glyphicon-download"></span> PKCS p12
221                              </button>
222                                                 </td>
223                                         </tr>
224                                         {%endfor%}
225                                  </table>
226                                 <p></p>
227                                 <table class="mytable table table-bordered table-hover">
228                                         <caption><b>Delegated Slice Credentials</b></caption>  
229                                 <tr class="odd"> 
230                                                 <th>Slice Name</th> 
231                                         <th>Expiration Date</th>
232                                                 <th>Download</th>
233                                 </tr>
234                                         {% for row in my_slices %}     
235                                 <tr class="border_bottom">
236                                         <td class="odd"> {{ row.slice_name }} </td>
237                                                 <td class="odd"> {{ row.cred_exp }} </td>
238                                                 <td class="odd"> 
239                                                         <button class="btn btn-default btn-xs" name= "dl_{{row.slice_name}}" type="submit" title="Download Slice Credentials">
240                                                                 <span class="glyphicon glyphicon-download"></span> Download
241                                                         </button> 
242                                                 </td>
243                                 </tr>
244                                 {%endfor%}
245                                 </table>
246                                 <p></p>
247                                 <table class="mytable table table-bordered table-hover">
248                                         <caption><b>Delegated Authority Credentials</b></caption>
249                                         <tr class="odd"> 
250                                         <th>Authority Name</th> 
251                                         <th>Expiration Date</th>
252                                                 <th>Download</th>
253                                         </tr>
254                                         {% for row in my_auths %}
255                                         <tr class="border_bottom">
256                                         <td class="odd"> {{ row.auth_name }} </td>
257                                         <td class="odd"> {{ row.cred_exp }} </td>
258                                                 <td class="odd">
259                                                         <button class="btn btn-default btn-xs" name= "dl_{{row.auth_name}}" type="submit" title="Download Authority Credentials">
260                                                                 <span class="glyphicon glyphicon-download"></span> Download
261                                                         </button>
262                                                 </td>
263                                         </tr>
264                                         {%endfor%}
265                                 </table>
266                                 <p></p>
267                                  {%if '' not in my_users%}      
268                                 <p><button class="btn btn-danger btn-lg btn-block"   name= "clear_cred" type="submit" title="Clear All Credentials">Clear Credentials</button></p>
269                                 {%else%}
270                                 <p><button class="btn btn-danger btn-lg btn-block disabled"   name= "clear_cred" type="submit" title="Clear All Credentials">Clear Credentials</button></p>
271                                 {%endif%}
272                 </div>
273         </div>
274 <!-- Modal- No credentials -->
275 <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
276             <div class="modal-dialog">
277                 <div class="modal-content">
278                     <div class="modal-header">
279                         <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
280                             <h4 class="modal-title" id="myModalLabel">No credentials are delegated to the portal</h4>
281                     </div>
282                                         <div class="modal-body" style="text-align:justify;">
283                                         <p>You are getting this message for any of the following reasons:</p>
284                                         <ul>
285                                                 <li>If your account is still pending for validation</li>
286                                                 <li>If you press the "Clear Credentials" button</li>
287                                                 <li>If you "Generate a new key pair"</li>
288                                                 <li>If a new slice is added to your account</li>
289                                         </ul>
290                                         <p>Unless your account has not yet been validated, it is sufficient to refresh the page or go back to the home page. 
291                                                 The portal will then regenerate your credentials. In some cases it may take more time than usual. If nothing works, 
292                                                 then please logout and login back into to the portal.
293                                         </p>
294                                         <h3>Manual delegation of credentials</h3>
295                                                 <p>
296                                                         You have selected upon sign-up to upload your public key. As you have uploaded your own public key, 
297                                                         the portal can no longer generate your credentials automatically. In order to have your credentials 
298                                                         delegated to the portal, please follow these instructions:
299                                                 </p>
300                                                 <ul>
301                                                         <li>Your account must first be validated by the manager of your organization.</li>
302                                                         <li>In order for the portal to contact testbeds on your behalf, so as to list and reserve resources, you will need to
303                                                                 <a href="/portal/manual_delegation" target="_blank">delegate your credentials to the portal.</a></li>
304                                                 </ul>
305                                         </p>
306                                         <h3>Contact support</h3>
307                                         <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>
308                     </div>
309                     <div class="modal-footer">
310                         <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
311                     </div>
312                 </div>
313             </div>
314 </div>
315
316
317 <!-- Modal- Trade-off Message  -->
318 <div class="modal fade" id="tradeoffmodal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
319             <div class="modal-dialog">
320                 <div class="modal-content">
321                     <div class="modal-header">
322                         <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
323                             <h4 class="modal-title" id="myModalLabel">
324                                                                 Automatic vs. Manual delegation of credentials
325                                                         </h4>
326                     </div>
327                                         <div class="modal-body" style="text-align:justify;">
328                                         <h3>Automatic delegation of credentials</h3>
329                                                 <p>Don't delete private key, ease-of-use option:</p>
330                                                 <ul>
331                                                         <li>
332                                                                 This means that you will keep your private key in the portal and it will automatically delegate your credentials on your behalf.
333                                                         </li>
334                                                         <li>
335                                                                 This option does not provide as high of a level of security; however, your private key will still only be used in the portal and 
336                                                                 will be available to you and the OneLab admins only.
337                                                         </li>
338                                                 </ul>
339                                         <h3>Manual delegation of credentials</h3>
340                                                 <p>Download & Delete private key, higher security option:</p>
341                                                 <ul>
342                                                         <li>If you delete your private key, you will have more security but the portal will no longer be able to delegate credentials 
343                                                                 on your behalf, and you will have to manually
344                                                                 <a href="/portal/manual_delegation" target="_blank">delegate your credentials to the portal.</a>
345                                                         </li>
346                                                 </ul>
347                                         <h3>Contact support</h3>
348                                         <p>For more information, please  <a href="/contact/" target="_blank">contact us</a>.</p>
349                     </div>
350                     <div class="modal-footer">
351                         <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
352                     </div>
353                 </div>
354             </div>
355 </div>
356
357
358
359         <div class="tab-pane row" id="access">
360                 <div class="col-md-12">
361         
362                 <h3>Testbed Access <small>Reference Accounts in the following testbeds</small></h3>
363         <table class="mytable table table-bordered table-hover"> 
364             <tr class="odd"> 
365                 <th>Platform</th> 
366                 <th>Account Type</th>
367                                 <th>Reference to</th>
368                                 <th>Remove Account</th>
369             </tr>   
370             {% for row in ref_acc %}         
371             <tr class="border_bottom">
372                 <td class="odd"> {{ row.platform_name }} </td>
373                 <td class="odd"> {{ row.account_type }} </td>
374                                 <td class="odd"> {{ row.account_reference }} </td>
375                                 <td class="odd">
376                                 <button class="btn btn-danger" name="delete_{{row.platform_name}}" type="submit" title="Delete account from this platform">
377                                                 <span class="glyphicon glyphicon-minus"></span>
378                                         </button>
379                                 </td>
380             </tr> 
381             {%endfor%}               
382         </table>                
383                 
384                 
385                 <h3>Add reference account to the following testbeds</h3>
386         <table class="mytable table table-bordered table-hover"> 
387             <tr class="odd"> 
388                 <th>Platforms</th> 
389                 <th>Add Account</th>
390             </tr>   
391             {% for platform in platform_list %}         
392             <tr class="border_bottom">
393                 <td class="odd"> {{ platform.platform_no_access }} </td>
394                 <td class="odd">
395                                         <button class="btn btn-success btn-sm" name= "add_{{platform.platform_no_access}}" type="submit" title="Add account to this platform">
396                                                 <span class="glyphicon glyphicon-plus"></span>
397                                         </button>
398                                 </td>
399             </tr> 
400             {%endfor%}               
401         </table>
402         </div>
403 {%endif%} 
404 </div>
405 </form>
406 </div>
407
408 <script>
409     $(document).ready(function() {
410         $('.nav-tabs a').click(function (e) {
411                         e.preventDefault();
412                         $(this).tab('show');
413                         id = $(this).attr('href').substr(1);
414                 
415                 });
416                 
417         $('button#createslice').click(function() {
418             window.location="/portal/slice_request/";
419         });
420     });
421 </script>
422
423 {% endblock %}