mirror of
https://github.com/e107inc/e107.git
synced 2025-04-21 21:21:54 +02:00
EONE-62 (New Feature): User model builds proper user class list now;
Userclass administration UI problems fixed (hopefully);
This commit is contained in:
parent
cca1f3f8e0
commit
3519194c81
@ -489,7 +489,7 @@ switch ($action)
|
||||
<tr>
|
||||
<td>".UCSLAN_35."</td>
|
||||
<td>";
|
||||
$text .= "<select name='userclass_parent' class='tbox'>".$e_userclass->vetted_tree('userclass_parent',array($e_userclass,'select'), $userclass_parent,'main,admin,nobody,classes,matchclass,member').'</select>';
|
||||
$text .= "<select name='userclass_parent' class='tbox'>".$e_userclass->vetted_tree('userclass_parent',array($e_userclass,'select'), $userclass_parent,'main,admin,nobody,public,classes,matchclass,member').'</select>';
|
||||
// .r_userclass("userclass_parent", $userclass_parent, "off", "admin,classes,matchclass,public,member").
|
||||
$text .= "<div class='field-help'>".UCSLAN_36."</div></td>
|
||||
</tr></table>
|
||||
@ -620,7 +620,7 @@ $ns->tablerender(UCSLAN_21, $text);
|
||||
$e_userclass->set_default_structure();
|
||||
$e_userclass->calc_tree();
|
||||
$e_userclass->save_tree();
|
||||
$e_userclass->read_tree(TRUE); // Need to re-read the tree to show correct info
|
||||
$e_userclass->readTree(TRUE); // Need to re-read the tree to show correct info
|
||||
$message .= UCSLAN_64;
|
||||
}
|
||||
|
||||
@ -630,7 +630,7 @@ $ns->tablerender(UCSLAN_21, $text);
|
||||
$sql->db_Update("userclass_classes", "userclass_parent='0'");
|
||||
$e_userclass->calc_tree();
|
||||
$e_userclass->save_tree();
|
||||
$e_userclass->read_tree(TRUE); // Need to re-read the tree to show correct info
|
||||
$e_userclass->readTree(TRUE); // Need to re-read the tree to show correct info
|
||||
$message .= UCSLAN_64;
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,7 @@ if (e_QUERY == 'logoutas' || varset($_POST['useraction']) == 'logoutas')
|
||||
if(e107::getUser()->logoutAs())
|
||||
{ // TODO - lan
|
||||
e107::getMessage()->addSuccess('Successfully logged out from '.($asuser && $asuser->getValue('name') ? $asuser->getValue('name') : 'unknown').' account', 'default', true);
|
||||
e107::getEvent()->trigger('logoutas', array('user_id' => $asuser, 'admin_id' => e107::getUser()->getId()));
|
||||
}
|
||||
header('location:'.e_ADMIN_ABS.'users.php');
|
||||
exit;
|
||||
@ -408,6 +409,8 @@ if (isset ($_POST['useraction']) && $_POST['useraction'] == 'loginas')
|
||||
{ // TODO - lan
|
||||
e107::getMessage()->addSuccess('Successfully logged in as '.e107::getSystemUser($_POST['userid'])->getValue('name').' <a href="'.e_ADMIN_ABS.'users.php?logoutas">[logout]</a>')
|
||||
->addSuccess('Please, <a href="'.SITEURL.'" rel="external">Leave Admin</a> to browse the system as this user. Use "Logout" option in Administration to end front-end session');
|
||||
|
||||
e107::getEvent()->trigger('loginas', array('user_id' => $_POST['userid'], 'admin_id' => e107::getUser()->getId()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -223,14 +223,15 @@ class e_user_model extends e_front_model
|
||||
return (null !== $this->_editor);
|
||||
}
|
||||
|
||||
final protected function _setClassList($uid = '')
|
||||
final protected function _setClassList()
|
||||
{
|
||||
$this->_class_list = array();
|
||||
if ($this->isUser())
|
||||
{
|
||||
if ($this->get('user_class'))
|
||||
{
|
||||
$this->_class_list = explode(',', $this->get('user_class'));
|
||||
// list of all 'inherited' user classes, convert elements to integer
|
||||
$this->_class_list = array_map('intval', e107::getUserClass()->get_all_user_classes($this->get('user_class'), true));
|
||||
}
|
||||
$this->_class_list[] = e_UC_MEMBER;
|
||||
if ($this->isAdmin())
|
||||
@ -249,6 +250,8 @@ class e_user_model extends e_front_model
|
||||
$this->_class_list[] = e_UC_READONLY;
|
||||
$this->_class_list[] = e_UC_PUBLIC;
|
||||
|
||||
// unique, rebuild indexes
|
||||
$this->_class_list = array_merge(array_unique($this->_class_list));
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -743,6 +746,9 @@ class e_user extends e_user_model
|
||||
$_COOKIE[$key] = $user_id;
|
||||
cookie($key, $user_id);
|
||||
}
|
||||
|
||||
// TODO - lan
|
||||
e107::getAdminLog()->log_event('Head Admin used Login As feature', 'Head Admin [#'.$this->getId().'] '.$this->getName().' logged in user account #'.$user_id);
|
||||
//$this->loadAs(); - shouldn't be called here - loginAs should be called in Admin area only, loadAs - front-end
|
||||
return true;
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ class user_class
|
||||
* @param boolean $force - set to TRUE to force a re-read of the info regardless.
|
||||
* @return none
|
||||
*/
|
||||
protected function readTree($force = FALSE)
|
||||
public function readTree($force = FALSE)
|
||||
{
|
||||
if (isset($this->class_tree) && count($this->class_tree) && !$force) return;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user