feat: owner read-only view-as from team users table
Allow org owners to inspect any member's data scope via dual JWT; server blocks mutations and team page stays reachable for return. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -199,6 +199,14 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
setUser(data);
|
||||
}
|
||||
|
||||
/** مشاهده فقطخواندنی بهجای کاربر، یا بازگشت با targetUserId = خود مالک */
|
||||
async function viewAs(targetUserId: string) {
|
||||
const { data } = await api.post<LoginResponse>('/auth/view-as', {
|
||||
targetUserId,
|
||||
});
|
||||
persist(data);
|
||||
}
|
||||
|
||||
if (token.value) void hydrate();
|
||||
|
||||
return {
|
||||
@@ -221,5 +229,6 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
updateProfile,
|
||||
uploadAvatar,
|
||||
removeAvatar,
|
||||
viewAs,
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user