Commit e38b30c6 authored by Leigh Stoller's avatar Leigh Stoller

Back out a recent cleanup, which had the negative side effect of

breaking stitching.
parent db11f836
......@@ -220,7 +220,7 @@ sub DoReserve()
#
($credential,$speaksfor) =
APT_Geni::GenUserCredential($geniuser);
$rpcargs{"project_urn"} = $project->urn();
$rpcargs{"project_urn"} = $project->urn()->asString();
}
else {
if (!$project->AccessCheck($this_user, TB_PROJECT_CREATEEXPT())) {
......@@ -396,7 +396,7 @@ sub DoDelete()
my $response =
APT_Geni::PortalRPC($authority, undef, "DeleteReservation",
{"idx" => $idx,
"project" => $project->urn()});
"project" => $project->urn()->asString()});
if (GeniResponse::IsError($response)) {
#
# All errors are fatal.
......
......@@ -599,16 +599,26 @@ sub urn($)
{
my ($self) = @_;
my $pid = $self->pid();
return undef
if (!$PGENISUPPORT);
if ($self->IsNonLocal()) {
return $self->nonlocal_id();
}
require GeniHRN;
my $domain = "${OURDOMAIN}:${pid}";
return GeniHRN::Generate($domain, "project", $pid);
return GeniHRN->new(GeniHRN::Generate($domain, "project", $pid));
}
sub nonlocalurn($)
{
my ($self) = @_;
return undef
if (!$PGENISUPPORT);
require GeniHRN;
if ($self->IsNonLocal()) {
return GeniHRN->new($self->nonlocal_id());
}
return $self->urn();
}
#
......
......@@ -263,10 +263,20 @@ sub urn($)
if (!$PGENISUPPORT);
require GeniHRN;
my $urn = ($self->IsNonLocal() ? $self->nonlocal_id() :
GeniHRN::Generate($OURDOMAIN, "user", $uid));
return GeniHRN->new(GeniHRN::Generate($OURDOMAIN, "user", $uid));
}
sub nonlocalurn($)
{
my ($self) = @_;
return undef
if (!$PGENISUPPORT);
require GeniHRN;
return GeniHRN->new($urn);
if ($self->IsNonLocal()) {
return GeniHRN->new($self->nonlocal_id());
}
return $self->urn();
}
#
......
......@@ -612,6 +612,8 @@ sub Reserve($)
return $geniuser
if (GeniResponse::IsResponse($geniuser));
return GeniResponse->MalformedArgsResponse("Not a local user")
if (!$geniuser->IsLocal());
#
# No project, we need to have a project urn.
......@@ -623,7 +625,8 @@ sub Reserve($)
if (!GeniHRN::IsValid($argref->{'project_urn'}));
my $hrn = GeniHRN->new($argref->{'project_urn'});
return GeniResponse->MalformedArgsResponse("Mismatching project URN")
if ($hrn->domain() ne $geniuser->urn()->domain());
if ($hrn->domain() ne
$geniuser->emulab_user()->nonlocalurn()->domain());
my $group = GeniUtil::GetHoldingProject($hrn,undef,1);
return $group
......@@ -825,8 +828,8 @@ sub Reservations($)
next;
}
$blob->{"idx"} = $idx;
$blob->{"project"} = $project->urn();
$blob->{"user"} = $user->urn();
$blob->{"project"} = $project->nonlocalurn();
$blob->{"user"} = $user->nonlocalurn();
$blob->{"nodes"} = $row->{'nodes'};
$blob->{"type"} = $row->{'type'};
$blob->{"created"} = TBDateStringGMT($row->{'created'});
......
Markdown is supported
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