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