Merge branch 'onelab' of ssh://git.onelab.eu/git/myslice into onelab
authorLoic Baron <loic.baron@lip6.fr>
Tue, 25 Mar 2014 17:01:50 +0000 (18:01 +0100)
committerLoic Baron <loic.baron@lip6.fr>
Tue, 25 Mar 2014 17:01:50 +0000 (18:01 +0100)
portal/institution.py
portal/templates/about.html
portal/templates/account-view.html
portal/templates/documentationview.html
portal/templates/institution.html
portal/templates/onelab/onelab_institution.html

index 30ef186..6c55517 100644 (file)
@@ -53,11 +53,29 @@ class InstitutionView (FreeAccessView, ThemeView):
                     env['user_details'] = {'parent_authority': user_local_authority}
             except Exception,e:
                 env['error'] = "Please check your Manifold user config"
+            ## check user is pi or not
+            platform_query  = Query().get('local:platform').select('platform_id','platform','gateway_type','disabled')
+            account_query  = Query().get('local:account').select('user_id','platform_id','auth_type','config')
+            platform_details = execute_query(self.request, platform_query)
+            account_details = execute_query(self.request, account_query)
+            for platform_detail in platform_details:
+                for account_detail in account_details:
+                    if platform_detail['platform_id'] == account_detail['platform_id']:
+                        if 'config' in account_detail and account_detail['config'] is not '':
+                            account_config = json.loads(account_detail['config'])
+                            if 'myslice' in platform_detail['platform']:
+                                acc_auth_cred = account_config.get('delegated_authority_credentials','N/A')
+            # assigning values
+            if acc_auth_cred == {}:
+                pi = "is_not_pi"
+            else:
+                pi = "is_pi"
+
         else: 
             env['person'] = None
     
         env['theme'] = self.theme
-    
+        env['pi'] = pi 
         env['username']=the_user(request)
         env['topmenu_items'] = topmenu_items(None, request)
         if state: env['state'] = state
index 4736ae6..1764fc4 100644 (file)
@@ -37,7 +37,7 @@
         your public key to <a href="mailto:support@myslice.info">support@myslice.info</a>. 
        </p>
        <p>
-               Go to the <a href ="http://myslice.info">MySlice web site</a>   
+               Go to the <a href ="http://myslice.info" target="_blank">MySlice web site</a>   
     </p>
        </div>
 </div>
index bd7269b..353a83c 100644 (file)
                                <p><button class="btn btn-danger btn-lg btn-block disabled"   name= "clear_cred" type="submit" title="Clear All Credentials">Clear Credentials</button></p>
                                {%endif%}
                </div>
-               </form>
        </div>
 
        <div class="tab-pane row" id="access">
        </div>
 {%endif%} 
 </div>
+</form>
 </div>
 
 <script>
index 1d386b8..5def24b 100644 (file)
@@ -74,7 +74,7 @@ slices that belong to his institution.</p>
 <p>In <a href="/portal/validate">Requests</a> page you will be able to see all the users that registered under your authority and the slices that users of your authority has requested. Therefore, pending users/slices are those users and slices that are yet to be validated. You can validate/reject these requests based on the policy of your institution.</p>
 
 <li><h4>How can I manage the users/slices that belong to my institution?</h4></li>
-<p>In <a href="/portal/validate">Instution</a> page, under Users tab, you will be able to see all the users that belong to your authority. You can delete the users that you don't want anymore. Under Slices tab, you will be able to see all the slices that belong to your authority. You can renew/delete the slices based on your requirements. As a PI you can also <a href="/portal/slice_request/">Create Slice</a>. Just fill the form of request slice and the slice will be automatically validated if it is requested by a PI. </p>
+<p>In <a href="/portal/institution">Instution</a> page, under Users tab, you will be able to see all the users that belong to your authority. You can delete the users that you don't want anymore. Under Slices tab, you will be able to see all the slices that belong to your authority. You can renew/delete the slices based on your requirements. As a PI you can also <a href="/portal/slice_request/">Create Slice</a>. Just fill the form of request slice and the slice will be automatically validated if it is requested by a PI. </p>
 
 </ul>
 </div>
index 7a84e9b..ea404fc 100644 (file)
        <div class="tab-pane row" id="users" data-authority="{{user_details.parent_authority}}">
                <div class="col-md-12">
                        <table class="table"><tr><td><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></td></tr></table>
