fix(web): remove identity simulation and stop sending X-User-ID
Product UI no longer switches sessions locally; API clients attach Bearer tokens only and LocalAuthClient stays test-only outside the prod bundle.
This commit is contained in:
@@ -6,7 +6,6 @@ import {
|
||||
Plus,
|
||||
Trash2,
|
||||
Check,
|
||||
UserCheck,
|
||||
Users,
|
||||
Key,
|
||||
Info,
|
||||
@@ -23,7 +22,6 @@ export interface SettingsModalProps {
|
||||
users: UserProfile[];
|
||||
currentUser: UserProfile;
|
||||
onUpdateUserRole: (userId: number, roleId: string) => void;
|
||||
onSwitchUser: (user: UserProfile) => void;
|
||||
}
|
||||
|
||||
const ALL_PERMISSION_ITEMS: {
|
||||
@@ -84,7 +82,6 @@ export const SettingsModal: FC<SettingsModalProps> = ({
|
||||
users,
|
||||
currentUser,
|
||||
onUpdateUserRole,
|
||||
onSwitchUser,
|
||||
}) => {
|
||||
const [activeTab, setActiveTab] = useState<'roles' | 'users'>('roles');
|
||||
const [selectedRoleId, setSelectedRoleId] = useState<string>(roles[0]?.id || 'role-admin');
|
||||
@@ -779,35 +776,11 @@ export const SettingsModal: FC<SettingsModalProps> = ({
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{/* 切换登录人按钮 */}
|
||||
{!isCurrent ? (
|
||||
<button
|
||||
onClick={() => {
|
||||
onSwitchUser(u);
|
||||
showSavedNotification();
|
||||
}}
|
||||
style={{
|
||||
padding: '6px 14px',
|
||||
borderRadius: '6px',
|
||||
border: '1px solid var(--brand-500)',
|
||||
backgroundColor: 'var(--brand-500)',
|
||||
color: '#fff',
|
||||
fontSize: '12px',
|
||||
fontWeight: 600,
|
||||
cursor: 'pointer',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: '4px',
|
||||
}}
|
||||
>
|
||||
<UserCheck size={13} />
|
||||
<span>切换为此人登录</span>
|
||||
</button>
|
||||
) : (
|
||||
{isCurrent ? (
|
||||
<span style={{ fontSize: '12px', color: 'var(--brand-500)', fontWeight: 600, width: '120px', textAlign: 'center' }}>
|
||||
✓ 正在以此身份交互
|
||||
✓ 当前登录身份
|
||||
</span>
|
||||
)}
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -17,10 +17,7 @@ interface UserProjectRightsModalProps {
|
||||
currentProjectTitle: string;
|
||||
deliverables: DeliverableItem[];
|
||||
activeDocId: string;
|
||||
allUsers?: UserProfile[];
|
||||
canAssignLead?: boolean;
|
||||
onSwitchUser?: (user: UserProfile) => void;
|
||||
allowDevSwitch?: boolean;
|
||||
onSelectDoc: (docId: string) => void;
|
||||
onRoleChangeForDoc?: (docId: string, role: DocPermissionRole) => void;
|
||||
}
|
||||
@@ -32,10 +29,7 @@ export const UserProjectRightsModal: FC<UserProjectRightsModalProps> = ({
|
||||
currentProjectTitle,
|
||||
deliverables,
|
||||
activeDocId,
|
||||
allUsers,
|
||||
canAssignLead = true,
|
||||
onSwitchUser,
|
||||
allowDevSwitch = true,
|
||||
onSelectDoc,
|
||||
onRoleChangeForDoc,
|
||||
}) => {
|
||||
@@ -567,33 +561,7 @@ export const UserProjectRightsModal: FC<UserProjectRightsModalProps> = ({
|
||||
justifyContent: 'space-between',
|
||||
}}
|
||||
>
|
||||
{allowDevSwitch && allUsers && allUsers.length > 0 ? (
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: '6px' }}>
|
||||
<span style={{ fontSize: '11px', color: 'var(--amber-400)', fontWeight: 600 }}>[DEV 调试切人]:</span>
|
||||
{allUsers.map((u) => {
|
||||
const isCurrent = u.id === currentUser.id;
|
||||
return (
|
||||
<button
|
||||
key={u.id}
|
||||
onClick={() => onSwitchUser?.(u)}
|
||||
style={{
|
||||
padding: '4px 10px',
|
||||
borderRadius: '4px',
|
||||
border: isCurrent ? '1px solid var(--brand-500)' : '1px solid var(--border)',
|
||||
backgroundColor: isCurrent ? 'var(--brand-500)' : 'var(--bg-panel, #131820)',
|
||||
color: isCurrent ? '#fff' : 'var(--text)',
|
||||
fontSize: '11px',
|
||||
fontWeight: isCurrent ? 600 : 400,
|
||||
cursor: 'pointer',
|
||||
transition: 'all 0.15s ease',
|
||||
}}
|
||||
>
|
||||
{u.name} ({u.position.slice(0, 4)})
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
) : <div />}
|
||||
<div />
|
||||
|
||||
<button
|
||||
onClick={onClose}
|
||||
|
||||
Reference in New Issue
Block a user