37 lines
1006 B
PHP
37 lines
1006 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Controllers\Api\Admin;
|
|
|
|
use CodeIgniter\HTTP\ResponseInterface;
|
|
|
|
class DashboardController extends BaseAdminApiController
|
|
{
|
|
public function index(): ResponseInterface
|
|
{
|
|
$auth = $this->requireAdminApiAccess('dashboard');
|
|
if ($auth['response'] !== null) {
|
|
return $auth['response'];
|
|
}
|
|
$cb = $this->cabangKantorAfterAuth($auth['actor']);
|
|
if ($cb['response'] !== null) {
|
|
return $cb['response'];
|
|
}
|
|
|
|
$this->auditAuthorized('api.admin.dashboard.index', $auth['actor'], [
|
|
'request' => $this->auditRequestParams(),
|
|
]);
|
|
|
|
$soloPegawaiId = null;
|
|
if (! rbac_enforce_ion()) {
|
|
$soloPegawaiId = (int) ($auth['actor']['id_pegawai'] ?? 0);
|
|
if ($soloPegawaiId <= 0) {
|
|
$soloPegawaiId = null;
|
|
}
|
|
}
|
|
|
|
return $this->respond($this->adminApi->dashboardHome($cb['kid'], $soloPegawaiId));
|
|
}
|
|
}
|