final class UserDeveloperConverter in Apigee Edge 8
Same name in this branch
- 8 src/UserDeveloperConverter.php \Drupal\apigee_edge\UserDeveloperConverter
- 8 tests/modules/apigee_edge_test/src/UserDeveloperConverter.php \Drupal\apigee_edge_test\UserDeveloperConverter
Service decorator for user-developer converter.
Hierarchy
- class \Drupal\apigee_edge\UserDeveloperConverter implements UserDeveloperConverterInterface
- class \Drupal\apigee_edge_test\UserDeveloperConverter
Expanded class hierarchy of UserDeveloperConverter
1 string reference to 'UserDeveloperConverter'
- apigee_edge_test.services.yml in tests/
modules/ apigee_edge_test/ apigee_edge_test.services.yml - tests/modules/apigee_edge_test/apigee_edge_test.services.yml
1 service uses UserDeveloperConverter
- apigee_edge_test.converter.user_developer in tests/
modules/ apigee_edge_test/ apigee_edge_test.services.yml - Drupal\apigee_edge_test\UserDeveloperConverter
File
- tests/
modules/ apigee_edge_test/ src/ UserDeveloperConverter.php, line 35
Namespace
Drupal\apigee_edge_testView source
final class UserDeveloperConverter extends DecoratedUserDeveloperConverter {
public const DRUPAL_ROLE_ATTRIBUTE_NAME = 'DP_USER_ROLES';
/**
* The decorated user-developer converter service.
*
* @var \Drupal\apigee_edge\UserDeveloperConverterInterface
*/
private $innerService;
/**
* UserToDeveloper constructor.
*
* @param \Drupal\apigee_edge\UserDeveloperConverterInterface $inner_service
* The decorated user-developer converter service.
* @param \Drupal\Core\Config\ConfigFactory $config_factory
* Config factory service.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* Entity type manager service.
* @param \Drupal\apigee_edge\Plugin\FieldStorageFormatManagerInterface $field_storage_manager
* Field storage manager service.
* @param \Drupal\apigee_edge\FieldAttributeConverterInterface $field_attribute_converter
* Field name to attribute name converter service.
*/
public function __construct(UserDeveloperConverterInterface $inner_service, ConfigFactory $config_factory, EntityTypeManagerInterface $entity_type_manager, FieldStorageFormatManagerInterface $field_storage_manager, FieldAttributeConverterInterface $field_attribute_converter) {
$this->configFactory = $config_factory;
$this->fieldStorageFormatManager = $field_storage_manager;
$this->entityTypeManager = $entity_type_manager;
$this->fieldAttributeConverter = $field_attribute_converter;
$this->innerService = $inner_service;
parent::__construct($config_factory, $entity_type_manager, $field_storage_manager, $field_attribute_converter);
}
/**
* Push but do not sync Drupal user roles to Apigee Edge.
*
* {@inheritdoc}
*/
public function convertUser(UserInterface $user) : UserToDeveloperConversionResult {
$original_result = parent::convertUser($user);
$original_result
->getDeveloper()
->setAttribute(static::DRUPAL_ROLE_ATTRIBUTE_NAME, implode(',', $user
->getRoles()));
return new UserToDeveloperConversionResult($original_result
->getDeveloper(), $original_result
->getSuccessfullyAppliedChanges() + 1, $original_result
->getProblems());
}
}