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:
@@ -17,6 +17,8 @@ import { useExtensionPayoutDetailDownloadCertificateMutation } from '@/entities/
|
||||
import moment from 'moment';
|
||||
import { EmailBottomSheet } from '@/entities/common/ui/email-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 = () => {
|
||||
const { t, i18n } = useTranslation();
|
||||
@@ -52,6 +54,10 @@ export const PayoutDetailPage = () => {
|
||||
});
|
||||
|
||||
const onClickToDownload = () => {
|
||||
if (!checkGrant(53, 'D')) {
|
||||
showAlert(t('common.nopermission'));
|
||||
return;
|
||||
}
|
||||
setDownloadTypeBottomSheetOn(true);
|
||||
};
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@ import { useExtensionAccessCheck } from '@/shared/lib/hooks/use-extension-access
|
||||
import useIntersectionObserver from '@/widgets/intersection-observer';
|
||||
import { PayoutList } from '@/entities/additional-service/ui/payout/payout-list';
|
||||
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 = () => {
|
||||
// Access check
|
||||
@@ -88,6 +90,10 @@ export const PayoutListPage = () => {
|
||||
});
|
||||
|
||||
const onClickToNavigation = () => {
|
||||
if (!checkGrant(53, 'X')) {
|
||||
showAlert(t('common.nopermission'));
|
||||
return;
|
||||
}
|
||||
navigate(PATHS.additionalService.payout.request);
|
||||
};
|
||||
|
||||
@@ -144,6 +150,10 @@ export const PayoutListPage = () => {
|
||||
};
|
||||
|
||||
const onClickToOpenEmailBottomSheet = () => {
|
||||
if (!checkGrant(53, 'D')) {
|
||||
showAlert(t('common.nopermission'));
|
||||
return;
|
||||
}
|
||||
setEmailBottomSheetOn(true);
|
||||
};
|
||||
|
||||
@@ -273,7 +283,7 @@ export const PayoutListPage = () => {
|
||||
<button
|
||||
className="download-btn"
|
||||
aria-label={t('common.download')}
|
||||
onClick={() => onClickToOpenEmailBottomSheet()}
|
||||
onClick={onClickToOpenEmailBottomSheet}
|
||||
>
|
||||
<img
|
||||
src={IMAGE_ROOT + '/ico_download.svg'}
|
||||
@@ -323,7 +333,7 @@ export const PayoutListPage = () => {
|
||||
<div className="apply-row">
|
||||
<button
|
||||
className="btn-50 btn-blue flex-1"
|
||||
onClick={() => onClickToNavigation()}
|
||||
onClick={onClickToNavigation}
|
||||
>{t('additionalService.payout.requestTitle')}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user