fix(agent): operator role can see all agent instances
This commit is contained in:
parent
29c433c7c3
commit
4f9f456f85
|
|
@ -34,8 +34,8 @@ export class AgentInstanceController {
|
|||
const jwt = this.decodeJwt(req.headers?.['authorization'] as string | undefined);
|
||||
const userId = jwt?.sub;
|
||||
const roles: string[] = jwt?.roles ?? [];
|
||||
// Admins see all instances; regular users only see their own
|
||||
if (!userId || roles.includes('admin')) {
|
||||
// Admins and operators see all instances; regular users only see their own
|
||||
if (!userId || roles.includes('admin') || roles.includes('operator')) {
|
||||
return this.instanceRepo.findAll();
|
||||
}
|
||||
const instances = await this.instanceRepo.findByUserId(userId);
|
||||
|
|
|
|||
Loading…
Reference in New Issue