update pay function
This commit is contained in:
37
src/views/AgentChat/neuratalk/lib/auth-override.ts
Normal file
37
src/views/AgentChat/neuratalk/lib/auth-override.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
// lib/auth-override.ts - 临时覆盖权限检查(用于测试)
|
||||
|
||||
export interface AuthOverride {
|
||||
enabled: boolean;
|
||||
forceAuth?: boolean;
|
||||
forceSubscription?: boolean;
|
||||
mockUser?: any;
|
||||
}
|
||||
|
||||
// 开发/测试模式下可以覆盖权限
|
||||
export const authOverride: AuthOverride = {
|
||||
enabled: true, // 启用覆盖
|
||||
forceAuth: true, // 强制认证通过
|
||||
forceSubscription: true, // 强制订阅权限通过
|
||||
mockUser: {
|
||||
id: 'max-user',
|
||||
username: 'Max User',
|
||||
email: 'max@valuefrontier.cn',
|
||||
subscription_tier: 'max'
|
||||
}
|
||||
};
|
||||
|
||||
export function applyAuthOverride(authInfo: any) {
|
||||
if (!authOverride.enabled) return authInfo;
|
||||
|
||||
if (authOverride.forceAuth) {
|
||||
authInfo.isAuthenticated = true;
|
||||
authInfo.user = authOverride.mockUser || authInfo.user;
|
||||
}
|
||||
|
||||
if (authOverride.forceSubscription) {
|
||||
authInfo.canAccessChat = true;
|
||||
}
|
||||
|
||||
console.log('Auth override applied:', authInfo);
|
||||
return authInfo;
|
||||
}
|
||||
Reference in New Issue
Block a user