feat(helpdesk): align module with core list/drawer standards
- add helpdesk module pages, services, settings and tests - standardize debtor list on drawer/grid contracts and robust filter drawer behavior - add helpdesk aside panel navigation and settings visibility provider - switch primary list slug to helpdesk/debitor and remove helpdesk/search compatibility - include required core contract updates for list contracts and detail/drawer integration
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Module\Helpdesk\Service;
|
||||
|
||||
/**
|
||||
* OAuth2 client_credentials token service for BC OData access.
|
||||
*
|
||||
* This is a skeleton for V1. Basic Auth is the default and recommended
|
||||
* auth mode. OAuth2 support can be activated in settings but the full
|
||||
* token flow (request, cache, refresh) is deferred to a future version.
|
||||
*/
|
||||
class HelpdeskOAuthTokenService
|
||||
{
|
||||
public function __construct(
|
||||
private readonly HelpdeskSettingsGateway $settingsGateway,
|
||||
private readonly HelpdeskTokenRepository $tokenRepository
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a valid access token for BC API calls.
|
||||
*
|
||||
* @return string|null The bearer token, or null if unavailable.
|
||||
*/
|
||||
public function getAccessToken(int $tenantId): ?string
|
||||
{
|
||||
if ($this->settingsGateway->getAuthMode() !== HelpdeskSettingsGateway::AUTH_MODE_OAUTH2) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Check cache first
|
||||
$cached = $this->tokenRepository->findValidToken($tenantId);
|
||||
if ($cached !== null) {
|
||||
return $cached;
|
||||
}
|
||||
|
||||
// Token request would go here in a future version.
|
||||
// For V1, return null to indicate OAuth2 is not yet fully implemented.
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user