Infrastructure/Security/Authorization/AuthorizationService.php
public function getLoggedInAdministrator(): Administrator 
    {
        if (!isset($_SESSION[SlimPostgres::SESSION_KEY_ADMINISTRATOR_ID])) {
            throw new \Exception("No one is logged in");
        }

        if (null === $administrator = (AdministratorsEntityMapper::getInstance())->getObjectById($_SESSION[SlimPostgres::SESSION_KEY_ADMINISTRATOR_ID])) {
            unset($_SESSION[SlimPostgres::SESSION_KEY_ADMINISTRATOR_ID]); /** remove for security */
            throw new \Exception("Invalid administrator id ".$_SESSION[SlimPostgres::SESSION_KEY_ADMINISTRATOR_ID]." in session");
        }

        return $administrator;
    }
public function getLoggedInAdministrator(): Administrator 
    {
        if (!isset($_SESSION[SlimPostgres::SESSION_KEY_ADMINISTRATOR_ID])) {
            throw new \Exception("No one is logged in");
        }

        if (null === $administrator = (AdministratorsEntityMapper::getInstance())->getObjectById($_SESSION[SlimPostgres::SESSION_KEY_ADMINISTRATOR_ID])) {
            unset($_SESSION[SlimPostgres::SESSION_KEY_ADMINISTRATOR_ID]); /** remove for security */
            throw new \Exception("Invalid administrator id ".$_SESSION[SlimPostgres::SESSION_KEY_ADMINISTRATOR_ID]." in session");
        }

        return $administrator;
    }
public function getLoggedInAdministrator ( ) : Administrator { if ( ! isset ( $ _SESSION [ SlimPostgres :: SESSION_KEY_ADMINISTRATOR_ID ] ) ) { throw new \ Exception ( "No one is logged in" ) ; } if ( null === $ administrator = ( AdministratorsEntityMapper :: getInstance ( ) ) -> getObjectById ( $ _SESSION [ SlimPostgres :: SESSION_KEY_ADMINISTRATOR_ID ] ) ) { unset ( $ _SESSION [ SlimPostgres :: SESSION_KEY_ADMINISTRATOR_ID ] ) ; /** remove for security */ throw new \ Exception ( "Invalid administrator id " . $ _SESSION [ SlimPostgres :: SESSION_KEY_ADMINISTRATOR_ID ] . " in session" ) ; } return $ administrator ; }
should not be called by resources that don't require authentication
should not be called by resources that don t require authentication