- users, SMTP and batch-lock endpoints are owner/admin only - engines answer 400/403/404/409/500 instead of 200 with an error body; database errors no longer leak to the client
16 lines
583 B
PHP
16 lines
583 B
PHP
<?php
|
|
require_once __DIR__ . '/../../../session.php';
|
|
require_once '../../../assets/utils/db_auth.php';
|
|
require_once '../../../assets/utils/classes_ac/DepartmentManager.php';
|
|
|
|
$id = (int)($data['id'] ?? 0);
|
|
if (!$id) { http_response_code(400); $answer['message'] = 'Missing id'; exit(json_encode($answer)); }
|
|
|
|
$dept = new DepartmentManager($pdo2, $company_id);
|
|
$row = $dept->getById($id);
|
|
if (!$row) { http_response_code(404); $answer['message'] = 'Department not found'; exit(json_encode($answer)); }
|
|
|
|
$answer['output'] = $row;
|
|
$answer['success'] = 1;
|
|
exit(json_encode($answer));
|