feat: update profile in buspro without the teamer's password

This commit is contained in:
fromme committed 2026-10-16 08:59:39 +02:00
1 parent 18fb3382c6
commit c16e4bf53f
3 files changed
+187 -8

No files matched your search

+16 -2
View File
@@ -68,15 +68,28 @@ class ApiClient
}
/**
* Writes the teamer's profile to their BusPro address without their password.
*
* "login" switches the password check off, so the two ids are the whole authorisation of
* this write: an address can hold several persons, and only "idadresseperson" names the
* person, while "email" is ignored. The ids must therefore only ever come from a verified
* source - MyE&P userinfo or a BusPro answer - never from a form or a request parameter.
* Element order as verified on the BusPro test system, see
* .ddev/plans/myep-team-oauth-only-login.md.
*
* @throws ApiClientException
* @throws ResponseParserException
*/
public function updateProfile(User $user, string $password): NotificationResponse|ProfileUpdateResponse
public function updateProfile(User $user): NotificationResponse|ProfileUpdateResponse
{
if (null === $teamer = $user->getTeamer()) {
throw new ApiClientException('Invalid argument');
}
if (null === $user->getBusProAddressId() || null === $user->getBusProPersonId()) {
throw new ApiClientException('User has no BusPro address and person id');
}
$data = [
'anfrage' => [
'user' => $this->config['bpn_username'],
@@ -84,8 +97,9 @@ class ApiClient
'satz' => ['@typ' => static::TYPE_CUSTOMER_DATA],
'art' => 'Adressdaten_Ändern',
'email' => $user->getEmail(),
'passwort' => $password,
'login' => 'J',
'idadresse' => $user->getBusProAddressId(),
'idadresseperson' => $user->getBusProPersonId(),
'adressdaten' => $teamer->toPayload(),
],
];