feat: Add initial scope checks via decorators (#7737)
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { Authorized, Post, RestController } from '@/decorators';
|
||||
import { Authorized, Post, RestController, RequireGlobalScope } from '@/decorators';
|
||||
import { OrchestrationRequest } from '@/requests';
|
||||
import { Service } from 'typedi';
|
||||
import { SingleMainSetup } from '@/services/orchestration/main/SingleMainSetup';
|
||||
import { License } from '../License';
|
||||
|
||||
@Authorized('any')
|
||||
@Authorized()
|
||||
@RestController('/orchestration')
|
||||
@Service()
|
||||
export class OrchestrationController {
|
||||
@@ -17,6 +17,7 @@ export class OrchestrationController {
|
||||
* These endpoints do not return anything, they just trigger the messsage to
|
||||
* the workers to respond on Redis with their status.
|
||||
*/
|
||||
@RequireGlobalScope('orchestration:read')
|
||||
@Post('/worker/status/:id')
|
||||
async getWorkersStatus(req: OrchestrationRequest.Get) {
|
||||
if (!this.licenseService.isWorkerViewLicensed()) return;
|
||||
@@ -24,12 +25,14 @@ export class OrchestrationController {
|
||||
return this.singleMainSetup.getWorkerStatus(id);
|
||||
}
|
||||
|
||||
@RequireGlobalScope('orchestration:read')
|
||||
@Post('/worker/status')
|
||||
async getWorkersStatusAll() {
|
||||
if (!this.licenseService.isWorkerViewLicensed()) return;
|
||||
return this.singleMainSetup.getWorkerStatus();
|
||||
}
|
||||
|
||||
@RequireGlobalScope('orchestration:list')
|
||||
@Post('/worker/ids')
|
||||
async getWorkerIdsAll() {
|
||||
if (!this.licenseService.isWorkerViewLicensed()) return;
|
||||
|
||||
Reference in New Issue
Block a user