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:
@@ -4,6 +4,8 @@ import { ListDateGroup } from '../list-date-group';
|
||||
import { AdditionalServiceCategory } from '../../model/types'
|
||||
import { AccountHolderSearchListProps } from '../../model/account-holder-search/types';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { checkGrant } from '@/shared/lib/check-grant';
|
||||
import { showAlert } from '@/widgets/show-alert';
|
||||
|
||||
export const AccountHolderSearchList = ({
|
||||
listItems,
|
||||
@@ -63,6 +65,10 @@ export const AccountHolderSearchList = ({
|
||||
|
||||
|
||||
const onClickToNavigate = () => {
|
||||
if (!checkGrant(60, 'X')) {
|
||||
showAlert(t('common.nopermission'));
|
||||
return;
|
||||
}
|
||||
navigate(PATHS.additionalService.accountHolderSearch.request)
|
||||
};
|
||||
|
||||
@@ -74,7 +80,7 @@ export const AccountHolderSearchList = ({
|
||||
<div className="apply-row">
|
||||
<button
|
||||
className="btn-50 btn-blue flex-1"
|
||||
onClick={ () => onClickToNavigate() }
|
||||
onClick={onClickToNavigate}
|
||||
>{ t('additionalService.accountHolderSearch.searchRequest') }</button>
|
||||
</div>
|
||||
</>
|
||||
|
||||
@@ -17,6 +17,8 @@ import { EmailBottomSheet } from '@/entities/common/ui/email-bottom-sheet';
|
||||
import useIntersectionObserver from '@/widgets/intersection-observer';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
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) => [
|
||||
{ name: t('additionalService.linkPayment.all'), value: LinkPaymentPaymentStatus.ALL },
|
||||
@@ -76,6 +78,10 @@ export const LinkPaymentHistoryWrap = () => {
|
||||
});
|
||||
|
||||
const onClickToNavigate = () => {
|
||||
if (!checkGrant(54, 'X')) {
|
||||
showAlert(t('common.nopermission'));
|
||||
return;
|
||||
}
|
||||
navigate(PATHS.additionalService.linkPayment.request)
|
||||
};
|
||||
|
||||
@@ -133,6 +139,10 @@ export const LinkPaymentHistoryWrap = () => {
|
||||
};
|
||||
|
||||
const onClickToOpenEmailBottomSheet = () => {
|
||||
if (!checkGrant(54, 'D')) {
|
||||
showAlert(t('common.nopermission'));
|
||||
return;
|
||||
}
|
||||
setEmailBottomSheetOn(true);
|
||||
};
|
||||
|
||||
@@ -219,7 +229,7 @@ export const LinkPaymentHistoryWrap = () => {
|
||||
<button
|
||||
className="download-btn"
|
||||
aria-label={t('common.download')}
|
||||
onClick={() => onClickToOpenEmailBottomSheet()}
|
||||
onClick={onClickToOpenEmailBottomSheet}
|
||||
>
|
||||
<img
|
||||
src={IMAGE_ROOT + '/ico_download.svg'}
|
||||
@@ -259,7 +269,7 @@ export const LinkPaymentHistoryWrap = () => {
|
||||
<div className="apply-row">
|
||||
<button
|
||||
className="btn-50 btn-blue flex-1"
|
||||
onClick={() => onClickToNavigate()}
|
||||
onClick={onClickToNavigate}
|
||||
>{t('additionalService.linkPayment.applyRequest')}</button>
|
||||
</div>
|
||||
<LinkPaymentHistoryFilter
|
||||
|
||||
@@ -18,6 +18,8 @@ import { EmailBottomSheet } from '@/entities/common/ui/email-bottom-sheet';
|
||||
import useIntersectionObserver from '@/widgets/intersection-observer';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { LinkPaymentWaitDetail } from './detail/link-payment-wait-detail';
|
||||
import { checkGrant } from '@/shared/lib/check-grant';
|
||||
import { showAlert } from '@/widgets/show-alert';
|
||||
|
||||
|
||||
export const LinkPaymentWaitSendWrap = () => {
|
||||
@@ -64,6 +66,10 @@ export const LinkPaymentWaitSendWrap = () => {
|
||||
setFilterOn(!filterOn);
|
||||
};
|
||||
const onClickToNavigate = () => {
|
||||
if (!checkGrant(54, 'X')) {
|
||||
showAlert(t('common.nopermission'));
|
||||
return;
|
||||
}
|
||||
navigate(PATHS.additionalService.linkPayment.request)
|
||||
}
|
||||
|
||||
@@ -120,6 +126,10 @@ export const LinkPaymentWaitSendWrap = () => {
|
||||
};
|
||||
|
||||
const onClickToOpenEmailBottomSheet = () => {
|
||||
if (!checkGrant(54, 'D')) {
|
||||
showAlert(t('common.nopermission'));
|
||||
return;
|
||||
}
|
||||
setEmailBottomSheetOn(true);
|
||||
};
|
||||
|
||||
@@ -195,7 +205,7 @@ export const LinkPaymentWaitSendWrap = () => {
|
||||
<button
|
||||
className="download-btn"
|
||||
aria-label={t('common.download')}
|
||||
onClick={() => onClickToOpenEmailBottomSheet()}
|
||||
onClick={onClickToOpenEmailBottomSheet}
|
||||
>
|
||||
<img
|
||||
src={IMAGE_ROOT + '/ico_download.svg'}
|
||||
@@ -235,7 +245,7 @@ export const LinkPaymentWaitSendWrap = () => {
|
||||
<div className="apply-row">
|
||||
<button
|
||||
className="btn-50 btn-blue flex-1"
|
||||
onClick={() => onClickToNavigate()}
|
||||
onClick={onClickToNavigate}
|
||||
>{t('additionalService.linkPayment.applyRequest')}</button>
|
||||
</div>
|
||||
<LinkPaymentWaitSendFilter
|
||||
|
||||
Reference in New Issue
Block a user