From 234feabaac090c3e34a7f19ee7110f7aa6093d65 Mon Sep 17 00:00:00 2001 From: Panagiotis Moustafellos Date: Sat, 23 Nov 2013 18:36:19 +0200 Subject: [PATCH] revokeAll() implementation for DbManager --- framework/yii/rbac/DbManager.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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]])