Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VDJVpPiGiWjJP1yVvvGhzQ
This commit is contained in:
@@ -38,3 +38,15 @@ export function englishNameMap(people, store) {
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
// 只回傳這個人看得到的人:最高管理者、全公司檢視看全部;部主管看自己部門;組主管看自己的組。
|
||||
export function visiblePeople(people, permission) {
|
||||
if (!permission || permission.denied) return [];
|
||||
if (permission.admin || permission.company) return people || [];
|
||||
const depts = new Set(permission.depts || []);
|
||||
const groups = new Set(permission.groups || []);
|
||||
return (people || []).filter(p => {
|
||||
const dept = String(p?.dept || '').trim();
|
||||
return depts.has(dept) || groups.has(`${dept}|${p?.group || '未分組'}`);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user