private function DrupalRolesConsumer::sanitizeRoleId in Authorization 8
Take a proposed mapping and provide a safe value for Drupal roles.
Parameters
string $consumer: A valid proposal for this consumer.
Return value
string A valid string for Drupal roles.
3 calls to DrupalRolesConsumer::sanitizeRoleId()
- DrupalRolesConsumer::createConsumerTarget in authorization_drupal_roles/
src/ Plugin/ authorization/ Consumer/ DrupalRolesConsumer.php - Create authorization consumer targets.
- DrupalRolesConsumer::grantSingleAuthorization in authorization_drupal_roles/
src/ Plugin/ authorization/ Consumer/ DrupalRolesConsumer.php - Grant one individual proposal.
- DrupalRolesConsumer::revokeGrants in authorization_drupal_roles/
src/ Plugin/ authorization/ Consumer/ DrupalRolesConsumer.php - Revoke all previously applied and no longer valid grants.
File
- authorization_drupal_roles/
src/ Plugin/ authorization/ Consumer/ DrupalRolesConsumer.php, line 211
Class
- DrupalRolesConsumer
- Provides a consumer for Drupal roles.
Namespace
Drupal\authorization_drupal_roles\Plugin\authorization\ConsumerCode
private function sanitizeRoleId(string $consumer) : string {
$sanitizedId = $this->transliteration
->transliterate($consumer, 'en', '');
$sanitizedId = mb_strtolower($sanitizedId);
return preg_replace('@[^a-z0-9_.]+@', '_', $sanitizedId);
}