Commit a4fbc533 authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Add Flush() routine to clear cache.

Change urn() function to return urn from the certificate, rather
generating one (which is always wrong). If the certificate has
no urn, return the uuid instead.
parent df8e84e9
......@@ -39,6 +39,7 @@ my $TBAUDIT = "@TBAUDITEMAIL@";
my $BOSSNODE = "@BOSSNODE@";
my $CONTROL = "@USERNODE@";
my $OURDOMAIN = "@OURDOMAIN@";
my $PGENIDOMAIN = "@PROTOGENI_DOMAIN@";
# Cache of instances to avoid regenerating them.
my %users = ();
......@@ -76,7 +77,7 @@ sub Lookup($$;$)
$query_result =
DBQueryWarn("select idx from geni_users ".
"where hrn='$id' and status='active'");
"where hrn='${PGENIDOMAIN}.$id' and status='active'");
return undef
if (!$query_result);
......@@ -206,6 +207,16 @@ sub Stringify($)
return "[GeniUser: $hrn, IDX: $idx]";
}
#
# Flush from our little cache.
#
sub Flush($)
{
my ($self) = @_;
delete($users{$self->idx()});
}
# Return the URN.
#
# Return the URN. This is complicated by the fact that the DB does
......@@ -221,9 +232,7 @@ sub urn($)
return $urn
if (defined($urn) && $urn ne "");
my ($DOMAIN) = ($self->hrn() =~ /^([-\w]*)\..*$/);
return GeniHRN::Generate($DOMAIN, "user", $self->uid());
return $self->uuid();
}
#
......@@ -676,8 +685,6 @@ use GeniHRN;
use GeniCertificate;
use overload ('""' => 'Stringify');
my $PGENIDOMAIN = "@PROTOGENI_DOMAIN@";
#
# Create a wrapper, with the same access names.
#
......
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