Add permission checks to payout pages

- Add grant check (53, 'D') to payout list download button
- Add grant check (53, 'X') to payout request button
- Add grant check (53, 'D') to payout detail certificate download button
- Refactor inline onClick handlers to method references

Changes:
- payout/list-page: Add permission checks for download and request actions
- payout/detail-page: Add permission check for certificate download

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jay Sheen
2025-11-05 18:28:56 +09:00
parent 8a65cd6448
commit a225d51119
2 changed files with 18 additions and 2 deletions

View File

@@ -17,6 +17,8 @@ import { useExtensionPayoutDetailDownloadCertificateMutation } from '@/entities/
import moment from 'moment'; import moment from 'moment';
import { EmailBottomSheet } from '@/entities/common/ui/email-bottom-sheet'; import { EmailBottomSheet } from '@/entities/common/ui/email-bottom-sheet';
import { DownloadTypeBottomSheet } from '@/entities/common/ui/download-type-bottom-sheet'; import { DownloadTypeBottomSheet } from '@/entities/common/ui/download-type-bottom-sheet';
import { checkGrant } from '@/shared/lib/check-grant';
import { showAlert } from '@/widgets/show-alert';
export const PayoutDetailPage = () => { export const PayoutDetailPage = () => {
const { t, i18n } = useTranslation(); const { t, i18n } = useTranslation();
@@ -52,6 +54,10 @@ export const PayoutDetailPage = () => {
}); });
const onClickToDownload = () => { const onClickToDownload = () => {
if (!checkGrant(53, 'D')) {
showAlert(t('common.nopermission'));
return;
}
setDownloadTypeBottomSheetOn(true); setDownloadTypeBottomSheetOn(true);
}; };

View File

@@ -34,6 +34,8 @@ import { useExtensionAccessCheck } from '@/shared/lib/hooks/use-extension-access
import useIntersectionObserver from '@/widgets/intersection-observer'; import useIntersectionObserver from '@/widgets/intersection-observer';
import { PayoutList } from '@/entities/additional-service/ui/payout/payout-list'; import { PayoutList } from '@/entities/additional-service/ui/payout/payout-list';
import { PayoutDetail } from '@/entities/additional-service/ui/payout/detail/payout-detail'; import { PayoutDetail } from '@/entities/additional-service/ui/payout/detail/payout-detail';
import { checkGrant } from '@/shared/lib/check-grant';
import { showAlert } from '@/widgets/show-alert';
export const PayoutListPage = () => { export const PayoutListPage = () => {
// Access check // Access check
@@ -88,6 +90,10 @@ export const PayoutListPage = () => {
}); });
const onClickToNavigation = () => { const onClickToNavigation = () => {
if (!checkGrant(53, 'X')) {
showAlert(t('common.nopermission'));
return;
}
navigate(PATHS.additionalService.payout.request); navigate(PATHS.additionalService.payout.request);
}; };
@@ -144,6 +150,10 @@ export const PayoutListPage = () => {
}; };
const onClickToOpenEmailBottomSheet = () => { const onClickToOpenEmailBottomSheet = () => {
if (!checkGrant(53, 'D')) {
showAlert(t('common.nopermission'));
return;
}
setEmailBottomSheetOn(true); setEmailBottomSheetOn(true);
}; };
@@ -273,7 +283,7 @@ export const PayoutListPage = () => {
<button <button
className="download-btn" className="download-btn"
aria-label={t('common.download')} aria-label={t('common.download')}
onClick={() => onClickToOpenEmailBottomSheet()} onClick={onClickToOpenEmailBottomSheet}
> >
<img <img
src={IMAGE_ROOT + '/ico_download.svg'} src={IMAGE_ROOT + '/ico_download.svg'}
@@ -323,7 +333,7 @@ export const PayoutListPage = () => {
<div className="apply-row"> <div className="apply-row">
<button <button
className="btn-50 btn-blue flex-1" className="btn-50 btn-blue flex-1"
onClick={() => onClickToNavigation()} onClick={onClickToNavigation}
>{t('additionalService.payout.requestTitle')}</button> >{t('additionalService.payout.requestTitle')}</button>
</div> </div>
</div> </div>