*/ public function getAssignments($userId): array { $identity = Yii::$app->user->getIdentity(); if ($identity === null) { return []; } $rawPermissions = $identity->getAssignedPermissions(); $result = []; foreach ($rawPermissions as $name) { $result[$name] = new Assignment(['roleName' => $name]); } return $result; } }