fix: harden permission-gated UI — minimum-org endpoint, modal/Popconfirm fail-closed on revocation
Some checks failed
CI / check (pull_request) Failing after 3m46s
Some checks failed
CI / check (pull_request) Failing after 3m46s
This commit is contained in:
@@ -313,10 +313,8 @@ interface MatchModalProps {
|
|||||||
|
|
||||||
const JinshujuMatchModal: React.FC<MatchModalProps> = ({ open, onClose, onApplied }) => {
|
const JinshujuMatchModal: React.FC<MatchModalProps> = ({ open, onClose, onApplied }) => {
|
||||||
const { hasPermission, hasAllPermissions, permissionsReady } = usePermission();
|
const { hasPermission, hasAllPermissions, permissionsReady } = usePermission();
|
||||||
const canReadSync = hasPermission('sync:read');
|
|
||||||
const canTriggerSync = hasPermission('sync:trigger');
|
const canTriggerSync = hasPermission('sync:trigger');
|
||||||
const canEnterModal = permissionsReady && hasAllPermissions('sync:read', 'sync:trigger');
|
const canEnterModal = permissionsReady && hasAllPermissions('sync:read', 'sync:trigger');
|
||||||
const canWriteRules = permissionsReady && canTriggerSync;
|
|
||||||
const [step, setStep] = useState<'connection' | 'rule' | 'match' | 'applying'>('connection');
|
const [step, setStep] = useState<'connection' | 'rule' | 'match' | 'applying'>('connection');
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [selectedRuleId, setSelectedRuleId] = useState<number | undefined>();
|
const [selectedRuleId, setSelectedRuleId] = useState<number | undefined>();
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ interface ExamDetail extends ExamItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const PhoneCell: React.FC<{ row: ScoreRow }> = ({ row }) => {
|
const PhoneCell: React.FC<{ row: ScoreRow }> = ({ row }) => {
|
||||||
const reveal = useViewSensitive(row.studentId, '考试管理', hasPermission('log:create'));
|
|
||||||
const { hasPermission } = usePermission();
|
const { hasPermission } = usePermission();
|
||||||
|
const reveal = useViewSensitive(row.studentId, '考试管理', hasPermission('log:create'));
|
||||||
if (!row.phone) return <>-</>;
|
if (!row.phone) return <>-</>;
|
||||||
return (
|
return (
|
||||||
<Space size={4}>
|
<Space size={4}>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useState, useMemo, useCallback, useRef } from 'react';
|
import React, { useEffect, useState, useMemo, useCallback } from 'react';
|
||||||
import {
|
import {
|
||||||
Table,
|
Table,
|
||||||
Button,
|
Button,
|
||||||
@@ -594,25 +594,25 @@ const OccupanciesPage: React.FC = () => {
|
|||||||
>
|
>
|
||||||
批量退宿
|
批量退宿
|
||||||
</PermissionButton>
|
</PermissionButton>
|
||||||
</>)}
|
) : (
|
||||||
{canDelete ? (
|
canDelete ? (
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title={`确定归档选中的 ${selectedRowKeys.length} 条入住记录?在住记录会自动跳过`}
|
title={`确定归档选中的 ${selectedRowKeys.length} 条入住记录?在住记录会自动跳过`}
|
||||||
onConfirm={handleBatchDelete}
|
onConfirm={handleBatchDelete}
|
||||||
okText="归档"
|
okText="归档"
|
||||||
cancelText="取消"
|
cancelText="取消"
|
||||||
>
|
|
||||||
<Button
|
|
||||||
danger
|
|
||||||
size="small"
|
|
||||||
icon={<InboxOutlined />}
|
|
||||||
style={{ marginLeft: 12 }}
|
|
||||||
loading={batchLoading}
|
|
||||||
>
|
>
|
||||||
批量归档
|
<Button
|
||||||
</Button>
|
danger
|
||||||
</Popconfirm>
|
size="small"
|
||||||
) : null}
|
icon={<InboxOutlined />}
|
||||||
|
style={{ marginLeft: 12 }}
|
||||||
|
loading={batchLoading}
|
||||||
|
>
|
||||||
|
批量归档
|
||||||
|
</Button>
|
||||||
|
</Popconfirm>
|
||||||
|
) : null
|
||||||
)}
|
)}
|
||||||
<Button size="small" onClick={() => setSelectedRowKeys([])} style={{ marginLeft: 8 }}>
|
<Button size="small" onClick={() => setSelectedRowKeys([])} style={{ marginLeft: 8 }}>
|
||||||
取消选择
|
取消选择
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import {
|
import {
|
||||||
Alert,
|
Alert,
|
||||||
App,
|
App,
|
||||||
|
|||||||
Reference in New Issue
Block a user