mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-21 23:49:07 +00:00
FEAT: squash - auth guard
nestjs access controll mock swagger implementation middleware changes and lib permissions file back to maestro FEAT: sending permissions to duc on startup FEAT: new permissions.enum format FEAT: permissions injection (maestro -> duc) FIX: changing method invocation order FEAT: refactored permission enum + duc permission injector + grpcHandler FEAT: auth guards FEAT: seq ids updated
This commit is contained in:
committed by
arthur simas
parent
89b571d7f8
commit
1566efc490
@@ -7,10 +7,32 @@ import {
|
||||
Post,
|
||||
Put,
|
||||
} from '@nestjs/common';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
import { PipelinesClientService } from 'src/clients/pipelines/client.service';
|
||||
import { AuthenticateCondition } from 'src/authentication/authentication.decorator';
|
||||
import { Permissions } from '../../authentication/permissions.enum';
|
||||
import { PipelinesService } from './pipelines.service';
|
||||
|
||||
@ApiTags('Pipelines')
|
||||
@Controller('pipelines')
|
||||
@AuthenticateCondition((req, user) => {
|
||||
let action;
|
||||
|
||||
switch (req.method) {
|
||||
case 'POST':
|
||||
action = 'CREATE';
|
||||
break;
|
||||
|
||||
case 'PUT':
|
||||
action = 'UPDATE';
|
||||
break;
|
||||
|
||||
default:
|
||||
action = req.method;
|
||||
}
|
||||
|
||||
return user.permissions.includes(Permissions.PIPELINE[action].seqid);
|
||||
})
|
||||
export class PipelinesController {
|
||||
constructor(private pipelinesClientService: PipelinesClientService) {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user