Merge branch 'onelab' of ssh://git.onelab.eu/git/myslice into onelab
[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 </div>
11 {% if messages %}
12 <ul class="messages">
13     {% for message in messages %}
14     <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
15     {% endfor %}
16 </ul>
17 {% endif %}
18 <div class="row">
19         <div class="col-md-12">
20                 <ul class="nav nav-tabs nav-section">
21                         <li class="active"><a href="#profile">User Profile</a></li>
22                         <li><a href="#account">Account</a></li>
23                         <li><a href="#access">Testbed Access</a></li>
24                 </ul>
25     </div>
26 </div>
27 <div class="tab-content">
28         <div class="tab-pane active row" id="profile">
29                 
30                 <div class="col-md-12">
31
32                         <form id="editForm" method="post" action="account_process" enctype="multipart/form-data">
33                                 {% csrf_token %}
34                                         <table class="profile">          
35                                         <tr>
36                                                 <td colspan="2">
37                                                                 <div><h3>Platform: Myslice</h3></div>
38                                                 </td>
39                                         </tr>
40                                         <tr>
41                                                 <td class="key">Email</td>
42                                                 <td class="value">
43                                                                 <span id="emailval" class="value" >{{ person.email }}</span>
44                                                                 <button class="btn btn-default" type="button" id="edit_email" onclick="editAlert();"  title="To change your affiliation please contact the administrator">
45                                                                 <span class="glyphicon glyphicon-question-sign"></span> Edit
46                                                                 </button>
47                                                         </td>
48                                         </tr>
49                                         <tr class="odd">
50                                                         <td class="key">Password</td>
51                                                         <td class="value"> 
52                                                                 <button class="btn btn-default btn-xs" type="button" title="Password" name="edit_pass" id="edit_pass">
53                                                                         <span class="glyphicon glyphicon-edit"></span> Edit
54                                                                 </button>
55                                                                 <span id="passval"class="value">******** </span>
56                                                                 <span class="hide_this" id="span_pass">
57                                                                 <button type="button" class="btn btn-default btn-xs" title="Cancel" id="cancel_pass_change"> Cancel </button>
58                                                                 <div style='display:none;' id="pass_form">
59                                                                 <input type='hidden'  value='' /></div>
60                                                                 <table id="edit_password">
61                                                                         <tr>
62                                                                                         <td>Enter password: </td>
63                                                                                         <td class="field"> <input type="password" name="password" id="password" /> </td>
64                                                                                 </tr>
65                                                                                 <tr>
66                                                                                         <td>Confirm password: </td>
67                                                                                         <td class="field"> 
68                                                                                                 <input type="password" name="confirmpassword" id="confirmpassword" /> 
69                                                                                                 <input type="submit" class="btn btn-default btn-xs" name="submit_pass" value="Save"/> 
70                                                                                         </td>
71                                                                         </tr>
72                                                                 </table>
73                                                                 </span> 
74                                                         </td>
75                                         </tr>
76                                         <tr class="even">
77                                                         <td class="key">Full Name</td>
78                                                         <td class="value">
79                                                                 <span id="nameval" class="value" >{{ fullname }} </span>
80                                                                 <span class="hide_this" id="span_name">
81                                                                 <button type="button" class="btn btn-default btn-xs" title="Cancel" id="cancel_name_change"> Cancel </button> 
82                                                                 <div style='display:none;'><input type='hidden'  name='nameform'  /></div>
83                                                                 <input id="fname" type="text" name="fname" class="required"  maxlength="200" value="{{firstname}}" />
84                                                                 <input id="lname" type="text" name="lname" class="required"  maxlength="200" value="{{lastname}}" />
85                                                                 <input type="submit" class="btn btn-default btn-xs" name="submit_name" value="Save"/>
86                                                                 </span>
87                                                                 <button class="btn btn-default btn-xs" type="button"title="Full Name" id="edit_name">
88                                                                         <span class="glyphicon glyphicon-edit"></span> Edit
89                                                                 </button>
90                                                         </td>
91                                         </tr>
92                                         <tr class="odd">
93                                                         <td class="key">Authority</td>
94                                                         <td class="value">
95                                                                 <span id="affval" class="value">{{ authority }}</span>
96                                                                  <button class="btn btn-default btn-xs" type="button" id="edit_auth" onclick="editAlert()"  title="To change your authority please contact the administrator">
97                                                                 <span class="glyphicon glyphicon-question-sign"></span> Edit
98                                                                  </button>
99                                                         </td>
100                                                 </tr>
101                                                 {%if 'Enabled'  in user_status %}
102                                                 <tr class="even">
103                                                         <td class="key">Generate Keys</td>
104                                                         <td>
105                                                                 <input type="submit" name="generate" class="btn btn-primary" value="Generate a new Key Pair" id="generate_keypair" 
106                                                                            onclick="return confirm('Are you sure? If you do so, your current credentials will be overwritten.');" 
107                                                                            title="It will generate a new key Pair and your current credentials will be overwritten."/>
108                                                 </td> 
109                                         </tr>
110                                         <tr class="odd">
111                                                 <td class="key">Public Key</td>
112                                                 <td class="value">
113                                                                 <span id="keyval" class="value">******** </span>
114                                                                 <span class="hide_this" id="span_upload">
115                                                                         <button type="button" class="btn btn-default" title="Cancel" id="cancel_upload"> Cancel </button>
116                                                                         <div style='display:none;'>
117                                                                                 <input type='hidden'  name='upload'  /></div>
118                                                                                 <input type="file" name="pubkey" class="required" id="pubkey"/>  
119                                                                                 <input class="btn btn-default btn-xs" name="upload_key" id="upload_key"  type="submit" title="Upload your public key" value="Upload"
120                                                                                    onclick="return confirm('Are you sure? It will overwrite your current credentials and you have delegate it manually.');"/>
121                                                                 </span>
122                                                                 <div style='display:none;'> <input type='hidden'  name='dload'  /> </div> 
123                                                                 <button type="submit" name="dl_pubkey" class="btn btn-default btn-xs" title="Download your public key" id="dl_file">
124                                                                         <span class="glyphicon glyphicon-download"></span> Download
125                                                                 </button>
126                                                                 <button class="btn btn-default btn-xs" id="upload_file" type="button" title="Upload a public key">
127                                                                         <span class="glyphicon glyphicon-upload"></span> Upload
128                                                                 </button>       
129                                                 </td>
130                                         </tr>
131                                         <tr class="even" id="pkey_row">
132                                                  {%if 'N/A' not in user_private_key%}
133                                                 <td class="key">Private Key </td> <!-- Hide if priv_key doesn't exist in myslice platform   -->
134                                                 <td class="value">********<a href="#"></a>
135                                                         <button type="submit" name="dl_pkey" class="btn btn-default" title="Download your privaye key" id="dl_pkey">
136                                                                         <span class="glyphicon glyphicon-download"></span> Download     
137                                                                 </button>
138                                                         <input class="btn btn-danger btn-xs" id="delete" name="delete" type="submit"  value="Delete" title="Delete your private key"
139                                                                                 onclick="return confirm('Are you sure? If you do so, you have to delegate your credentials manually.');"/> 
140                                                 </td>
141                                                   {%else%}
142                                                         <td class="key">Private Key </td> <!-- Hide if priv_key doesn't exist in myslice platform   -->
143                                                         <td class="value">********<a href="#"></a>
144                                                         <button type="submit" name="dl_pkey" class="btn btn-default disabled" title="Download your privaye key" id="dl_pkey">
145                                                                 <span class="glyphicon glyphicon-download"></span> Download 
146                                                         </button>
147                                                         <input class="btn btn-danger btn-xs disabled" id="delete" name="delete" type="submit" title="Delete your private key" value="Delete" />
148                                                         </td>
149                                                  {%endif%}              
150                                                 </tr>
151                                                 <tr class="even">
152                                                 <td colspan="2">
153                                                         <p class="message" id="pkey_del_msg"><b> Tradeoff:</b> Ease-of-use vs Security.<br>
154                                                                         <b>Ease-of-use:</b> Automatic account delegation. Don't delete private key.<br>
155                                                                         <b>Security:</b> Manual account delegation. Download & Delete private key.
156                                                                 </p>
157                                                 </td>
158                                                 </tr>
159                                                 {%endif%}
160                                         </table>
161                         
162                 </div>
163         </div>
164
165         <div class="tab-pane row" id="account">
166                 <div class="col-md-12">
167         
168                 <h3>Principal Account <small>Account used for delegating credentials</small></h3>
169                 <table class="table"> 
170                         <tr class="odd"> 
171                         <th>Platform</th> 
172                         <th>Account Type</th>
173                                 <th>Account Delegation</th>
174                         <th>User hrn</th>
175                                 <th>User Status</th>
176                         <!--<th>Pub Key</th> -->
177                 </tr>   
178                         {% for row in principal_acc %}         
179                         <tr class="border_bottom">
180                         <td class="odd"> {{ row.platform_name }} </td>
181                         <td class="odd"> {{ row.account_type }} </td>
182                                 <td class="odd"> {{ row.delegation_type }} </td>
183                         <td class="odd"> {{ row.usr_hrn }}  </td>
184                                 <td class="odd"> {{ row.user_status }}  </td>
185                 <!--    <td class="even"> {{ row.usr_pubkey }} </td> -->
186                 </tr> 
187                         {%endfor%}               
188                 </table>
189         
190                 </div>
191         
192
193         {%if 'Enabled'  in user_status %}
194                 <div class="col-md-12">
195                 <h3>Credentials <small>Delegated to Principal Account</small></h3>
196                         <table class="table">
197                                         <caption><b>Delegated User Credential</b></caption> 
198                             <tr class="odd"> 
199                                 <th>Expiration Date</th>
200                                                 <th>Download</th>
201                             </tr>
202                                         {% for row in my_users %}         
203                                         <tr class="border_bottom">
204                                         <td class="odd"> {{ row.cred_exp }} </td>
205                                                 <td class="odd">
206                                                         <button class="btn btn-default btn-xs" name= "dl_user_cred" type="submit" title="Download User Credential">
207                                                                 <span class="glyphicon glyphicon-download"></span> Credential
208                                                         </button>
209                                                         <button class="btn btn-default btn-xs" name= "dl_user_cert" type="submit" title="Download User Certificate">
210                                                                 <span class="glyphicon glyphicon-download"></span> Certificate
211                                                         </button>
212                              <button class="btn btn-default btn-xs" name= "dl_user_p12" type="submit" title="Download User PKCS12">
213                                  <span class="glyphicon glyphicon-download"></span> PKCS p12
214                              </button>
215                                                 </td>
216                                         </tr>
217                                         {%endfor%}
218                                  </table>
219                                 <p></p>
220                                 <table class="mytable table table-bordered table-hover">
221                                         <caption><b>Delegated Slice Credentials</b></caption>  
222                                 <tr class="odd"> 
223                                                 <th>Slice Name</th> 
224                                         <th>Expiration Date</th>
225                                                 <th>Download</th>
226                                 </tr>
227                                         {% for row in my_slices %}     
228                                 <tr class="border_bottom">
229                                         <td class="odd"> {{ row.slice_name }} </td>
230                                                 <td class="odd"> {{ row.cred_exp }} </td>
231                                                 <td class="odd"> 
232                                                         <button class="btn btn-default btn-xs" name= "dl_{{row.slice_name}}" type="submit" title="Download Slice Credentials">
233                                                                 <span class="glyphicon glyphicon-download"></span> Download
234                                                         </button> 
235                                                 </td>
236                                 </tr>
237                                 {%endfor%}
238                                 </table>
239                                 <p></p>
240                                 <table class="mytable table table-bordered table-hover">
241                                         <caption><b>Delegated Authority Credentials</b></caption>
242                                         <tr class="odd"> 
243                                         <th>Authority Name</th> 
244                                         <th>Expiration Date</th>
245                                                 <th>Download</th>
246                                         </tr>
247                                         {% for row in my_auths %}
248                                         <tr class="border_bottom">
249                                         <td class="odd"> {{ row.auth_name }} </td>
250                                         <td class="odd"> {{ row.cred_exp }} </td>
251                                                 <td class="odd">
252                                                         <button class="btn btn-default btn-xs" name= "dl_{{row.auth_name}}" type="submit" title="Download Authority Credentials">
253                                                                 <span class="glyphicon glyphicon-download"></span> Download
254                                                         </button>
255                                                 </td>
256                                         </tr>
257                                         {%endfor%}
258                                 </table>
259                                 <p></p>
260                                  {%if '' not in my_users%}      
261                                 <p><button class="btn btn-danger btn-lg btn-block"   name= "clear_cred" type="submit" title="Clear All Credentials">Clear Credentials</button></p>
262                                 {%else%}
263                                 <p><button class="btn btn-danger btn-lg btn-block disabled"   name= "clear_cred" type="submit" title="Clear All Credentials">Clear Credentials</button></p>
264                                 {%endif%}
265                 </div>
266         </div>
267
268         <div class="tab-pane row" id="access">
269                 <div class="col-md-12">
270         
271                 <h3>Testbed Access <small>Reference Accounts in the following testbeds</small></h3>
272         <table class="mytable table table-bordered table-hover"> 
273             <tr class="odd"> 
274                 <th>Platform</th> 
275                 <th>Account Type</th>
276                                 <th>Reference to</th>
277                                 <th>Remove Account</th>
278             </tr>   
279             {% for row in ref_acc %}         
280             <tr class="border_bottom">
281                 <td class="odd"> {{ row.platform_name }} </td>
282                 <td class="odd"> {{ row.account_type }} </td>
283                                 <td class="odd"> {{ row.account_reference }} </td>
284                                 <td class="odd">
285                                 <button class="btn btn-danger" name="delete_{{row.platform_name}}" type="submit" title="Delete account from this platform">
286                                                 <span class="glyphicon glyphicon-minus"></span>
287                                         </button>
288                                 </td>
289             </tr> 
290             {%endfor%}               
291         </table>                
292                 
293                 
294                 <h3>Add reference account to the following testbeds</h3>
295         <table class="mytable table table-bordered table-hover"> 
296             <tr class="odd"> 
297                 <th>Platforms</th> 
298                 <th>Add Account</th>
299             </tr>   
300             {% for platform in platform_list %}         
301             <tr class="border_bottom">
302                 <td class="odd"> {{ platform.platform_no_access }} </td>
303                 <td class="odd">
304                                         <button class="btn btn-success btn-sm" name= "add_{{platform.platform_no_access}}" type="submit" title="Add account to this platform">
305                                                 <span class="glyphicon glyphicon-plus"></span>
306                                         </button>
307                                 </td>
308             </tr> 
309             {%endfor%}               
310         </table>
311         </div>
312 {%endif%} 
313 </div>
314 </form>
315 </div>
316
317 <script>
318     $(document).ready(function() {
319         $('.nav-tabs a').click(function (e) {
320                         e.preventDefault();
321                         $(this).tab('show');
322                         id = $(this).attr('href').substr(1);
323                 
324                 });
325                 
326         $('button#createslice').click(function() {
327             window.location="/portal/slice_request/";
328         });
329     });
330 </script>
331
332 {% endblock %}