feat: set preferred role on login via get parameter
This commit is contained in:
@@ -19,16 +19,16 @@ class UserDataHandler
|
||||
) {
|
||||
}
|
||||
|
||||
public function collectRoles(CrmAttributesResponse $crmAttributes): array
|
||||
public function collectRoles(CrmAttributesResponse $crmAttributes, ?string $preferredRole): array
|
||||
{
|
||||
// Collect user's roles from CRM attributes
|
||||
$roles = [];
|
||||
|
||||
if ($crmAttributes->isAdmin()) {
|
||||
if ($crmAttributes->isAdmin() && (null === $preferredRole || 'admin' === $preferredRole)) {
|
||||
$roles[] = 'ROLE_ADMIN';
|
||||
} elseif ($crmAttributes->isManager()) {
|
||||
} elseif ($crmAttributes->isManager() && (null === $preferredRole || 'manager' === $preferredRole)) {
|
||||
$roles[] = 'ROLE_MANAGER';
|
||||
} elseif ($crmAttributes->isHouseManager()) {
|
||||
} elseif ($crmAttributes->isHouseManager() && (null === $preferredRole || 'house_manager' === $preferredRole)) {
|
||||
$roles[] = 'ROLE_HOUSE_MANAGER';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user