Files
ga-commission-system/ga-frontend/src/components/common/PermissionButton.tsx
T
GA Pro 49f08f001d feat: P5-W3 본론 완료 — 회계결산/이상치예측/연말명세서 (V74~V78)
P5-W2 원천세·부가세 분기신고 미커밋분 + P5-W3 메뉴/권한 보강(V74) + P5-W3 본론(V75~V78)을 일괄 정리.

- V75 accounting_close / account_balance_snapshot (회계 결산)
- V76 retention_anomaly_alert / forecast_kpi_monthly (이상치·예측 KPI)
- V77 year_end_statement (연말 지급명세서)
- V78 P5-W3 본론 메뉴 4 + 권한 + 공통코드 7그룹 + 테스트데이터
- api: AccountingClose/YearEndStatement/ForecastKpi/RetentionAnomaly Service+Controller
- batch: BatchConfig Step 11/12 (원천세·부가세 분기) 연결
- frontend: 4화면(AccountingClose/YearEndStatement/RetentionAnomaly/ForecastKpi) + API 모듈 4 + 라우트
- frontend: usePermission/PermissionButton EXECUTE 권한 누락 보강
- fix: YearEndStatementMapper.xml 미존재 컬럼 a.agent_code 참조 제거

통합검증: Flyway V74~V78 운영DB 적용(v78), 4모듈 compileJava + 프론트 build PASS,
스모크 GET 8/8 + 쓰기 4/4 PASS, verify_v74.py 20/20 PASS.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 22:22:34 +09:00

23 lines
880 B
TypeScript

import { Button, ButtonProps } from 'antd';
import { usePermission } from '@/hooks/usePermission';
interface Props extends ButtonProps {
menuCode: string;
permCode: 'READ' | 'CREATE' | 'UPDATE' | 'DELETE' | 'APPROVE' | 'EXPORT' | 'EXECUTE';
}
/** 권한 없으면 렌더링 자체를 안 함 */
export default function PermissionButton({ menuCode, permCode, children, ...rest }: Props) {
const perms = usePermission(menuCode);
const allowed =
(permCode === 'READ' && perms.canRead) ||
(permCode === 'CREATE' && perms.canCreate) ||
(permCode === 'UPDATE' && perms.canUpdate) ||
(permCode === 'DELETE' && perms.canDelete) ||
(permCode === 'APPROVE' && perms.canApprove) ||
(permCode === 'EXPORT' && perms.canExport) ||
(permCode === 'EXECUTE' && perms.canExecute);
if (!allowed) return null;
return <Button {...rest}>{children}</Button>;
}