Expose udsAuth.getRole for cron elevated-cwd checks.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-09-10 11:23:41 +08:00
parent cc32a6c6ea
commit 1c461285fc

View file

@ -1057,6 +1057,11 @@ async function initServices(ctx, config) {
canViewAllJobs(identity) {
return !!identity?.permissions?.canViewAllSessions
},
getRole(empNo) {
const id = String(empNo || '').trim()
if (!id || id.startsWith('__')) return 'user'
return _rolesStore?.getRole?.(id) || 'user'
},
/**
* Resolve role + permissions for an empNo (cron tools / fire-time cwd).
* Does not touch request cookies — pure lookup from roles store.