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