private function GroupUserUpdateProcessor::updateAuthorizations in Lightweight Directory Access Protocol (LDAP) 8.4
Same name and namespace in other branches
- 8.3 ldap_user/src/Processor/GroupUserUpdateProcessor.php \Drupal\ldap_user\Processor\GroupUserUpdateProcessor::updateAuthorizations()
Update authorizations.
Parameters
\Drupal\user\UserInterface $user: Drupal user to update.
Throws
\Drupal\Core\Entity\EntityStorageException
1 call to GroupUserUpdateProcessor::updateAuthorizations()
- GroupUserUpdateProcessor::processAccount in ldap_user/
src/ Processor/ GroupUserUpdateProcessor.php - Create or update an entry in Drupal.
File
- ldap_user/
src/ Processor/ GroupUserUpdateProcessor.php, line 200
Class
- GroupUserUpdateProcessor
- Provides functionality to generically update existing users.
Namespace
Drupal\ldap_user\ProcessorCode
private function updateAuthorizations(UserInterface $user) : void {
if ($this->moduleHandler
->moduleExists('ldap_authorization')) {
// We are not injecting this service properly to avoid forcing this
// dependency on authorization.
/** @var \Drupal\authorization\AuthorizationController $authorization_manager */
// phpcs:ignore
$authorization_manager = \Drupal::service('authorization.manager');
$authorization_manager
->setUser($user);
$authorization_manager
->setAllProfiles();
}
else {
// We are saving here for sites without ldap_authorization since saving is
// embedded in setAllProfiles().
// @todo Provide method for decoupling saving users and use it instead.
$user
->save();
}
}