+                       {%if 'is_pi'  in pi %}  
                        <div>
                                <button id="deleteusers" type="button" class="btn btn-default"><span class="glyphicon glyphicon-remove"></span> Delete Users</button>
                        </div>
+                       {%endif%}
                </div>
        </div>
        <div class="tab-pane row" id="slices">
+               {%if 'is_pi'  in pi %}
                <button id="createslice" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> create slice</button>
+               {%else%}
+               <button id="createslice" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> request slice</button>
+               {%endif%}
            <div id="slice-tab-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
            <div id="slice-tab-loaded" style="display:none;">
                <table id="slice-tab">
                    </tr>
                </table>
                <br>
+                       {%if 'is_pi'  in pi %}
                <div>
                    <button id="renewslices" type="button" class="btn btn-default"><span class="glyphicon glyphicon-refresh"></span> Renew Slices</button>
                    <button id="deleteslices" type="button" class="btn btn-default"><span class="glyphicon glyphicon-remove"></span> Delete Slices</button>
                </div>
+                       {%endif%} 
            </div>
        </div>
 </div>
index f7c8187..f93d48b 100644 (file)
                        <div id="authority-tab-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Authority" /></div>
                    <div id="authority-tab-loaded" style="display:none;">
                        <div id="authority-data" style="float:left; width:50%;"></div>
-                       <div id="onelab_membership" style="float:right; width:50%;">
-                           <img src="{{ STATIC_URL }}img/onelab-logo.png" alt="" /><br>
-                           <div id="onelab-data"></div>
-                       </div>
+                               <div id="onelab_membership" style="float:right; width:50%;">
+                                   <img src="{{ STATIC_URL }}img/onelab-logo.png" alt="" /><br>
+                               <div id="onelab-data"></div>
+                               </div>
                    </div>
           </div>
        </div>
        <div class="tab-pane row" id="users" data-authority="{{user_details.parent_authority}}">
                <div class="col-md-12">
                        <table class="table"><tr><td><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></td></tr></table>
+                       {%if 'is_pi'  in pi %}  
                        <div>
                                <button id="deleteusers" type="button" class="btn btn-default"><span class="glyphicon glyphicon-remove"></span> Delete Users</button>
                        </div>
+                       {%endif%}
                </div>
        </div>
        <div class="tab-pane row" id="slices">
+               {%if 'is_pi'  in pi %}
                <button id="createslice" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> create slice</button>
+               {%else%}
+               <button id="createslice" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> request slice</button>
+               {%endif%}
            <div id="slice-tab-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
            <div id="slice-tab-loaded" style="display:none;">
                <table id="slice-tab">
                    </tr>
                </table>
                <br>
+                       {%if 'is_pi'  in pi %}
                <div>
                    <button id="renewslices" type="button" class="btn btn-default"><span class="glyphicon glyphicon-refresh"></span> Renew Slices</button>
                    <button id="deleteslices" type="button" class="btn btn-default"><span class="glyphicon glyphicon-remove"></span> Delete Slices</button>
                </div>
+                       {%endif%} 
            </div>
        </div>
 </div>
@@ -74,7 +82,7 @@
                 authority_row = "<img src='{{ STATIC_URL }}img/institutions/{{user_details.parent_authority}}.gif' alt='' /><br>";
                 authority_row += "<br>";
                 authority_row += "<b>authority:</b> "+val.authority_hrn+"<br>";
-                authority_row += "<br>";
+                               authority_row += "<br>";
                 authority_row += "<b>"+val.name+"</b><br>";
                 authority_row += "<br>";
                 authority_row += "<b>Address:</b> "+val.address+"<br>";
@@ -85,7 +93,7 @@
                 authority_row += "<br>";
                 authority_row += "<h2>Contacts</h2>";
                 authority_row += "<b>Legal:</b> ";
-                /*
+                               /*
 
                 TODO: find a way to express JSON correctly given the constrains: CSV / JSON
 
                 onelab_membership = "<b>Status: </b>"+val.onelab_membership;
                 onelab_data.push(onelab_membership);
                 authority_data.push(authority_row);
+
             });
             $("div#authority-data").html(authority_data.join( "" ));
             $("div#onelab-data").html(onelab_data.join( "" ));