Commit a261bebb authored by Leigh Stoller's avatar Leigh Stoller

Allow /p/pid/profile urls too.

parent 5fd09213
......@@ -46,6 +46,7 @@ $optargs = OptionalPageArguments("create", PAGEARG_STRING,
"stuffing", PAGEARG_STRING,
"verify", PAGEARG_STRING,
"sshkey", PAGEARG_STRING,
"project", PAGEARG_PROJECT,
"ajax_request", PAGEARG_BOOLEAN,
"ajax_method", PAGEARG_STRING,
"ajax_argument", PAGEARG_STRING);
......@@ -53,6 +54,8 @@ $optargs = OptionalPageArguments("create", PAGEARG_STRING,
#
# Deal with ajax requests.
#
# XXX Need permission checks here.
#
if (isset($ajax_request)) {
if ($ajax_method == "getprofile") {
$profile_idx = addslashes($ajax_argument);
......@@ -90,9 +93,17 @@ while ($row = mysql_fetch_array($query_result)) {
if ($row["pid"] == $TBOPSPID && $row["name"] == $profile_default) {
$profile_default = $row["idx"];
}
# Look for the profile by uuid and switch to index.
if (isset($profile) && $profile == $row["uuid"]) {
$profile = $row["idx"];
if (isset($profile)) {
# Look for the profile by project/name and switch to index.
if (isset($project) &&
$row["pid"] == $project->pid() &&
$row["name"] == $profile) {
$profile = $row["idx"];
}
# Look for the profile by uuid and switch to index.
elseif ($profile == $row["uuid"]) {
$profile = $row["idx"];
}
}
}
......
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