ensure setRole() is passed an object

This commit is contained in:
Uwe Steinmann 2022-02-17 12:30:29 +01:00
parent b9c613ff83
commit 96933bb30d

View File

@ -90,7 +90,7 @@ class SeedDMS_Core_Role { /* {{{ */
$queryStr = "SELECT * FROM `tblRoles` WHERE `name` = ".$db->qstr($id);
break;
default:
$queryStr = "SELECT * FROM `tblRoles` WHERE id = " . (int) $id;
$queryStr = "SELECT * FROM `tblRoles` WHERE `id` = " . (int) $id;
}
$resArr = $db->getResultArray($queryStr);
@ -740,6 +740,9 @@ class SeedDMS_Core_User { /* {{{ */
function setRole($newrole) { /* {{{ */
$db = $this->_dms->getDB();
if(!is_object($newrole) || (get_class($newrole) != $this->_dms->getClassname('role')))
return false;
if(is_object($newrole))
$queryStr = "UPDATE `tblUsers` SET `role` = " . $newrole->getID() . " WHERE `id` = " . $this->_id;
else