31 lines
1022 B
PHP
31 lines
1022 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace MintyPHP\Module\AddressBook\Providers;
|
||
|
|
|
||
|
|
use MintyPHP\App\AppContainer;
|
||
|
|
use MintyPHP\App\Module\Contracts\SessionProvider;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Populates session with department-by-tenant hierarchy data used by the
|
||
|
|
* address book aside panel.
|
||
|
|
*
|
||
|
|
* In V1 this data is already populated by the core auth flow (loadTenantDataIntoSession).
|
||
|
|
* This provider is a placeholder that will take over population once the core
|
||
|
|
* address book hardcodings are fully removed.
|
||
|
|
*/
|
||
|
|
final class AddressBookSessionProvider implements SessionProvider
|
||
|
|
{
|
||
|
|
public function populate(array $user, AppContainer $container): void
|
||
|
|
{
|
||
|
|
// V1: available_departments_by_tenant is still populated by core's
|
||
|
|
// AuthService::loadTenantDataIntoSession(). This provider is registered
|
||
|
|
// so the contract is satisfied and the session hook is ready for V2
|
||
|
|
// when the core delegation is fully removed.
|
||
|
|
}
|
||
|
|
|
||
|
|
public function clear(): void
|
||
|
|
{
|
||
|
|
unset($_SESSION['available_departments_by_tenant']);
|
||
|
|
}
|
||
|
|
}
|