protected getDirectPermissionsByUser ( string | integer $userId ) : |
||
$userId | string | integer | the user ID (see [[\yii\web\User::id]]) |
return | all direct permissions that the user has. The array is indexed by the permission names. |
protected function getDirectPermissionsByUser($userId)
{
$permissions = [];
foreach ($this->getAssignments($userId) as $name => $assignment) {
$permission = $this->items[$assignment->roleName];
if ($permission->type === Item::TYPE_PERMISSION) {
$permissions[$name] = $permission;
}
}
return $permissions;
}