From 3fc4c10593fb0253457a954e078a9dc3327db62a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Wed, 11 Mar 2026 20:44:26 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20[payroll]=20=EA=B0=9C=EB=B0=9C=EC=84=9C?= =?UTF-8?q?=EB=B2=84=20=EC=8A=88=ED=8D=BC=EA=B4=80=EB=A6=AC=EC=9E=90=20?= =?UTF-8?q?=EA=B8=89=EC=97=AC=EA=B4=80=EB=A6=AC=20=EC=A0=91=EA=B7=BC=20?= =?UTF-8?q?=ED=97=88=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 운영서버: 기존 3인(이의찬, 전진선, 김보곤)만 접근 가능 (변경 없음) - 개발서버/로컬: 슈퍼관리자도 급여관리 전체 접근 가능 (조회+수정) - 적용 대상: 급여관리, 사업소득자 임금대장, 연봉 정보 --- .../Api/Admin/HR/BusinessIncomePaymentController.php | 5 ++++- .../Controllers/Api/Admin/HR/EmployeeSalaryController.php | 5 ++++- app/Http/Controllers/Api/Admin/HR/PayrollController.php | 5 ++++- app/Http/Controllers/HR/BusinessIncomePaymentController.php | 5 ++++- app/Http/Controllers/HR/EmployeeController.php | 5 ++++- app/Http/Controllers/HR/PayrollController.php | 5 ++++- 6 files changed, 24 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/Api/Admin/HR/BusinessIncomePaymentController.php b/app/Http/Controllers/Api/Admin/HR/BusinessIncomePaymentController.php index 24932c62..456d3ed4 100644 --- a/app/Http/Controllers/Api/Admin/HR/BusinessIncomePaymentController.php +++ b/app/Http/Controllers/Api/Admin/HR/BusinessIncomePaymentController.php @@ -25,7 +25,10 @@ public function __construct( private function checkPayrollAccess(): ?JsonResponse { - if (! in_array(auth()->user()->name, self::ALLOWED_PAYROLL_USERS)) { + $isAllowedUser = in_array(auth()->user()->name, self::ALLOWED_PAYROLL_USERS); + $isDevSuperAdmin = ! app()->environment('production') && auth()->user()->isSuperAdmin(); + + if (! $isAllowedUser && ! $isDevSuperAdmin) { return response()->json([ 'success' => false, 'message' => '급여관리는 관계자만 볼 수 있습니다.', diff --git a/app/Http/Controllers/Api/Admin/HR/EmployeeSalaryController.php b/app/Http/Controllers/Api/Admin/HR/EmployeeSalaryController.php index 0a3957d9..417eb39e 100644 --- a/app/Http/Controllers/Api/Admin/HR/EmployeeSalaryController.php +++ b/app/Http/Controllers/Api/Admin/HR/EmployeeSalaryController.php @@ -13,7 +13,10 @@ class EmployeeSalaryController extends Controller private function checkSalaryAccess(): ?JsonResponse { - if (! in_array(auth()->user()->name, self::ALLOWED_SALARY_USERS)) { + $isAllowedUser = in_array(auth()->user()->name, self::ALLOWED_SALARY_USERS); + $isDevSuperAdmin = ! app()->environment('production') && auth()->user()->isSuperAdmin(); + + if (! $isAllowedUser && ! $isDevSuperAdmin) { return response()->json([ 'success' => false, 'message' => '연봉 정보는 권한이 있는 관계자만 열람할 수 있습니다.', diff --git a/app/Http/Controllers/Api/Admin/HR/PayrollController.php b/app/Http/Controllers/Api/Admin/HR/PayrollController.php index 8554a5d4..293117f6 100644 --- a/app/Http/Controllers/Api/Admin/HR/PayrollController.php +++ b/app/Http/Controllers/Api/Admin/HR/PayrollController.php @@ -32,7 +32,10 @@ public function __construct( private function checkPayrollAccess(): ?JsonResponse { - if (! in_array(auth()->user()->name, self::ALLOWED_PAYROLL_USERS)) { + $isAllowedUser = in_array(auth()->user()->name, self::ALLOWED_PAYROLL_USERS); + $isDevSuperAdmin = ! app()->environment('production') && auth()->user()->isSuperAdmin(); + + if (! $isAllowedUser && ! $isDevSuperAdmin) { return response()->json([ 'success' => false, 'message' => '급여관리는 관계자만 볼 수 있습니다.', diff --git a/app/Http/Controllers/HR/BusinessIncomePaymentController.php b/app/Http/Controllers/HR/BusinessIncomePaymentController.php index 608c7575..16a3c485 100644 --- a/app/Http/Controllers/HR/BusinessIncomePaymentController.php +++ b/app/Http/Controllers/HR/BusinessIncomePaymentController.php @@ -25,7 +25,10 @@ public function index(Request $request): View|Response return response('', 200)->header('HX-Redirect', route('hr.business-income-payments.index')); } - if (! in_array(auth()->user()->name, self::ALLOWED_PAYROLL_USERS)) { + $isAllowedUser = in_array(auth()->user()->name, self::ALLOWED_PAYROLL_USERS); + $isDevSuperAdmin = ! app()->environment('production') && auth()->user()->isSuperAdmin(); + + if (! $isAllowedUser && ! $isDevSuperAdmin) { return view('hr.payrolls.restricted'); } diff --git a/app/Http/Controllers/HR/EmployeeController.php b/app/Http/Controllers/HR/EmployeeController.php index 7d310515..7916e9f3 100644 --- a/app/Http/Controllers/HR/EmployeeController.php +++ b/app/Http/Controllers/HR/EmployeeController.php @@ -17,7 +17,10 @@ public function __construct( private function canViewSalary(): bool { - return in_array(auth()->user()->name, self::ALLOWED_SALARY_USERS); + $isAllowedUser = in_array(auth()->user()->name, self::ALLOWED_SALARY_USERS); + $isDevSuperAdmin = ! app()->environment('production') && auth()->user()->isSuperAdmin(); + + return $isAllowedUser || $isDevSuperAdmin; } /** diff --git a/app/Http/Controllers/HR/PayrollController.php b/app/Http/Controllers/HR/PayrollController.php index 4d21cee0..84d07789 100644 --- a/app/Http/Controllers/HR/PayrollController.php +++ b/app/Http/Controllers/HR/PayrollController.php @@ -26,7 +26,10 @@ public function index(Request $request): View|Response return response('', 200)->header('HX-Redirect', route('hr.payrolls.index')); } - if (! in_array(auth()->user()->name, self::ALLOWED_PAYROLL_USERS)) { + $isAllowedUser = in_array(auth()->user()->name, self::ALLOWED_PAYROLL_USERS); + $isDevSuperAdmin = ! app()->environment('production') && auth()->user()->isSuperAdmin(); + + if (! $isAllowedUser && ! $isDevSuperAdmin) { return view('hr.payrolls.restricted'); }