Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
02840d1d
Commit
02840d1d
authored
Sep 18, 2013
by
Leigh B Stoller
Browse files
Add LookupByEmail and LookupByName
parent
6d31c149
Changes
1
Hide whitespace changes
Inline
Side-by-side
www/geni_defs.php
View file @
02840d1d
...
...
@@ -110,6 +110,25 @@ class GeniSlice
}
return
null
;
}
function
LookupByName
(
$authority
,
$token
)
{
$dblink
=
GetDBLink
(
$authority
);
$safe_token
=
addslashes
(
$token
);
if
(
!
$dblink
)
{
return
null
;
}
$query_result
=
DBQueryFatal
(
"select idx from geni_slices "
.
"where name='
$safe_token
'"
,
$dblink
);
if
(
!
(
$query_result
&&
mysql_num_rows
(
$query_result
)))
{
return
null
;
}
$row
=
mysql_fetch_row
(
$query_result
);
$idx
=
$row
[
0
];
return
GeniSlice
::
Lookup
(
$authority
,
$idx
);
}
# accessors
function
field
(
$name
)
{
return
(
is_null
(
$this
->
slice
)
?
-
1
:
$this
->
slice
[
$name
]);
...
...
@@ -320,6 +339,26 @@ class GeniUser
}
return
null
;
}
function
LookupByEmail
(
$authority
,
$token
)
{
$dblink
=
GetDBLink
(
$authority
);
$safe_token
=
addslashes
(
$token
);
if
(
!
$dblink
)
{
return
null
;
}
$query_result
=
DBQueryFatal
(
"select idx from geni_users "
.
"where email='
$safe_token
'"
,
$dblink
);
if
(
!
(
$query_result
&&
mysql_num_rows
(
$query_result
)))
{
return
null
;
}
$row
=
mysql_fetch_row
(
$query_result
);
$idx
=
$row
[
0
];
return
GeniUser
::
Lookup
(
$authority
,
$idx
);
}
# accessors
function
field
(
$name
)
{
return
(
is_null
(
$this
->
user
)
?
-
1
:
$this
->
user
[
$name
]);
...
...
@@ -336,6 +375,7 @@ class GeniUser
function
name
()
{
return
$this
->
field
(
'name'
);
}
function
email
()
{
return
$this
->
field
(
'email'
);
}
function
sa_uuid
()
{
return
$this
->
field
(
'sa_uuid'
);
}
function
IsActive
()
{
$this
->
status
()
==
'active'
;
}
}
class
ClientSliver
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment