hasVariable(LtiLaunchData::USER_ID) ? $launchData->getVariable(LtiLaunchData::USER_ID) : 'anonymous'; parent::__construct($launchData, $userUri); } /** * Calculate your primary tao roles from the launch data * * @param LtiLaunchData $ltiLaunchData * @return array * @throws \common_Exception * @throws \common_exception_Error */ protected function determineTaoRoles(LtiLaunchData $ltiLaunchData) { $roles = []; $ltiRoles = []; if ($ltiLaunchData->hasVariable(LtiLaunchData::ROLES)) { $ltiRoles = $ltiLaunchData->getUserRoles(); foreach ($ltiRoles as $role) { $taoRole = LtiUtils::mapLTIRole2TaoRole($role); if (!is_null($taoRole)) { $roles[] = $taoRole; } } $roles = array_unique($roles); } if (empty($roles)) { $roles[] = LtiRoles::INSTANCE_LTI_BASE; } return array_merge($roles, $ltiRoles); } }