Documentation

SsoUserSync
in package

User sync service that syncs data from Graph API to entities.

Table of Contents

$config  : ImmutableConfig
The modules config.
$configFactory  : ConfigFactoryInterface
The config factory.
$entityTypeManager  : EntityTypeManagerInterface
The entity type manager.
$graphService  : GraphService
The o365 Graph Service.
$profileGetDataService  : O365ProfileGetDataService
The profile data service.
__construct()  : mixed
Constructs a SsoUserSync object.
syncUserData()  : mixed
Sync the user data with data from the graph API.
getFieldMapping()  : array<string|int, mixed>
Get the field mappings from the settings.
mapDataToFields()  : mixed
Map the user data to field in a entity.
syncUserPicture()  : mixed
Sync the user picture if needed and wanted.
syncUserProfileData()  : mixed
Sync a Drupal user using the profile module.
synUserUserData()  : mixed
Sync a standard drupal user.

Properties

$config

The modules config.

protected ImmutableConfig $config

$configFactory

The config factory.

protected ConfigFactoryInterface $configFactory

$entityTypeManager

The entity type manager.

protected EntityTypeManagerInterface $entityTypeManager

Methods

__construct()

Constructs a SsoUserSync object.

public __construct(ConfigFactoryInterface $config_factory, GraphService $graphService, EntityTypeManagerInterface $entityTypeManager, O365ProfileGetDataService $o365ProfileGetDataService) : mixed
Parameters
$config_factory : ConfigFactoryInterface

The config factory.

$graphService : GraphService

The Graph API service.

$entityTypeManager : EntityTypeManagerInterface

The entity type manager.

$o365ProfileGetDataService : O365ProfileGetDataService

The profile data service.

Return values
mixed

syncUserData()

Sync the user data with data from the graph API.

public syncUserData(mixed $user) : mixed
Parameters
$user : mixed
Return values
mixed

getFieldMapping()

Get the field mappings from the settings.

private getFieldMapping() : array<string|int, mixed>
Return values
array<string|int, mixed>

The mapping as graph_api_field => drupal_field.

mapDataToFields()

Map the user data to field in a entity.

private mapDataToFields(UserInterface|Profile &$entity, array<string|int, mixed> $userData[, bool &$entityAltered = FALSE ]) : mixed
Parameters
$entity : UserInterface|Profile

The user or profile entity.

$userData : array<string|int, mixed>

The user data.

$entityAltered : bool = FALSE

If the entity is altered or not. Used later on.

Return values
mixed

syncUserPicture()

Sync the user picture if needed and wanted.

private syncUserPicture(UserInterface|Profile &$entity, bool &$entityAltered, array<string|int, mixed> $userData) : mixed
Parameters
$entity : UserInterface|Profile

The user or profile entity.

$entityAltered : bool

If the entity is altered or not. Used later on.

$userData : array<string|int, mixed>

The user data array containing the image.

Return values
mixed

syncUserProfileData()

Sync a Drupal user using the profile module.

private syncUserProfileData(UserInterface $user, array<string|int, mixed> $userData) : mixed
Parameters
$user : UserInterface

The user object.

$userData : array<string|int, mixed>

The user data from the Graph API.

Return values
mixed

synUserUserData()

Sync a standard drupal user.

private synUserUserData(UserInterface $user, array<string|int, mixed> $userData, bool &$entityAltered) : mixed
Parameters
$user : UserInterface

The user object.

$userData : array<string|int, mixed>

The user data from the Graph API.

$entityAltered : bool

If the entity is altered or not. Used later on.

Return values
mixed

Search results