Initial commit BIJ CI4
This commit is contained in:
36
app/Controllers/Api/Admin/DashboardController.php
Normal file
36
app/Controllers/Api/Admin/DashboardController.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user