Unify MOCK_USERS with backend auth (admin id=1), merge session identity on login, and migrate demo seeds/tests to id 2/3/4 for 张工/李/王. Co-authored-by: Cursor <cursoragent@cursor.com>
17 lines
439 B
TypeScript
17 lines
439 B
TypeScript
import { UserProfile } from '../types/docgov';
|
|
|
|
/**
|
|
* 登录/session 用户身份优先,演示目录仅补充 projectPermissions 等扩展字段。
|
|
*/
|
|
export function mergeSessionUser(sessionUser: UserProfile, catalog?: UserProfile): UserProfile {
|
|
if (!catalog) {
|
|
return sessionUser;
|
|
}
|
|
|
|
return {
|
|
...catalog,
|
|
...sessionUser,
|
|
projectPermissions: catalog.projectPermissions ?? sessionUser.projectPermissions,
|
|
};
|
|
}
|