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():
credential_authorities.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():
credential_authorities.add(authority_hrn)
- print 'credential_authorities =', credential_authorities
- print 'credential_authorities_expired =', credential_authorities_expired
-
# ** Where am I a PI **
# For this we need to ask SFA (of all authorities) = PI function
- pi_authorities_query = Query.get('user').filter_by('user_hrn', '==', '$user_hrn').select('pi_authorities')
+ pi_authorities_query = Query.get('myslice:user').filter_by('user_hrn', '==', '$user_hrn').select('pi_authorities')
pi_authorities_tmp = execute_query(self.request, pi_authorities_query)
pi_authorities = set()
try:
# iterate on the requests and check if the authority matches a prefix
# startswith an authority on which the user is PI
- requests = get_requests()
+ if len(pi_my_authorities)>0:
+ requests = get_requests(pi_my_authorities)
+ else:
+ requests = get_requests()
for r in requests:
auth_hrn = r['authority_hrn']
for my_auth in pi_my_authorities:
if auth_hrn.startswith(my_auth):
dest = ctx_my_authorities
r['allowed'] = 'allowed'
- for my_auth in pi_delegation_authorities:
- if auth_hrn.startswith(my_auth):
- dest = ctx_delegation_authorities
- r['allowed'] = 'allowed'
+
+ #for my_auth in pi_delegation_authorities:
+ # if auth_hrn.startswith(my_auth):
+ # dest = ctx_delegation_authorities
+ # r['allowed'] = 'allowed'
if auth_hrn in pi_expired_credential_authorities:
r['allowed'] = 'expired'
if 'allowed' not in r:
myslice.login();
user = myslice.user();
-
++
var slices = [];
if($.isEmptyObject(user)){
$.post("/rest/myslice:user/",{'filters':{'user_hrn':'$user_hrn'}}, function( data ) {
slices = user.slices;
drawSlices(slices);
}
- $.each( slices, function(i, val) {
- console.log(val);
- /*
- Launch a Query for each slice to get resources and leases in Manifold Cache
- $.post("/rest/slice/", { 'fields': ['slice_hrn','slice_urn','resource','lease','resource.urn','resource.hostname','resource.type','resource.facility_name','resource.testbed_name','lease.resource','lease.start_time','lease.end_time','lease.lease_id'], 'filters': { 'slice_hrn' : val } }, function(data) {
- });
-
- */
- });
--
+
+ /*
+ Launch queries to get the resources and leases in Manifold Cache
+ */
+
function drawSlices(slices){
var items = [];
$.each( slices, function(i, val) {
items.push( "<li><a href=\"/resources/"+val+"\">" + val + "</a></li>" );
+ /*
+ // Launch a Query for each slice to get resources and leases in Manifold Cache
+ // Now only done in Homeview to speed up the other pages
+ $.post("/rest/slice/", { 'filters': { 'slice_hrn' : val } }, function(data) {
+ });
+ */
});
$("div#home-slice-list").html($( "<ul/>", { html: items.join( "" ) }));
$("ul#dropdown-slice-list").append(items.join( "" ));