mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
check for user email before writing msgraph metadata
This commit is contained in:
parent
c8028b8e60
commit
f72c0576ef
@ -130,6 +130,10 @@ class MapCalendarToUser
|
||||
|
||||
public function hasUserId(User $user): bool
|
||||
{
|
||||
if (null === $user->getEmail() || '' === $user->getEmail()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!array_key_exists(self::METADATA_KEY, $user->getAttributes())) {
|
||||
return false;
|
||||
}
|
||||
@ -139,6 +143,10 @@ class MapCalendarToUser
|
||||
|
||||
public function writeMetadata(User $user): User
|
||||
{
|
||||
if (null === $user->getEmail() OR '' === $user->getEmail()) {
|
||||
return $user;
|
||||
}
|
||||
|
||||
if (null === $userData = $this->getUserByEmail($user->getEmailCanonical())) {
|
||||
$this->logger->warning('[MapCalendarToUser] could not find user on msgraph', ['userId' => $user->getId(), 'email' => $user->getEmailCanonical()]);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user