mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2026-08-28 22:30:37 +02:00
refactor(core): Move more code into @n8n/permissions. Add aditional tests and docs (no-changelog) (#15062)
Co-authored-by: Danny Martini <danny@n8n.io>
This commit is contained in:
co-authored by
Danny Martini
parent
cdcd059248
commit
2bb190349b
@@ -1,23 +1,13 @@
|
||||
import { Get, RestController } from '@n8n/decorators';
|
||||
|
||||
import { type AllRoleTypes, RoleService } from '@/services/role.service';
|
||||
import { 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),
|
||||
})),
|
||||
]),
|
||||
);
|
||||
getAllRoles() {
|
||||
return this.roleService.getAllRoles();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user