Commit 2fc8cb45 by Alexander Makarov

Fixes #4489: Fixed MySQL RBAC manager

parent c6569b1a
......@@ -345,7 +345,7 @@ class DbManager extends BaseManager
$query = (new Query)->select('b.*')
->from(['a' => $this->assignmentTable, 'b' => $this->itemTable])
->where('a.item_name=b.name')
->andWhere(['a.user_id' => $userId]);
->andWhere(['a.user_id' => (string)$userId]);
$roles = [];
foreach ($query->all($this->db) as $row) {
......@@ -383,7 +383,7 @@ class DbManager extends BaseManager
{
$query = (new Query)->select('item_name')
->from($this->assignmentTable)
->where(['user_id' => $userId]);
->where(['user_id' => (string)$userId]);
$childrenList = $this->getChildrenList();
$result = [];
......@@ -470,7 +470,7 @@ class DbManager extends BaseManager
public function getAssignment($roleName, $userId)
{
$row = (new Query)->from($this->assignmentTable)
->where(['user_id' => $userId, 'item_name' => $roleName])
->where(['user_id' => (string)$userId, 'item_name' => $roleName])
->one($this->db);
if ($row === false) {
......@@ -491,7 +491,7 @@ class DbManager extends BaseManager
{
$query = (new Query)
->from($this->assignmentTable)
->where(['user_id' => $userId]);
->where(['user_id' => (string)$userId]);
$assignments = [];
foreach ($query->all($this->db) as $row) {
......@@ -614,7 +614,7 @@ class DbManager extends BaseManager
public function revoke($role, $userId)
{
return $this->db->createCommand()
->delete($this->assignmentTable, ['user_id' => $userId, 'item_name' => $role->name])
->delete($this->assignmentTable, ['user_id' => (string)$userId, 'item_name' => $role->name])
->execute() > 0;
}
......@@ -624,7 +624,7 @@ class DbManager extends BaseManager
public function revokeAll($userId)
{
return $this->db->createCommand()
->delete($this->assignmentTable, ['user_id' => $userId])
->delete($this->assignmentTable, ['user_id' => (string)$userId])
->execute() > 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment