Merge branch 'onelab' of ssh://git.onelab.eu/git/myslice into onelab
[unfold.git] / portal / templates / manageuserview.html
1 {% extends "layout.html" %}
2 {% block content %}
3
4 <div class="row">
5         <div class="col-md-12">
6         <h1><img src="{{ STATIC_URL }}icons/users-xs.png" alt="Manage Users" /> Manage Users</h1>
7         </div>
8 </div>
9
10
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
19 <div class="row">
20     <ul class="nav nav-tabs">
21       <li class="active"><a class="home-tab" data-panel="user_profile" href="#">User Profile</a></li>
22       <li><a class="home-tab" data-panel="principal_acc" href="#">User Account</a></li>
23       <li><a class="home-tab" data-panel="ref_acc" href="#">Testbed Access</a></li>
24     </ul>
25         <div class="home-panel" id="user_profile">
26         <form id="editForm"  method="POST" action="{{user_email}}/user_process" enctype="multipart/form-data">
27         <div id="middle" align="center">
28                 <div class="well">
29                         {% csrf_token %}
30                                 <table class="profile">          
31                                 <tr class="odd">
32                                         <td colspan="2">
33                                                         <div id="info">Platform: Myslice</div>
34                                         </td>
35                                 </tr>
36                                         <tr class="even">
37                                         <td class="key">Email</td>
38                                         <td class="value"> <span id="emailval" class="value" >{{ user_email }}</span> </td>
39                                         </tr>
40                                 <tr class="odd">
41                                                 <td class="key">Full Name</td>
42                                                 <td class="value">
43                                                         <span id="nameval" class="value" >{{ fullname }} </span>
44                                                         <span class="hide_this" id="span_name">
45                                                         <button type="button" class="btn btn-default btn-xs" title="Cancel" id="cancel_name_change"> Cancel </button> 
46                                                         <div style='display:none;'><input type='hidden'  name='nameform'  /></div>
47                                                         <input id="fname" type="text" name="fname" class="required"  maxlength="200" value="{{firstname}}" />
48                                                         <input id="lname" type="text" name="lname" class="required"  maxlength="200" value="{{lastname}}" />
49                                                         <input type="submit" class="btn btn-default btn-xs" name="submit_name" value="Save"/>
50                                                         </span>
51                                                         <button class="btn btn-default btn-xs" type="button"title="Full Name" id="edit_name">
52                                                                 <span class="glyphicon glyphicon-edit"></span> Edit
53                                                         </button>
54                                                 </td>
55                                 </tr>
56                                         <tr class="even">
57                                         <td class="key">Authority</td>
58                                         <td class="value">
59                                                 <span id="authval" class="value" >{{ authority }} </span>
60                                                 <span class="hide_this" id="span_auth">
61                                                 <button type="button" class="btn btn-default btn-xs" title="Cancel" id="cancel_auth_change"> Cancel </button>
62                                                 <div style='display:none;'><input type='hidden'  name='authform'  /></div>
63                                                 <input id="authority" type="text" name="authority" class="required"  maxlength="200" value="{{authority}}" />
64                                                 <input type="submit" class="btn btn-default btn-xs" name="submit_auth" value="Save"/>
65                                                 </span>
66                                                 <button class="btn btn-default btn-xs" type="button"title="auth" id="edit_auth">
67                                                 <span class="glyphicon glyphicon-edit"></span> Edit
68                                                 </button>
69                                         </td>
70                                         </tr>     
71                                         <tr class="odd">
72                                                 <td class="key">Generate Keys</td>
73                                                 <td>
74                                                         <input type="submit" name="generate" class="btn btn-danger btn-xs" value="Generate a new Key Pair" id="generate_keypair" 
75                                                                    onclick="return confirm('Are you sure? If you do so, your current credentials will be overwritten.');" 
76                                                                    title="It will generate a new key Pair and your current credentials will be overwritten."/>
77                                         </td> 
78                                 </tr>
79                                 <tr class="even">
80                                         <td class="key">Public Key</td>
81                                         <td class="value">
82                                                         <span id="keyval" class="value">******** </span>
83                                                         <span class="hide_this" id="span_upload">
84                                                                 <button type="button" class="btn btn-default btn-xs" title="Cancel" id="cancel_upload"> Cancel </button>
85                                                                 <div style='display:none;'>
86                                                                         <input type='hidden'  name='upload'  /></div>
87                                                                         <input type="file" name="pubkey" class="required" id="pubkey"/>  
88                                                                         <input class="btn btn-default btn-xs" name="upload_key" id="upload_key"  type="submit" title="Upload your public key" value="Upload"
89                                                                            onclick="return confirm('Are you sure? It will overwrite your current credentials and you have delegate it manually.');"/>
90                                                         </span>
91                                                         <div style='display:none;'> <input type='hidden'  name='dload'  /> </div> 
92                                                         <button type="submit" name="dl_pubkey" class="btn btn-default btn-xs" title="Download your public key" id="dl_file">
93                                                                 <span class="glyphicon glyphicon-download"></span> Download
94                                                         </button>
95                                                         <button class="btn btn-default btn-xs" id="upload_file" type="button" title="Upload a public key">
96                                                                 <span class="glyphicon glyphicon-upload"></span> Upload
97                                                         </button>       
98                                         </td>
99                                 </tr>
100                                         {% if not  pi %}
101                                         <tr class="odd">
102                                         <td class="key">Upgrade to PI</td>
103                                         <td>
104                                                 <input type="submit" name="makepi" class="btn btn-primary btn-xs" value="Upgrade to PI" id="makepi" 
105                                         onclick="return confirm('Are you sure? If you do so, the user will be updated to a PI');" 
106                                         title="It will make the user PI of his instution"/>
107                                         </td>
108                                         </tr>
109                                         {% else %}
110                                         <tr class="odd">
111                                         <td class="key">Downgrade to user</td>
112                                         <td>
113                                                 <input type="submit" name="removepi" class="btn btn-danger btn-xs" value="Downgrade to user" id="makepi" 
114                                                 onclick="return confirm('Are you sure? If you do so, the PI will be downgraded to a user');" 
115                                                 title="It will downgrade the PI to a user of his instution"/>
116                                         </td>
117                                         </tr>
118                                         {% endif %}
119
120                                 </table>
121                 </div>
122         </div>
123         </div>
124
125         
126         <div class="home-panel" id="principal_acc" style="display:none;">
127         <div class="row">
128                 
129         <h3>Principal Account <small>Account used for delegating credentials</small></h3>
130         
131                         <table class="table table-bordered table-hover  mytable"> 
132                                 <tr class="odd"> 
133                                 <th>Platform</th> 
134                                 <th>Account Type</th>
135                                         <th>Account Delegation</th>
136                                 <th>User hrn</th>
137                                         <th>User Status</th>
138                                 <!--<th>Pub Key</th> -->
139                         </tr>   
140                                 {% for row in principal_acc %}         
141                                 <tr class="border_bottom">
142                                 <td class="odd"> {{ row.platform_name }} </td>
143                                 <td class="odd"> {{ row.account_type }} </td>
144                                         <td class="odd"> {{ row.delegation_type }} </td>
145                                 <td class="odd"> {{ row.usr_hrn }}  </td>
146                                         <td class="odd"> {{ row.user_status }}  </td>
147                         <!--    <td class="even"> {{ row.usr_pubkey }} </td> -->
148                         </tr> 
149                                 {%endfor%}               
150                         </table>
151         </div>
152
153
154
155 {%if 'Enabled'  in user_status %}
156         <div class="row">
157         <h3>Credentials <small>Delegated to Principal Account</small></h3>
158                 <table class="mytable table table-bordered table-hover">
159                                 <caption><b>Delegated User Credential</b></caption> 
160                     <tr class="odd"> 
161                         <th>Expiration Date</th>
162                                         <th>Download</th>
163                     </tr>
164                                 {% for row in my_users %}         
165                                 <tr class="border_bottom">
166                                 <td class="odd"> {{ row.cred_exp }} </td>
167                                         <td class="odd">
168                                                 <button class="btn btn-default btn-xs" name= "dl_user_cred" type="submit" title="Download User Credential">
169                                                         <span class="glyphicon glyphicon-download"></span> Download
170                                                 </button>
171                                         </td>
172                                 </tr>
173                                 {%endfor%}
174                          </table>
175                         <p></p>
176                         <table class="mytable table table-bordered table-hover">
177                                 <caption><b>Delegated Slice Credentials</b></caption>  
178                         <tr class="odd"> 
179                                         <th>Slice Name</th> 
180                                 <th>Expiration Date</th>
181                                         <th>Download</th>
182                         </tr>
183                                 {% for row in my_slices %}     
184                         <tr class="border_bottom">
185                                 <td class="odd"> {{ row.slice_name }} </td>
186                                         <td class="odd"> {{ row.cred_exp }} </td>
187                                         <td class="odd"> 
188                                                 <button class="btn btn-default btn-xs" name= "dl_{{row.slice_name}}" type="submit" title="Download Slice Credentials">
189                                                         <span class="glyphicon glyphicon-download"></span> Download
190                                                 </button> 
191                                         </td>
192                         </tr>
193                         {%endfor%}
194                         </table>
195                         <p></p>
196                         <table class="mytable table table-bordered table-hover">
197                                 <caption><b>Delegated Authority Credentials</b></caption>
198                                 <tr class="odd"> 
199                                 <th>Authority Name</th> 
200                                 <th>Expiration Date</th>
201                                         <th>Download</th>
202                                 </tr>
203                                 {% for row in my_auths %}
204                                 <tr class="border_bottom">
205                                 <td class="odd"> {{ row.auth_name }} </td>
206                                 <td class="odd"> {{ row.cred_exp }} </td>
207                                         <td class="odd">
208                                                 <button class="btn btn-default btn-xs" name= "dl_{{row.auth_name}}" type="submit" title="Download Authority Credentials">
209                                                         <span class="glyphicon glyphicon-download"></span> Download
210                                                 </button>
211                                         </td>
212                                 </tr>
213                                 {%endfor%}
214                         </table>
215                         <p></p>
216                          {%if '' not in my_users%}      
217                         <p><button class="btn btn-danger btn-lg btn-block"   name= "clear_cred" type="submit" title="Clear All Credentials">Clear Credentials</button></p>
218                         {%else%}
219                         <p><button class="btn btn-danger btn-lg btn-block disabled"   name= "clear_cred" type="submit" title="Clear All Credentials">Clear Credentials</button></p>
220                         {%endif%}
221         </div>
222 </div>
223
224
225         <div class="home-panel" id="ref_acc" style="display:none;">
226                 <h3>Testbed Access <small>Reference Accounts in the following testbeds</small></h3>
227         <table class="mytable table table-bordered table-hover"> 
228             <tr class="odd"> 
229                 <th>Platform</th> 
230                 <th>Account Type</th>
231                                 <th>Reference to</th>
232                                 <th>Remove Account</th>
233             </tr>   
234             {% for row in ref_acc %}         
235             <tr class="border_bottom">
236                 <td class="odd"> {{ row.platform_name }} </td>
237                 <td class="odd"> {{ row.account_type }} </td>
238                                 <td class="odd"> {{ row.account_reference }} </td>
239                                 <td class="odd">
240                                 <button class="btn btn-danger btn-xs" name="delete_{{row.platform_name}}" type="submit" title="Delete account from this platform">
241                                                 <span class="glyphicon glyphicon-minus"></span>
242                                         </button>
243                                 </td>
244             </tr> 
245             {%endfor%}               
246         </table>
247
248
249                 <h3>Add reference account to the following testbeds</h3>
250
251         <table class="mytable table table-bordered table-hover"> 
252             <tr class="odd"> 
253                 <th>Platforms</th> 
254                 <th>Add Account</th>
255             </tr>   
256             {% for platform in platform_list %}         
257             <tr class="border_bottom">
258                 <td class="odd"> {{ platform.platform_no_access }} </td>
259                 <td class="odd">
260                                         <button class="btn btn-success btn-sm" name= "add_{{platform.platform_no_access}}" type="submit" title="Add account to this platform">
261                                                 <span class="glyphicon glyphicon-plus"></span>
262                                         </button>
263                                 </td>
264             </tr> 
265             {%endfor%}               
266         </table>
267     
268         </div>
269 {%endif%} 
270 </div>
271 </form>
272 </div>
273
274  <script>
275      $(document).ready(function() {
276          $('a.home-tab').click(function() {
277              $('ul.nav-tabs li').removeClass('active');
278              $(this).parent().addClass('active');
279              $('div.home-panel').hide();
280              $('div#'+$(this).data('panel')).show();
281          });
282          $('button#createslice').click(function() {
283              window.location="/portal/slice_request/";
284          })
285          ;$('button#slicerequestbtn').click(function() {
286              /*
287              window.location="/portal/slice_request/";
288              */
289          });
290      });
291  </script>
292
293
294 {% endblock %}