2b99be12bd7c68d85ddf8ee8506c6bdb24743f53
[unfold.git] / portal / templates / account-view.html
1 {% extends "layout_wide.html" %}
2 {% block content %}
3
4
5 {% if messages %}
6 <ul class="messages">
7     {% for message in messages %}
8     <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
9     {% endfor %}
10 </ul>
11 {% endif %}
12 <div class="container">
13         <div class="row">
14                 <div class="col-md-12">
15                         <ul class="nav nav-tabs nav-section">
16                                 <li class="active"><a href="#profile"><img src="{{ STATIC_URL }}icons/user-xs.png" alt="User Account" /> User Profile</a></li>
17                                 <li><a href="#account">Account</a></li>
18                                 <li><a href="#access">Testbed Access</a></li>
19                         </ul>
20             </div>
21         </div>
22 </div>
23 <div class="container tab-content">
24         <div class="tab-pane active row" id="profile">
25                 
26                 <div class="col-md-12">
27
28                         <form id="editForm" method="post" action="account_process" enctype="multipart/form-data">
29                                 {% csrf_token %}
30                                         <table class="profile">          
31                                         <tr>
32                                                 <td colspan="2">
33                                                                 <div><h3>Platform: Myslice</h3></div>
34                                                 </td>
35                                         </tr>
36                                         <tr>
37                                                 <td class="key">Email</td>
38                                                 <td class="value">
39                                                                 <span id="emailval" class="value" >{{ person.email }}</span>
40                                                                 <button class="btn btn-default btn-xs" type="button" id="edit_email" onclick="editAlert();"  title="To change your affiliation please contact the administrator">
41                                                                 <span class="glyphicon glyphicon-question-sign"></span> Edit
42                                                                 </button>
43                                                         </td>
44                                         </tr>
45                                         <tr class="odd">
46                                                         <td class="key">Password</td>
47                                                         <td class="value"> 
48                                                                 <button class="btn btn-default btn-xs" type="button" title="Password" name="edit_pass" id="edit_pass">
49                                                                         <span class="glyphicon glyphicon-edit"></span> Edit
50                                                                 </button>
51                                                                 <span id="passval"class="value">******** </span>
52                                                                 <span class="hide_this" id="span_pass">
53                                                                 <button type="button" class="btn btn-default btn-xs" title="Cancel" id="cancel_pass_change"> Cancel </button>
54                                                                 <div style='display:none;' id="pass_form">
55                                                                 <input type='hidden'  value='' /></div>
56                                                                 <table id="edit_password">
57                                                                         <tr>
58                                                                                         <td>Enter password: </td>
59                                                                                         <td class="field"> <input type="password" name="password" id="password" /> </td>
60                                                                                 </tr>
61                                                                                 <tr>
62                                                                                         <td>Confirm password: </td>
63                                                                                         <td class="field"> 
64                                                                                                 <input type="password" name="confirmpassword" id="confirmpassword" /> 
65                                                                                                 <input type="submit" class="btn btn-default btn-xs" name="submit_pass" value="Save"/> 
66                                                                                         </td>
67                                                                         </tr>
68                                                                 </table>
69                                                                 </span> 
70                                                         </td>
71                                         </tr>
72                                         <tr class="even">
73                                                         <td class="key">Full Name</td>
74                                                         <td class="value">
75                                                                 <span id="nameval" class="value" >{{ fullname }} </span>
76                                                                 <span class="hide_this" id="span_name">
77                                                                 <button type="button" class="btn btn-default btn-xs" title="Cancel" id="cancel_name_change"> Cancel </button> 
78                                                                 <div style='display:none;'><input type='hidden'  name='nameform'  /></div>
79                                                                 <input id="fname" type="text" name="fname" class="required"  maxlength="200" value="{{firstname}}" />
80                                                                 <input id="lname" type="text" name="lname" class="required"  maxlength="200" value="{{lastname}}" />
81                                                                 <input type="submit" class="btn btn-default btn-xs" name="submit_name" value="Save"/>
82                                                                 </span>
83                                                                 <button class="btn btn-default btn-xs" type="button"title="Full Name" id="edit_name">
84                                                                         <span class="glyphicon glyphicon-edit"></span> Edit
85                                                                 </button>
86                                                         </td>
87                                         </tr>
88                                         <tr class="odd">
89                                                         <td class="key">Authority</td>
90                                                         <td class="value">
91                                                                 <span id="affval" class="value">{{ authority }}</span>
92                                                                  <button class="btn btn-default btn-xs" type="button" id="edit_auth" onclick="editAlert()"  title="To change your authority please contact the administrator">
93                                                                 <span class="glyphicon glyphicon-question-sign"></span> Edit
94                                                                  </button>
95                                                         </td>
96                                                 </tr>
97                                                 {%if 'Enabled'  in user_status %}
98                                                 <tr class="even">
99                                                         <td class="key">Generate Keys</td>
100                                                         <td>
101                                                                 <input type="submit" name="generate" class="btn btn-danger btn-xs" value="Generate a new Key Pair" id="generate_keypair" 
102                                                                            onclick="return confirm('Are you sure? If you do so, your current credentials will be overwritten.');" 
103                                                                            title="It will generate a new key Pair and your current credentials will be overwritten."/>
104                                                 </td> 
105                                         </tr>
106                                         <tr class="odd">
107                                                 <td class="key">Public Key</td>
108                                                 <td class="value">
109                                                                 <span id="keyval" class="value">******** </span>
110                                                                 <span class="hide_this" id="span_upload">
111                                                                         <button type="button" class="btn btn-default btn-xs" title="Cancel" id="cancel_upload"> Cancel </button>
112                                                                         <div style='display:none;'>
113                                                                                 <input type='hidden'  name='upload'  /></div>
114                                                                                 <input type="file" name="pubkey" class="required" id="pubkey"/>  
115                                                                                 <input class="btn btn-default btn-xs" name="upload_key" id="upload_key"  type="submit" title="Upload your public key" value="Upload"
116                                                                                    onclick="return confirm('Are you sure? It will overwrite your current credentials and you have delegate it manually.');"/>
117                                                                 </span>
118                                                                 <div style='display:none;'> <input type='hidden'  name='dload'  /> </div> 
119                                                                 <button type="submit" name="dl_pubkey" class="btn btn-default btn-xs" title="Download your public key" id="dl_file">
120                                                                         <span class="glyphicon glyphicon-download"></span> Download
121                                                                 </button>
122                                                                 <button class="btn btn-default btn-xs" id="upload_file" type="button" title="Upload a public key">
123                                                                         <span class="glyphicon glyphicon-upload"></span> Upload
124                                                                 </button>       
125                                                 </td>
126                                         </tr>
127                                         <tr class="even" id="pkey_row">
128                                                  {%if 'N/A' not in user_private_key%}
129                                                 <td class="key">Private Key </td> <!-- Hide if priv_key doesn't exist in myslice platform   -->
130                                                 <td class="value">********<a href="#"></a>
131                                                         <button type="submit" name="dl_pkey" class="btn btn-default btn-xs" title="Download your privaye key" id="dl_pkey">
132                                                                         <span class="glyphicon glyphicon-download"></span> Download     
133                                                                 </button>
134                                                         <input class="btn btn-danger btn-xs" id="delete" name="delete" type="submit"  value="Delete" title="Delete your private key"
135                                                                                 onclick="return confirm('Are you sure? If you do so, you have to delegate your credentials manually.');"/> 
136                                                 </td>
137                                                   {%else%}
138                                                         <td class="key">Private Key </td> <!-- Hide if priv_key doesn't exist in myslice platform   -->
139                                                         <td class="value">********<a href="#"></a>
140                                                         <button type="submit" name="dl_pkey" class="btn btn-default btn-xs disabled" title="Download your privaye key" id="dl_pkey">
141                                                                 <span class="glyphicon glyphicon-download"></span> Download 
142                                                         </button>
143                                                         <input class="btn btn-danger btn-xs disabled" id="delete" name="delete" type="submit" title="Delete your private key" value="Delete" />
144                                                         </td>
145                                                  {%endif%}              
146                                                 </tr>
147                                         <tr class="even" id="sfi_config_row">
148                                                 <td class="key">sfi_config </td>
149                                                 <td class="value">use sfi_config file with sfi.py package (pip install sfa)<a href="#"></a>
150                                                         <button type="submit" name="dl_sfi_config" class="btn btn-default btn-xs" title="Download your privaye key" id="dl_sfi_config">
151                                                                         <span class="glyphicon glyphicon-download"></span> Download 
152                                                                 </button>
153                                                 </td>
154                         </tr>
155                                                 <tr class="even">
156                                                 <td colspan="2">
157                                                         <p class="message" id="pkey_del_msg"><b> Tradeoff:</b> Ease-of-use vs Security.<br>
158                                                                         <b>Ease-of-use:</b> Automatic account delegation. Don't delete private key.<br>
159                                                                         <b>Security:</b> Manual account delegation. Download & Delete private key.
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
272         <div class="tab-pane row" id="access">
273                 <div class="col-md-12">
274         
275                 <h3>Testbed Access <small>Reference Accounts in the following testbeds</small></h3>
276         <table class="mytable table table-bordered table-hover"> 
277             <tr class="odd"> 
278                 <th>Platform</th> 
279                 <th>Account Type</th>
280                                 <th>Reference to</th>
281                                 <th>Remove Account</th>
282             </tr>   
283             {% for row in ref_acc %}         
284             <tr class="border_bottom">
285                 <td class="odd"> {{ row.platform_name }} </td>
286                 <td class="odd"> {{ row.account_type }} </td>
287                                 <td class="odd"> {{ row.account_reference }} </td>
288                                 <td class="odd">
289                                 <button class="btn btn-danger btn-xs" name="delete_{{row.platform_name}}" type="submit" title="Delete account from this platform">
290                                                 <span class="glyphicon glyphicon-minus"></span>
291                                         </button>
292                                 </td>
293             </tr> 
294             {%endfor%}               
295         </table>                
296                 
297                 
298                 <h3>Add reference account to the following testbeds</h3>
299         <table class="mytable table table-bordered table-hover"> 
300             <tr class="odd"> 
301                 <th>Platforms</th> 
302                 <th>Add Account</th>
303             </tr>   
304             {% for platform in platform_list %}         
305             <tr class="border_bottom">
306                 <td class="odd"> {{ platform.platform_no_access }} </td>
307                 <td class="odd">
308                                         <button class="btn btn-success btn-sm" name= "add_{{platform.platform_no_access}}" type="submit" title="Add account to this platform">
309                                                 <span class="glyphicon glyphicon-plus"></span>
310                                         </button>
311                                 </td>
312             </tr> 
313             {%endfor%}               
314         </table>
315         </div>
316 {%endif%} 
317 </div>
318 </form>
319 </div>
320
321 <script>
322     $(document).ready(function() {
323         $('.nav-tabs a').click(function (e) {
324                         e.preventDefault();
325                         $(this).tab('show');
326                         id = $(this).attr('href').substr(1);
327                 
328                 });
329                 
330         $('button#createslice').click(function() {
331             window.location="/portal/slice_request/";
332         });
333     });
334 </script>
335
336 {% endblock %}