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