mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2026-07-08 06:28:03 +02:00
f69ddcd796
## Review / Merge checklist - [x] PR title and summary are descriptive
23 lines
591 B
TypeScript
23 lines
591 B
TypeScript
import { License } from '@/License';
|
|
import { Get, RestController } from '@/decorators';
|
|
import { RoleService } from '@/services/role.service';
|
|
|
|
@RestController('/roles')
|
|
export class RoleController {
|
|
constructor(
|
|
private readonly roleService: RoleService,
|
|
private readonly license: License,
|
|
) {}
|
|
|
|
@Get('/')
|
|
async listRoles() {
|
|
return this.roleService.listRoles().map((role) => {
|
|
if (role.scope === 'global' && role.name === 'admin') {
|
|
return { ...role, isAvailable: this.license.isAdvancedPermissionsLicensed() };
|
|
}
|
|
|
|
return { ...role, isAvailable: true };
|
|
});
|
|
}
|
|
}
|