Allow setting admin privileges in the user mananger
This commit is contained in:
committed by
WineHQ
parent
efae38f6bf
commit
82ab0c467f
@@ -23,18 +23,6 @@ require_once(BASE."include/util.php");
|
||||
<td> Real Name </td>
|
||||
<td> <input type="text" name="sUserRealname" value="<?php echo $sUserRealname; ?>"> </td>
|
||||
</tr>
|
||||
<?php
|
||||
// if we manage another user we can give him administrator rights
|
||||
if($oUser->iUserId == $aClean['iUserId'])
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
<td> Administrator </td>
|
||||
<td> <input type="checkbox" name="sHasAdmin" "<?php echo $sHasAdmin; ?>" value="on"> </td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td colspan=2> </td>
|
||||
</tr>
|
||||
|
||||
@@ -11,10 +11,9 @@
|
||||
* - sUserEmail, e-mail address
|
||||
* - sUserRealname, user's real name
|
||||
* - sWineRelease, user's Wine release
|
||||
* - sHasAdmin, "on" if user is an administrator
|
||||
* - bIsAdmin, true if user is an administrator
|
||||
*
|
||||
* TODO:
|
||||
* - rename sHasAdmin with bIsAdmin
|
||||
* - document iLimit and sOrderBy
|
||||
* - replace sOrderBy with iOrderBy and use constants for each accepted value
|
||||
* - add a field to prefs_list to flag the user level for the pref
|
||||
@@ -59,12 +58,22 @@ function show_user_fields($oUser)
|
||||
$sUserEmail = $oUser->sEmail;
|
||||
$sWineRelease = $oUser->sWineRelease;
|
||||
if($oUser->hasPriv("admin"))
|
||||
$sHasAdmin = 'checked="true"';
|
||||
$sAdminChecked = 'checked="true"';
|
||||
else
|
||||
$sHasAdmin = "";
|
||||
$sAdminChecked = "";
|
||||
|
||||
include(BASE."include/form_edit.php");
|
||||
|
||||
// Edit admin privilege
|
||||
if($_SESSION['current']->hasPriv("admin"))
|
||||
{
|
||||
echo html_tr(array(
|
||||
" Administrator",
|
||||
"<input type=\"checkbox\" name=\"bIsAdmin\" value=\"true\" ".
|
||||
"$sAdminChecked />"
|
||||
));
|
||||
}
|
||||
|
||||
echo "<tr><td> Wine version </td><td>";
|
||||
make_bugzilla_version_list("sWineRelease", $sWineRelease);
|
||||
echo "</td></tr>";
|
||||
@@ -123,14 +132,18 @@ if($aClean['sSubmit'] == "Update")
|
||||
if ($oUser->update() == SUCCESS)
|
||||
{
|
||||
addmsg("Preferences Updated", "green");
|
||||
// we were managing an user, let's go back to the admin after updating tha admin status
|
||||
if($oUser->iUserId == $aClean['iUserId'] && $_SESSION['current']->hasPriv("admin"))
|
||||
// we were managing an user, let's go back to the admin after
|
||||
// updating tha admin status
|
||||
if($oUser->iUserId == $aClean['iUserId'] &&
|
||||
$_SESSION['current']->hasPriv("admin"))
|
||||
{
|
||||
if($aClean['sHasAdmin']=="on")
|
||||
if($aClean['bIsAdmin'] == "true")
|
||||
$oUser->addPriv("admin");
|
||||
else
|
||||
$oUser->delPriv("admin");
|
||||
util_redirect_and_exit(BASE."admin/adminUsers.php?iUserId=".$oUser->iUserId."&sSearch=".$aClean['sSearch']."&iLimit=".$aClean['iLimit']."&sOrderBy=".$aClean['sOrderBy']."&sSubmit=true");
|
||||
util_redirect_and_exit(BASE."admin/adminUsers.php?iUserId=".$oUser->iUserId.
|
||||
"&sSearch=".$aClean['sSearch']."&iLimit=".$aClean['iLimit'].
|
||||
"&sOrderBy=".$aClean['sOrderBy']."&sSubmit=true");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user