Commit e38b30c6 authored by Leigh B Stoller's avatar Leigh B Stoller

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

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