MyAcc: interface visibility depends on user_status
[myslice.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>User Status</th>
160                         <!--<th>Pub Key</th> -->
161                 </tr>   
162                         {% for row in principal_acc %}         
163                         <tr class="border_bottom">
164                         <td class="odd"> {{ row.platform_name }} </td>
165                         <td class="odd"> {{ row.account_type }} </td>
166                                 <td class="odd"> {{ row.delegation_type }} </td>
167                         <td class="odd"> {{ row.usr_hrn }}  </td>
168                                 <td class="odd"> {{ row.user_status }}  </td>
169                 <!--    <td class="even"> {{ row.usr_pubkey }} </td> -->
170                 </tr> 
171                         {%endfor%}               
172                 </table>
173         </div>
174 </div>
175
176
177
178 {%if 'Enabled'  in user_status %}
179 <h3 id="show-pending" class="plugin-show" style="display: block;">
180 <span class="glyphicon glyphicon-chevron-right"></span>
181 <a href="#" class="plugin-tooltip" data-toggle="tooltip" data-original-title="Show plugin &quot;Pending operations&quot; (QueryUpdater)"></a>Credentials</h3>
182
183 <div id="hide-pending" class="plugin-hide" style="display: none;">
184 <span class="glyphicon glyphicon-chevron-down"></span>
185 <a href="#" class="plugin-tooltip" data-toggle="tooltip" data-original-title="Hide plugin &quot;Pending operations&quot; (QueryUpdater)">Credentials</a>
186
187 <h5>Delegated Credentials to Principal Account</h5>
188 <div id="middle" align="center">
189     <div class="well">
190         <table class="mytable table table-bordered table-hover">
191                         <caption><b>Delegated User Credential</b></caption> 
192             <tr class="odd"> 
193                 <th>Expiration Date</th>
194                                 <th>Download</th>
195             </tr>
196                         {% for row in my_users %}         
197                         <tr class="border_bottom">
198                         <td class="odd"> {{ row.cred_exp }} </td>
199                                 <td class="odd">
200                                         <button class="btn btn-default btn-xs" name= "dl_user_cred" type="submit" title="Download User Credential">
201                                                 <span class="glyphicon glyphicon-download"></span> Download
202                                         </button>
203                                 </td>
204                         </tr>
205                         {%endfor%}
206                  </table>
207                 <p></p>
208                 <table class="mytable table table-bordered table-hover">
209                         <caption><b>Delegated Slice Credentials</b></caption>  
210                 <tr class="odd"> 
211                                 <th>Slice Name</th> 
212                         <th>Expiration Date</th>
213                                 <th>Download</th>
214                 </tr>
215                         {% for row in my_slices %}     
216                 <tr class="border_bottom">
217                         <td class="odd"> {{ row.slice_name }} </td>
218                                 <td class="odd"> {{ row.cred_exp }} </td>
219                                 <td class="odd"> 
220                                         <button class="btn btn-default btn-xs" name= "dl_{{row.slice_name}}" type="submit" title="Download Slice Credentials">
221                                                 <span class="glyphicon glyphicon-download"></span> Download
222                                         </button> 
223                                 </td>
224                 </tr>
225                 {%endfor%}
226                 </table>
227                 <p></p>
228                 <table class="mytable table table-bordered table-hover">
229                         <caption><b>Delegated Authority Credentials</b></caption>
230                         <tr class="odd"> 
231                         <th>Authority Name</th> 
232                         <th>Expiration Date</th>
233                                 <th>Download</th>
234                         </tr>
235                         {% for row in my_auths %}
236                         <tr class="border_bottom">
237                         <td class="odd"> {{ row.auth_name }} </td>
238                         <td class="odd"> {{ row.cred_exp }} </td>
239                                 <td class="odd">
240                                         <button class="btn btn-default btn-xs" name= "dl_{{row.auth_name}}" type="submit" title="Download Authority Credentials">
241                                                 <span class="glyphicon glyphicon-download"></span> Download
242                                         </button>
243                                 </td>
244                         </tr>
245                         {%endfor%}
246                 </table>
247                 <p></p>
248                  {%if '' not in my_users%}      
249                 <p><button class="btn btn-danger btn-lg btn-block"   name= "clear_cred" type="submit" title="Clear All Credentials">Clear Credentials</button></p>
250                 {%else%}
251                 <p><button class="btn btn-danger btn-lg btn-block disabled"   name= "clear_cred" type="submit" title="Clear All Credentials">Clear Credentials</button></p>
252                 {%endif%}
253     </div>
254 </div>
255 </div>
256
257
258 <h3 id="show-filters" class="plugin-show" style="display: block;">
259 <span class="glyphicon glyphicon-chevron-right"></span>
260 <a href="#" class="plugin-tooltip" data-toggle="tooltip" data-original-title="Show plugin &quot;Pending operations&quot; (QueryUpdater)"></a>TestBed Accounts</h3>
261
262 <div id="hide-filters" class="plugin-hide" style="display: none;">
263 <span class="glyphicon glyphicon-chevron-down"></span>
264 <a href="#" class="plugin-tooltip" data-toggle="tooltip" data-original-title="Hide plugin &quot;Pending operations&quot; (QueryUpdater)">TestBed Accounts</a>
265
266 <h5>Reference Accounts in the following testbeds</h5>
267 <div id="middle" align="center">
268     <div class="well">
269         <table class="mytable table table-bordered table-hover"> 
270             <tr class="odd"> 
271                 <th>Platform</th> 
272                 <th>Account Type</th>
273                                 <th>Reference to</th>
274                                 <th>Remove Account</th>
275             </tr>   
276             {% for row in ref_acc %}         
277             <tr class="border_bottom">
278                 <td class="odd"> {{ row.platform_name }} </td>
279                 <td class="odd"> {{ row.account_type }} </td>
280                                 <td class="odd"> {{ row.account_reference }} </td>
281                                 <td class="odd">
282                                 <button class="btn btn-danger btn-xs" name="delete_{{row.platform_name}}" type="submit" title="Delete account from this platform">
283                                                 <span class="glyphicon glyphicon-minus"></span>
284                                         </button>
285                                 </td>
286             </tr> 
287             {%endfor%}               
288         </table>
289     </div>
290 </div>
291 </div>
292
293
294 <h3 id="show-resources" class="plugin-show" style="display: block;">
295 <span class="glyphicon glyphicon-chevron-right"></span>
296 <a href="#" class="plugin-tooltip" data-toggle="tooltip" data-original-title="Show plugin &quot;Pending operations&quot; (QueryUpdater)"></a>Add Accounts</h3>
297
298 <div id="hide-resources" class="plugin-hide" style="display: none;">
299 <span class="glyphicon glyphicon-chevron-down"></span>
300 <a href="#" class="plugin-tooltip" data-toggle="tooltip" data-original-title="Hide plugin &quot;Pending operations&quot; (QueryUpdater)">Add Accounts</a>
301
302
303 <h5>Add reference account to the following testbeds</h5>
304 <div id="middle" align="center">
305     <div class="well">
306         <table class="mytable table table-bordered table-hover"> 
307             <tr class="odd"> 
308                 <th>Platforms</th> 
309                 <th>Add Account</th>
310             </tr>   
311             {% for platform in platform_list %}         
312             <tr class="border_bottom">
313                 <td class="odd"> {{ platform.platform_no_access }} </td>
314                 <td class="odd">
315                                         <button class="btn btn-success btn-sm" name= "add_{{platform.platform_no_access}}" type="submit" title="Add account to this platform">
316                                                 <span class="glyphicon glyphicon-plus"></span>
317                                         </button>
318                                 </td>
319             </tr> 
320             {%endfor%}               
321         </table>
322     </div>
323 </div>
324 </div>
325 {%endif%} 
326
327 </form>
328
329 {% endblock %}