Commit 74a70dca authored by Leigh Stoller's avatar Leigh Stoller

Allow admins to delete profiles belonging to pther users.

parent 2817eafa
......@@ -484,8 +484,8 @@ sub Delete($$)
if ($purge) {
goto bad
if (! QueryWarn("delete from apt_profile_versions ".
"where profileid='$profileid'"));
if (! DBQueryWarn("delete from apt_profile_versions ".
"where profileid='$profileid'"));
}
else {
# Set deleted on all of the versions.
......
......@@ -487,7 +487,7 @@ sub DeleteProfile($)
#
# Not allowed to delete a published profile, yet. Needs thought.
#
if (defined($profile->published())) {
if (defined($profile->published()) && !$this_user->IsAdmin()) {
UserError("Not allowed to delete a published profile");
}
if (!$profile->IsHead()) {
......
......@@ -113,7 +113,7 @@ function Do_DeleteProfile()
SPITAJAX_ERROR(1, "Not allowed to delete non-head version");
return;
}
if ($profile->published()) {
if ($profile->published() && !ISADMIN()) {
SPITAJAX_ERROR(1, "Not allowed to delete a published version");
return;
}
......
......@@ -72,7 +72,8 @@ function SPITFORM($formfields, $errors)
$viewing = 1;
$version_uuid = "'" . $profile->uuid() . "'";
$profile_uuid = "'" . $profile->profile_uuid() . "'";
$candelete = ($profile->IsHead() && !$profile->published() ? 1 : 0);
$candelete = ($profile->IsHead() &&
(!$profile->published() || ISADMIN()) ? 1 : 0);
$history = ($profile->HasHistory() ? 1 : 0);
$canmodify = ($profile->CanModify() ? 1 : 0);
$canpublish = ($profile->CanPublish() ? 1 : 0);
......
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