mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2026-08-29 06:40:37 +02:00
24 lines
606 B
TypeScript
24 lines
606 B
TypeScript
import { Get, RestController } from '@n8n/decorators';
|
|
|
|
import { type AllRoleTypes, RoleService } from '@/services/role.service';
|
|
|
|
@RestController('/roles')
|
|
export class RoleController {
|
|
constructor(private readonly roleService: RoleService) {}
|
|
|
|
@Get('/')
|
|
async getAllRoles() {
|
|
return Object.fromEntries(
|
|
Object.entries(this.roleService.getRoles()).map((e) => [
|
|
e[0],
|
|
(e[1] as AllRoleTypes[]).map((r) => ({
|
|
name: this.roleService.getRoleName(r),
|
|
role: r,
|
|
scopes: this.roleService.getRoleScopes(r),
|
|
licensed: this.roleService.isRoleLicensed(r),
|
|
})),
|
|
]),
|
|
);
|
|
}
|
|
}
|