Skip to content

Commit

Permalink
revokeAll() implementation for PhpManager
Browse files Browse the repository at this point in the history
  • Loading branch information
pmoust committed Nov 23, 2013
1 parent 234feab commit ec37003
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions framework/yii/rbac/PhpManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,22 @@ public function revoke($userId, $itemName)
}
}

/**
* 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)
{
if (isset($this->_assignments[$userId]) && is_array($this->_assignments[$userId])) {
foreach ($this->_assignments[$userId] as $itemName => $value)
unset($this->_assignments[$userId][$itemName]);
return true;
} else {
return false;
}
}

/**
* Returns a value indicating whether the item has been assigned to the user.
* @param mixed $userId the user ID (see [[User::id]])
Expand Down

0 comments on commit ec37003

Please sign in to comment.