mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-11 20:21:16 +00:00
handle role in addUser() propperly
This commit is contained in:
parent
b57dc78e2a
commit
b9c613ff83
|
@ -2866,10 +2866,12 @@ class SeedDMS_Core_DMS {
|
|||
if (is_object($this->getUserByLogin($login))) {
|
||||
return false;
|
||||
}
|
||||
if(is_object($role))
|
||||
$role = $role->getID();
|
||||
elseif($role == '')
|
||||
$role = '3';
|
||||
if(!is_object($role)) {
|
||||
if($role == '')
|
||||
$role = SeedDMS_Core_Role::getInstance(3, $this);
|
||||
else
|
||||
$role = SeedDMS_Core_Role::getInstance($role, $this);
|
||||
}
|
||||
if(trim($pwdexpiration) == '' || trim($pwdexpiration) == 'never') {
|
||||
$pwdexpiration = 'NULL';
|
||||
} elseif(trim($pwdexpiration) == 'now') {
|
||||
|
@ -2877,7 +2879,7 @@ class SeedDMS_Core_DMS {
|
|||
} else {
|
||||
$pwdexpiration = $db->qstr($pwdexpiration);
|
||||
}
|
||||
$queryStr = "INSERT INTO `tblUsers` (`login`, `pwd`, `fullName`, `email`, `language`, `theme`, `comment`, `role`, `hidden`, `disabled`, `pwdExpiration`, `quota`, `homefolder`) VALUES (".$db->qstr($login).", ".$db->qstr($pwd).", ".$db->qstr($fullName).", ".$db->qstr($email).", '".$language."', '".$theme."', ".$db->qstr($comment).", '".intval($role)."', '".intval($isHidden)."', '".intval($isDisabled)."', ".$pwdexpiration.", '".intval($quota)."', ".($homefolder ? intval($homefolder) : "NULL").")";
|
||||
$queryStr = "INSERT INTO `tblUsers` (`login`, `pwd`, `fullName`, `email`, `language`, `theme`, `comment`, `role`, `hidden`, `disabled`, `pwdExpiration`, `quota`, `homefolder`) VALUES (".$db->qstr($login).", ".$db->qstr($pwd).", ".$db->qstr($fullName).", ".$db->qstr($email).", '".$language."', '".$theme."', ".$db->qstr($comment).", '".intval($role->getId())."', '".intval($isHidden)."', '".intval($isDisabled)."', ".$pwdexpiration.", '".intval($quota)."', ".($homefolder ? intval($homefolder) : "NULL").")";
|
||||
$res = $this->db->getResult($queryStr);
|
||||
if (!$res)
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue
Block a user