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