Commit 87819c14 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Minor changes to listusage(); add expires, and allow delegated

CH credential.
parent 53814097
......@@ -4448,10 +4448,17 @@ sub ListUsage($)
}
# The caller (owner) has to match the clearinghouse.
if ($credential->owner_urn() ne $certificate->urn()) {
if (! ($credential->owner_urn() eq $certificate->urn() ||
$credential->target_urn() eq $certificate->urn())) {
return GeniResponse->Create(GENIRESPONSE_ERROR, undef,
"Only the clearinghouse can do this!");
}
$credential->HasPrivilege("listusage") or
$credential->HasPrivilege("readhistory") or
return GeniResponse->Create( GENIRESPONSE_FORBIDDEN, undef,
"Insufficient privilege" );
my @slices;
if (GeniSlice->ListAll(\@slices) != 0) {
return GeniResponse->Create(GENIRESPONSE_ERROR);
......@@ -4469,6 +4476,9 @@ sub ListUsage($)
print STDERR "Could not slice slivers for $slice\n";
return GeniResponse->Create(GENIRESPONSE_ERROR);
}
my $expires = POSIX::strftime("20%y-%m-%dT%H:%M:%SZ",
gmtime(str2time($slice->expires())));
foreach my $sliver (@slivers) {
next
if ($sliver->resource_type() ne "Node");
......@@ -4495,6 +4505,7 @@ sub ListUsage($)
my $blob = {"slice_gid" => $slice->cert(),
"slice_hrn" => $slice->hrn(),
"slice_urn" => $slice->urn(),
"expires" => $expires,
"slivers" => \@components };
push(@result, $blob);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment