Commit 3e974586 authored by Leigh Stoller's avatar Leigh Stoller

Add LookupbyUUID().

parent 34b09fc5
#!/usr/bin/perl -wT
#
# EMULAB-COPYRIGHT
# Copyright (c) 2005, 2006, 2007 University of Utah and the Flux Group.
# Copyright (c) 2005-2008 University of Utah and the Flux Group.
# All rights reserved.
#
package User;
......@@ -297,6 +297,28 @@ sub LookupByEmail($$)
return User->Lookup($uid_idx);
}
#
# Lookup user given a UUID.
#
sub LookupByUUID($$)
{
my ($class, $uuid) = @_;
my $status_archived = $USERSTATUS_ARCHIVED;
my $safe_uuid = DBQuoteSpecial($uuid);
my $query_result =
DBQueryFatal("select uid_idx from users ".
"where uid_uuid=$safe_uuid and ".
" status!='$status_archived'");
return undef
if (! $query_result || !$query_result->numrows);
my ($uid_idx) = $query_result->fetchrow_array();
return User->Lookup($uid_idx);
}
#
# Class function to create new user and return object.
#
......
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