1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

Added additional check prior to administrator status change.

This commit is contained in:
Cameron 2014-12-27 12:02:12 -08:00
parent 079b223b76
commit 9249f892b1
2 changed files with 21 additions and 6 deletions

View File

@ -695,15 +695,23 @@ class users_admin_ui extends e_admin_ui
$this->redirect('list', 'main', true);
}
if(!$sysuser->isAdmin())
if($this->getPosted('update_admin'))
{
$sysuser->set('user_admin', 1)->save(); //"user","user_admin='1' WHERE user_id={$userid}"
$lan = str_replace(array('--UID--', '--NAME--', '--EMAIL--'), array($sysuser->getId(), $sysuser->getName(), $sysuser->getValue('email')), USRLAN_164);
e107::getLog()->add('USET_08', $lan, E_LOG_INFORMATIVE);
$mes->addSuccess($lan);
e107::getUserPerms()->updatePerms($userid, $_POST['perms']);
$this->redirect('list', 'main', true);
}
if(!$sysuser->isAdmin()) // Security Check Only. Admin status check is added during 'updatePerms'.
{
// $sysuser->set('user_admin', 1)->save(); //"user","user_admin='1' WHERE user_id={$userid}"
// $lan = str_replace(array('--UID--', '--NAME--', '--EMAIL--'), array($sysuser->getId(), $sysuser->getName(), $sysuser->getValue('email')), USRLAN_164);
// e107::getLog()->add('USET_08', $lan, E_LOG_INFORMATIVE);
// $mes->addSuccess($lan);
$mes->addWarning("You are about to make User #<b>".$sysuser->getId()."</b> : <b>".$sysuser->getName()."</b> (".$sysuser->getValue('email').") an <b>administrator</b>."); ///TODO LAN
$mes->addWarning("Set the permissions and click <b>Update</b> to proceed or <b>Back</b> to abort.");
}
if($this->getPosted('update_admin')) e107::getUserPerms()->updatePerms($userid, $_POST['perms']);
}
/**

View File

@ -1598,6 +1598,13 @@ class e_userperms
}
//$sql->db_Update("user", "user_perms='{$perm}' WHERE user_id='{$modID}' ")
if(!$sysuser->isAdmin())
{
$sysuser->set('user_admin', 1)->save();
$lan = str_replace(array('--UID--', '--NAME--', '--EMAIL--'), array($sysuser->getId(), $sysuser->getName(), $sysuser->getValue('email')), USRLAN_164);
e107::getLog()->add('USET_08', $lan, E_LOG_INFORMATIVE);
}
e107::getMessage()->addAuto($sysuser->set('user_perms', $perm)->save(), 'update', sprintf(LAN_UPDATED, $tp->toDB($_POST['ad_name'])), false, false);
$logMsg = str_replace(array('--ID--', '--NAME--'),array($modID, $a_name),ADMSLAN_72).$perm;
e107::getLog()->add('ADMIN_01',$logMsg,E_LOG_INFORMATIVE,'');