Skip to content
GitLab
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
b190c0fd
Commit
b190c0fd
authored
Mar 27, 2014
by
Leigh B Stoller
Browse files
Fix up /p/project/profile handling.
parent
4c5ef92a
Changes
2
Hide whitespace changes
Inline
Side-by-side
www/aptui/instantiate.php
View file @
b190c0fd
...
...
@@ -94,13 +94,20 @@ $am_array = array('Utah DDC' =>
if
(
isset
(
$profile
))
{
#
# Guest users must use the uuid, but logged in users may use the
# internal index.
# internal index. But, we have to support simple the URL too, which
# is /p/project/profilename, but only for public profiles. Need to
# deal with the version at some point.
#
if
(
!
(
$this_user
||
IsValidUUID
(
$profile
)))
{
if
(
isset
(
$project
)
&&
isset
(
$profile
))
{
$obj
=
Profile
::
LookupByName
(
$project
,
$profile
);
}
elseif
(
$this_user
||
IsValidUUID
(
$profile
))
{
$obj
=
Profile
::
Lookup
(
$profile
);
}
else
{
SPITUSERERROR
(
"Illegal profile for guest user:
$profile
"
);
exit
();
}
$obj
=
Profile
::
Lookup
(
$profile
);
if
(
!
$obj
)
{
SPITUSERERROR
(
"No such profile:
$profile
"
);
exit
();
...
...
www/aptui/profile_defs.php
View file @
b190c0fd
...
...
@@ -99,9 +99,22 @@ class Profile
return
null
;
}
# Lookup by name/version. If no version, then return highest
# numbered version.
function
LookupByName
()
{}
function
LookupByName
(
$project
,
$profile
)
{
$pid
=
$project
->
pid
();
$safe_profile
=
addslashes
(
$profile
);
$query_result
=
DBQueryWarn
(
"select idx from apt_profiles "
.
"where pid='
$pid
' and "
.
" (name='
$safe_profile
' or uuid='
$safe_profile
')"
);
if
(
$query_result
&&
mysql_num_rows
(
$query_result
))
{
$row
=
mysql_fetch_row
(
$query_result
);
$idx
=
$row
[
0
];
return
Profile
::
Lookup
(
$idx
);
}
return
null
;
}
#
# Refresh an instance by reloading from the DB.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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