generated from VLADIMIR/template
fix
This commit is contained in:
+14
-1
@@ -255,12 +255,25 @@ func (s *server) GetScenariosCatalog(ctx context.Context, req *proto.GetScenario
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *server) GetScenario(ctx context.Context, req *proto.GetScenarioReq) (*proto.GetScenarioRsp, error) {
|
||||
func (s *server) GetFullScenario(ctx context.Context, req *proto.GetScenarioReq) (*proto.GetScenarioRsp, error) {
|
||||
claims := ctx.Value("claims").(*processor_jwt.JWTClaims)
|
||||
if !roles.HasRole(claims, roles.Author) {
|
||||
return nil, status.Errorf(codes.PermissionDenied, "permission denied")
|
||||
}
|
||||
|
||||
scenario, err := s.scenarioService.GetFullScenarioByID(ctx, int(req.Id))
|
||||
if err != nil {
|
||||
return &proto.GetScenarioRsp{
|
||||
Error: err.Error(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
return &proto.GetScenarioRsp{
|
||||
Scenario: mapScenario(scenario),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *server) GetScenario(ctx context.Context, req *proto.GetScenarioReq) (*proto.GetScenarioRsp, error) {
|
||||
scenario, err := s.scenarioService.GetScenarioByID(ctx, int(req.Id))
|
||||
if err != nil {
|
||||
return &proto.GetScenarioRsp{
|
||||
|
||||
Reference in New Issue
Block a user