Merge branch 'master' of ssh://git.onelab.eu/git/myslice
authorLoic Baron <loic.baron@lip6.fr>
Mon, 28 Oct 2013 10:53:00 +0000 (11:53 +0100)
committerLoic Baron <loic.baron@lip6.fr>
Mon, 28 Oct 2013 10:53:00 +0000 (11:53 +0100)
plugins/hazelnut/static/js/hazelnut.js
portal/views.py

index dcd4e1f..7c042b1 100644 (file)
@@ -23,6 +23,9 @@
             this.received_all_query = false;
             this.received_query = false;
 
+            // We need to remember the active filter for datatables filtering
+            this.filters = Array(); 
+
             // an internal buffer for records that are 'in' and thus need to be checked 
             this.buffered_records_to_check = [];
            // an internal buffer for keeping lines and display them in one call to fnAddData
              */
             $.fn.dataTableExt.afnFiltering.push(function( oSettings, aData, iDataIndex ) { 
                 /* No filtering if the table does not match */
-                if (oSettings.nTable.id != "hazelnut-" + self.options.plugin_uuid)
+                if (oSettings.nTable.id != self.options.plugin_uuid + '__table')
                     return true;
-                return this._hazelnut_filter.call(self, oSettings, aData, iDataIndex);
+                return self._hazelnut_filter.call(self, oSettings, aData, iDataIndex);
             });
 
             /* Processing hidden_columns */
 
         on_filter_added: function(filter)
         {
-            // XXX
-            console.log(filter);
+            this.filters.push(filter);
             this.redraw_table();
         },
 
         on_filter_removed: function(filter)
         {
-            // XXX
+            // Remove corresponding filters
+            this.filters = $.grep(this.filters, function(x) {
+                return x != filter;
+            });
             this.redraw_table();
         },
         
          */
         _hazelnut_filter: function(oSettings, aData, iDataIndex)
         {
-            var cur_query = this.current_query;
-            if (!cur_query) return true;
             var ret = true;
-
-            /* We have an array of filters : a filter is an array (key op val) 
-             * field names (unless shortcut)    : oSettings.aoColumns  = [ sTitle ]
-             *     can we exploit the data property somewhere ?
-             * field values (unless formatting) : aData
-             *     formatting should leave original data available in a hidden field
-             *
-             * The current line should validate all filters
-             */
-            $.each (cur_query.filters, function(index, filter) { 
+            $.each (this.filters, function(index, filter) { 
                 /* XXX How to manage checkbox ? */
                 var key = filter[0]; 
                 var op = filter[1];
index 65d8ea0..da69220 100644 (file)
@@ -271,26 +271,37 @@ class ValidatePendingView(TemplateView):
                     all_authorities.append(auth)
                 platform_ids.append(sfa_platform['platform_id'])
 
+            print "W: Hardcoding platform myslice"
+            platform_ids.append(5);
+
             # We can check on which the user has authoritity credentials = PI rights
             credential_authorities = set()
             credential_authorities_expired = set()
 
             # User account on these registries
-            user_accounts_query = Query.get('local:account').filter_by('user_id', '==', user_id).filter_by('platform_id', 'included', platform_ids).select('config')
+            user_accounts_query = Query.get('local:account').filter_by('user_id', '==', user_id).filter_by('platform_id', 'included', platform_ids).select('auth_type', 'config')
             user_accounts = execute_query(self.request, user_accounts_query)
             #print "=" * 80
             #print user_accounts
             #print "=" * 80
             for user_account in user_accounts:
+
+                print "USER ACCOUNT", user_account
+                if user_account['auth_type'] == 'reference':
+                    continue # we hardcoded the myslice platform...
+
                 config = json.loads(user_account['config'])
                 creds = []
+                print "CONFIG KEYS", config.keys()
                 if 'authority_credentials' in config:
+                    print "***", config['authority_credentials'].keys()
                     for authority_hrn, credential in config['authority_credentials'].items():
                         #if credential is not expired:
                         credential_authorities.add(authority_hrn)
                         #else
                         #    credential_authorities_expired.add(authority_hrn)
                 if 'delegated_authority_credentials' in config:
+                    print "***", config['delegated_authority_credentials'].keys()
                     for authority_hrn, credential in config['delegated_authority_credentials'].items():
                         #if credential is not expired:
                         credential_authorities.add(authority_hrn)