fix(security) : exclude ROLE_USER for ROLE_CLIENT users
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -95,8 +95,11 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
|||||||
/** @return list<string> */
|
/** @return list<string> */
|
||||||
public function getRoles(): array
|
public function getRoles(): array
|
||||||
{
|
{
|
||||||
$roles = $this->roles;
|
$roles = $this->roles;
|
||||||
$roles[] = 'ROLE_USER';
|
|
||||||
|
if (!in_array('ROLE_CLIENT', $roles, true)) {
|
||||||
|
$roles[] = 'ROLE_USER';
|
||||||
|
}
|
||||||
|
|
||||||
return array_values(array_unique($roles));
|
return array_values(array_unique($roles));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user