Add permission checks to additional service pages

- Add grant check (54, 'D') to link payment download buttons
- Add grant check (54, 'X') to link payment request buttons
- Add grant check (65, 'D') to face auth download button
- Add grant check (60, 'D') to account holder search download button
- Add grant check (60, 'X') to account holder search request button
- Refactor inline onClick handlers to method references

Changes:
- link-payment-history-wrap: Add permission checks for download and request
- link-payment-wait-send-wrap: Add permission checks for download and request
- face-auth-page: Add permission check for download
- account-holder-search-page: Add permission check for download
- account-holder-search-list: Add permission check for search request

🤖 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:45:23 +09:00
parent a225d51119
commit 320f213319
5 changed files with 44 additions and 6 deletions

View File

@@ -4,6 +4,8 @@ import { ListDateGroup } from '../list-date-group';
import { AdditionalServiceCategory } from '../../model/types' import { AdditionalServiceCategory } from '../../model/types'
import { AccountHolderSearchListProps } from '../../model/account-holder-search/types'; import { AccountHolderSearchListProps } from '../../model/account-holder-search/types';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { checkGrant } from '@/shared/lib/check-grant';
import { showAlert } from '@/widgets/show-alert';
export const AccountHolderSearchList = ({ export const AccountHolderSearchList = ({
listItems, listItems,
@@ -63,6 +65,10 @@ export const AccountHolderSearchList = ({
const onClickToNavigate = () => { const onClickToNavigate = () => {
if (!checkGrant(60, 'X')) {
showAlert(t('common.nopermission'));
return;
}
navigate(PATHS.additionalService.accountHolderSearch.request) navigate(PATHS.additionalService.accountHolderSearch.request)
}; };
@@ -74,7 +80,7 @@ export const AccountHolderSearchList = ({
<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={ () => onClickToNavigate() } onClick={onClickToNavigate}
>{ t('additionalService.accountHolderSearch.searchRequest') }</button> >{ t('additionalService.accountHolderSearch.searchRequest') }</button>
</div> </div>
</> </>

View File

@@ -17,6 +17,8 @@ import { EmailBottomSheet } from '@/entities/common/ui/email-bottom-sheet';
import useIntersectionObserver from '@/widgets/intersection-observer'; import useIntersectionObserver from '@/widgets/intersection-observer';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { LinkPaymentHistoryDetail } from './detail/link-payment-history-detail'; import { LinkPaymentHistoryDetail } from './detail/link-payment-history-detail';
import { checkGrant } from '@/shared/lib/check-grant';
import { showAlert } from '@/widgets/show-alert';
const getPaymentResultBtnGroup = (t: any) => [ const getPaymentResultBtnGroup = (t: any) => [
{ name: t('additionalService.linkPayment.all'), value: LinkPaymentPaymentStatus.ALL }, { name: t('additionalService.linkPayment.all'), value: LinkPaymentPaymentStatus.ALL },
@@ -76,6 +78,10 @@ export const LinkPaymentHistoryWrap = () => {
}); });
const onClickToNavigate = () => { const onClickToNavigate = () => {
if (!checkGrant(54, 'X')) {
showAlert(t('common.nopermission'));
return;
}
navigate(PATHS.additionalService.linkPayment.request) navigate(PATHS.additionalService.linkPayment.request)
}; };
@@ -133,6 +139,10 @@ export const LinkPaymentHistoryWrap = () => {
}; };
const onClickToOpenEmailBottomSheet = () => { const onClickToOpenEmailBottomSheet = () => {
if (!checkGrant(54, 'D')) {
showAlert(t('common.nopermission'));
return;
}
setEmailBottomSheetOn(true); setEmailBottomSheetOn(true);
}; };
@@ -219,7 +229,7 @@ export const LinkPaymentHistoryWrap = () => {
<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'}
@@ -259,7 +269,7 @@ export const LinkPaymentHistoryWrap = () => {
<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={() => onClickToNavigate()} onClick={onClickToNavigate}
>{t('additionalService.linkPayment.applyRequest')}</button> >{t('additionalService.linkPayment.applyRequest')}</button>
</div> </div>
<LinkPaymentHistoryFilter <LinkPaymentHistoryFilter

View File

@@ -18,6 +18,8 @@ import { EmailBottomSheet } from '@/entities/common/ui/email-bottom-sheet';
import useIntersectionObserver from '@/widgets/intersection-observer'; import useIntersectionObserver from '@/widgets/intersection-observer';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { LinkPaymentWaitDetail } from './detail/link-payment-wait-detail'; import { LinkPaymentWaitDetail } from './detail/link-payment-wait-detail';
import { checkGrant } from '@/shared/lib/check-grant';
import { showAlert } from '@/widgets/show-alert';
export const LinkPaymentWaitSendWrap = () => { export const LinkPaymentWaitSendWrap = () => {
@@ -64,6 +66,10 @@ export const LinkPaymentWaitSendWrap = () => {
setFilterOn(!filterOn); setFilterOn(!filterOn);
}; };
const onClickToNavigate = () => { const onClickToNavigate = () => {
if (!checkGrant(54, 'X')) {
showAlert(t('common.nopermission'));
return;
}
navigate(PATHS.additionalService.linkPayment.request) navigate(PATHS.additionalService.linkPayment.request)
} }
@@ -120,6 +126,10 @@ export const LinkPaymentWaitSendWrap = () => {
}; };
const onClickToOpenEmailBottomSheet = () => { const onClickToOpenEmailBottomSheet = () => {
if (!checkGrant(54, 'D')) {
showAlert(t('common.nopermission'));
return;
}
setEmailBottomSheetOn(true); setEmailBottomSheetOn(true);
}; };
@@ -195,7 +205,7 @@ export const LinkPaymentWaitSendWrap = () => {
<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'}
@@ -235,7 +245,7 @@ export const LinkPaymentWaitSendWrap = () => {
<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={() => onClickToNavigate()} onClick={onClickToNavigate}
>{t('additionalService.linkPayment.applyRequest')}</button> >{t('additionalService.linkPayment.applyRequest')}</button>
</div> </div>
<LinkPaymentWaitSendFilter <LinkPaymentWaitSendFilter

View File

@@ -27,6 +27,8 @@ import { useExtensionAccessCheck } from '@/shared/lib/hooks/use-extension-access
import useIntersectionObserver from '@/widgets/intersection-observer'; import useIntersectionObserver from '@/widgets/intersection-observer';
import { snackBar } from '@/shared/lib'; import { snackBar } from '@/shared/lib';
import { AccountHolderSearchDetail } from '@/entities/additional-service/ui/account-holder-search/detail/account-holder-search-detail'; import { AccountHolderSearchDetail } from '@/entities/additional-service/ui/account-holder-search/detail/account-holder-search-detail';
import { checkGrant } from '@/shared/lib/check-grant';
import { showAlert } from '@/widgets/show-alert';
export const AccountHolderSearchPage = () => { export const AccountHolderSearchPage = () => {
const { navigate } = useNavigate(); const { navigate } = useNavigate();
@@ -139,6 +141,10 @@ export const AccountHolderSearchPage = () => {
}; };
const onClickToOpenEmailBottomSheet = () => { const onClickToOpenEmailBottomSheet = () => {
if (!checkGrant(60, 'D')) {
showAlert(t('common.nopermission'));
return;
}
setEmailBottomSheetOn(true); setEmailBottomSheetOn(true);
}; };

View File

@@ -25,6 +25,8 @@ import { ListDateGroup } from '@/entities/additional-service/ui/list-date-group'
import { useExtensionAccessCheck } from '@/shared/lib/hooks/use-extension-access-check'; import { useExtensionAccessCheck } from '@/shared/lib/hooks/use-extension-access-check';
import useIntersectionObserver from '@/widgets/intersection-observer'; import useIntersectionObserver from '@/widgets/intersection-observer';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { checkGrant } from '@/shared/lib/check-grant';
import { showAlert } from '@/widgets/show-alert';
export const FaceAuthPage = () => { export const FaceAuthPage = () => {
const { navigate } = useNavigate(); const { navigate } = useNavigate();
@@ -126,6 +128,10 @@ export const FaceAuthPage = () => {
}; };
const onClickToOpenEmailBottomSheet = () => { const onClickToOpenEmailBottomSheet = () => {
if (!checkGrant(65, 'D')) {
showAlert(t('common.nopermission'));
return;
}
setEmailBottomSheetOn(true); setEmailBottomSheetOn(true);
}; };
@@ -244,7 +250,7 @@ export const FaceAuthPage = () => {
<button <button
className="download-btn" className="download-btn"
aria-label={t('transaction.download')} aria-label={t('transaction.download')}
onClick={() => onClickToOpenEmailBottomSheet()} onClick={onClickToOpenEmailBottomSheet}
> >
<img <img
src={IMAGE_ROOT + '/ico_download.svg'} src={IMAGE_ROOT + '/ico_download.svg'}