Symfony 6.4 - Re-setup Security Controller

- Use attributes instead of annotations
- Adjust to new session changes
- Adjust to new symfony setup

[Legacy] Re-setup Security Controller

- Add method to check if user is enabled
This commit is contained in:
Clemente Raposo 2024-06-03 11:05:21 +01:00
parent 9463e4f6ec
commit bb7074b86b
3 changed files with 77 additions and 47 deletions

View file

@ -297,6 +297,22 @@ class AuthenticationController
return $this->authenticated;
}
/**
* This is called on every page hit.
* It returns true if the current session is authenticated or false otherwise
*
* @return bool
*/
public function isUserActive(): bool
{
global $current_user;
/** @var User $reloadedUser */
$reloadedUser = BeanFactory::getBean('Users', $current_user->id);
return $reloadedUser->isEnabled() ?? false;
}
/**
* Called when a user requests to logout. Should invalidate the session and redirect
* to the login page.