fix: enforce platform role menu access
This commit is contained in:
@@ -24,6 +24,7 @@ const useUserStore = defineStore('user', {
|
||||
accountId: undefined,
|
||||
certification: undefined,
|
||||
role: '',
|
||||
menuCodes: [],
|
||||
}),
|
||||
|
||||
getters: {
|
||||
@@ -55,7 +56,13 @@ const useUserStore = defineStore('user', {
|
||||
// Get user's information
|
||||
async info() {
|
||||
const profile = await authApi.profile();
|
||||
this.setInfo({ name: profile.display_name || profile.username, avatar: profile.avatar, accountId: profile.identity, role: '*' });
|
||||
this.setInfo({
|
||||
name: profile.display_name || profile.username,
|
||||
avatar: profile.avatar,
|
||||
accountId: profile.identity,
|
||||
role: profile.role_code,
|
||||
menuCodes: profile.menu_codes,
|
||||
});
|
||||
},
|
||||
|
||||
// Login
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export type RoleType = '' | '*' | 'admin' | 'user';
|
||||
export type RoleType = string;
|
||||
export interface UserState {
|
||||
name?: string;
|
||||
avatar?: string;
|
||||
@@ -16,4 +16,5 @@ export interface UserState {
|
||||
accountId?: string;
|
||||
certification?: number;
|
||||
role: RoleType;
|
||||
menuCodes: string[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user