You are here

public function CasAutoAssignRolesSubscriber::assignRolesOnRegistration in CAS 8

Same name and namespace in other branches
  1. 2.x src/Subscriber/CasAutoAssignRolesSubscriber.php \Drupal\cas\Subscriber\CasAutoAssignRolesSubscriber::assignRolesOnRegistration()

The entry point for our subscriber.

Assign roles to a user that just registered via CAS.

Parameters

\Drupal\cas\Event\CasPreRegisterEvent $event: The event object.

File

src/Subscriber/CasAutoAssignRolesSubscriber.php, line 48

Class

CasAutoAssignRolesSubscriber
Provides a CasAutoAssignRoleSubscriber.

Namespace

Drupal\cas\Subscriber

Code

public function assignRolesOnRegistration(CasPreRegisterEvent $event) {
  $auto_assigned_roles = $this->settings
    ->get('user_accounts.auto_assigned_roles');
  if (!empty($auto_assigned_roles)) {
    $event
      ->setPropertyValue('roles', $auto_assigned_roles);
  }
}