diff --git a/framework/yii/rbac/DbManager.php b/framework/yii/rbac/DbManager.php index 0e1f8cc7e5..87d11ce267 100644 --- a/framework/yii/rbac/DbManager.php +++ b/framework/yii/rbac/DbManager.php @@ -276,6 +276,18 @@ class DbManager extends Manager ->execute() > 0; } + /** + * Revokes all authorization assignments from a user. + * @param mixed $userId the user ID (see [[User::id]]) + * @return boolean whether removal is successful + */ + public function revokeAll($userId) + { + return $this->db->createCommand() + ->delete($this->assignmentTable, ['user_id' => $userId]) + ->execute() > 0; + } + /** * Returns a value indicating whether the item has been assigned to the user. * @param mixed $userId the user ID (see [[User::id]])