Merge branch 'ent-13100-desplegable-de-iconos-en-wizard-de-visual-consoles-tiene-demasiado-espacio' into 'develop'
Ent 13100 desplegable de iconos en wizard de visual consoles tiene demasiado espacio See merge request artica/pandorafms!7052
This commit is contained in:
commit
02d6dbdcdb
|
@ -630,6 +630,8 @@ echo '</form>';
|
|||
echo '<span id="any_text" class="invisible">'.__('None').'</span>';
|
||||
echo '<span id="none_text" class="invisible">'.__('None').'</span>';
|
||||
echo '<span id="loading_text" class="invisible">'.__('Loading...').'</span>';
|
||||
|
||||
echo '<div id="cv-preview-img" title="'.__('Image preview').'"><center><img /></center></div>';
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
|
||||
|
@ -917,6 +919,24 @@ $('#image').on('change', function() {
|
|||
$('#image_prev').html(`<img src="${src}">`);
|
||||
});
|
||||
|
||||
$('#wizard_table span#image_prev').click(function (e) {
|
||||
e.preventDefault();
|
||||
const src = $('#wizard_table span#image_prev img').attr('src');
|
||||
|
||||
$("#cv-preview-img img").attr('src', src);
|
||||
$("#cv-preview-img").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
width: 'auto',
|
||||
clickOutside: true,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
<style type="text/css">
|
||||
select[name='kind_relationship'] option[disabled='disabled'] {
|
||||
|
|
|
@ -15,12 +15,15 @@ use PandoraFMS\Modules\Shared\Services\Config;
|
|||
|
||||
final class TokenRepositoryMySQL extends RepositoryMySQL implements TokenRepository
|
||||
{
|
||||
|
||||
|
||||
public function __construct(
|
||||
private TokenDataMapper $tokenDataMapper,
|
||||
private Config $config
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Token[],
|
||||
*/
|
||||
|
@ -49,6 +52,7 @@ final class TokenRepositoryMySQL extends RepositoryMySQL implements TokenReposit
|
|||
return $result;
|
||||
}
|
||||
|
||||
|
||||
public function count(TokenFilter $tokenFilter): int
|
||||
{
|
||||
$sql = $this->getAuthenticationQuery($tokenFilter, $this->tokenDataMapper, true);
|
||||
|
@ -65,6 +69,7 @@ final class TokenRepositoryMySQL extends RepositoryMySQL implements TokenReposit
|
|||
return (int) $count;
|
||||
}
|
||||
|
||||
|
||||
public function getOne(TokenFilter $tokenFilter): Token
|
||||
{
|
||||
try {
|
||||
|
@ -85,6 +90,7 @@ final class TokenRepositoryMySQL extends RepositoryMySQL implements TokenReposit
|
|||
return $this->tokenDataMapper->fromDatabase($result);
|
||||
}
|
||||
|
||||
|
||||
public function getExistToken(string $label): Token
|
||||
{
|
||||
try {
|
||||
|
@ -105,12 +111,14 @@ final class TokenRepositoryMySQL extends RepositoryMySQL implements TokenReposit
|
|||
return $this->tokenDataMapper->fromDatabase($result);
|
||||
}
|
||||
|
||||
|
||||
public function create(Token $token): Token
|
||||
{
|
||||
$idToken = $this->__create($token, $this->tokenDataMapper);
|
||||
return $token->setIdToken($idToken);
|
||||
}
|
||||
|
||||
|
||||
public function update(Token $token): Token
|
||||
{
|
||||
return $this->__update(
|
||||
|
@ -120,15 +128,17 @@ final class TokenRepositoryMySQL extends RepositoryMySQL implements TokenReposit
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
public function delete(int $id): void
|
||||
{
|
||||
$this->__delete($id, $this->tokenDataMapper);
|
||||
}
|
||||
|
||||
|
||||
private function getAuthenticationQuery(
|
||||
FilterAbstract $filter,
|
||||
DataMapperAbstract $mapper,
|
||||
bool $count = false
|
||||
bool $count=false
|
||||
): string {
|
||||
$pagination = '';
|
||||
$orderBy = '';
|
||||
|
@ -179,4 +189,6 @@ final class TokenRepositoryMySQL extends RepositoryMySQL implements TokenReposit
|
|||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -261,35 +261,61 @@ use PandoraFMS\Modules\Shared\Entities\Entity;
|
|||
*/
|
||||
final class Event extends Entity
|
||||
{
|
||||
|
||||
private ?int $idEvent = null;
|
||||
|
||||
private ?int $idAgent = null;
|
||||
|
||||
private ?string $idUser = null;
|
||||
|
||||
private ?int $idGroup = null;
|
||||
|
||||
private ?EventStatusEnum $status = null;
|
||||
|
||||
private ?string $timestamp = null;
|
||||
|
||||
private ?string $event = null;
|
||||
|
||||
private ?int $utimestamp = null;
|
||||
|
||||
private ?EventTypeEnum $eventType = null;
|
||||
|
||||
private ?int $idAgentModule = null;
|
||||
|
||||
private ?int $idAlertAm = null;
|
||||
|
||||
private ?EventSeverityEnum $severity = null;
|
||||
|
||||
private ?string $tags = null;
|
||||
|
||||
private ?string $source = null;
|
||||
|
||||
private ?string $idExtra = null;
|
||||
|
||||
private ?string $criticalInstructions = null;
|
||||
|
||||
private ?string $warningInstructions = null;
|
||||
|
||||
private ?string $unknownInstructions = null;
|
||||
|
||||
private ?string $ownerUser = null;
|
||||
|
||||
private ?int $ackUtimestamp = null;
|
||||
|
||||
private ?string $customData = null;
|
||||
|
||||
private ?string $data = null;
|
||||
|
||||
private ?int $moduleStatus = null;
|
||||
|
||||
private ?string $eventCustomId = null;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public function fieldsReadOnly(): array
|
||||
{
|
||||
return [
|
||||
|
@ -301,6 +327,7 @@ final class Event extends Entity
|
|||
];
|
||||
}
|
||||
|
||||
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
return [
|
||||
|
@ -331,35 +358,36 @@ final class Event extends Entity
|
|||
];
|
||||
}
|
||||
|
||||
|
||||
public function getValidations(): array
|
||||
{
|
||||
return [
|
||||
'idEvent' => [
|
||||
'idEvent' => [
|
||||
EventValidator::INTEGER,
|
||||
EventValidator::GREATERTHAN,
|
||||
],
|
||||
'idAgent' => [
|
||||
'idAgent' => [
|
||||
EventValidator::INTEGER,
|
||||
EventValidator::GREATEREQUALTHAN,
|
||||
],
|
||||
'idUser' => EventValidator::STRING,
|
||||
'idGroup' => [
|
||||
'idUser' => EventValidator::STRING,
|
||||
'idGroup' => [
|
||||
EventValidator::INTEGER,
|
||||
EventValidator::GREATEREQUALTHAN,
|
||||
],
|
||||
'status' => EventValidator::VALIDSTATUS,
|
||||
'timestamp' => EventValidator::DATETIME,
|
||||
'event' => EventValidator::STRING,
|
||||
'utimestamp' => [
|
||||
'status' => EventValidator::VALIDSTATUS,
|
||||
'timestamp' => EventValidator::DATETIME,
|
||||
'event' => EventValidator::STRING,
|
||||
'utimestamp' => [
|
||||
EventValidator::INTEGER,
|
||||
EventValidator::GREATEREQUALTHAN,
|
||||
],
|
||||
'eventType' => EventValidator::VALIDTYPE,
|
||||
'idAgentModule' => [
|
||||
'eventType' => EventValidator::VALIDTYPE,
|
||||
'idAgentModule' => [
|
||||
EventValidator::INTEGER,
|
||||
EventValidator::GREATEREQUALTHAN,
|
||||
],
|
||||
'idAlertAm' => [
|
||||
'idAlertAm' => [
|
||||
EventValidator::INTEGER,
|
||||
EventValidator::GREATEREQUALTHAN,
|
||||
],
|
||||
|
@ -375,62 +403,78 @@ final class Event extends Entity
|
|||
EventValidator::INTEGER,
|
||||
EventValidator::GREATEREQUALTHAN,
|
||||
],
|
||||
'customData' => EventValidator::STRING,
|
||||
'data' => EventValidator::STRING,
|
||||
'moduleStatus' => EventValidator::INTEGER,
|
||||
'eventCustomId' => EventValidator::STRING,
|
||||
'customData' => EventValidator::STRING,
|
||||
'data' => EventValidator::STRING,
|
||||
'moduleStatus' => EventValidator::INTEGER,
|
||||
'eventCustomId' => EventValidator::STRING,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function validateFields(array $filters): array
|
||||
{
|
||||
return (new EventValidator())->validate($filters);
|
||||
}
|
||||
|
||||
|
||||
public function getIdEvent(): ?int
|
||||
{
|
||||
return $this->idEvent;
|
||||
}
|
||||
|
||||
|
||||
public function setIdEvent(?int $idEvent): self
|
||||
{
|
||||
$this->idEvent = $idEvent;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getIdAgent(): ?int
|
||||
{
|
||||
return $this->idAgent;
|
||||
}
|
||||
|
||||
|
||||
public function setIdAgent(?int $idAgent): self
|
||||
{
|
||||
$this->idAgent = $idAgent;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getIdUser(): ?string
|
||||
{
|
||||
return $this->idUser;
|
||||
}
|
||||
|
||||
|
||||
public function setIdUser(?string $idUser): self
|
||||
{
|
||||
$this->idUser = $idUser;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getIdGroup(): ?int
|
||||
{
|
||||
return $this->idGroup;
|
||||
}
|
||||
|
||||
|
||||
public function setIdGroup(?int $idGroup): self
|
||||
{
|
||||
$this->idGroup = $idGroup;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getStatus(): ?EventStatusEnum
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
|
||||
public function setStatus(null|string|EventStatusEnum $status): self
|
||||
{
|
||||
if (is_string($status) === true) {
|
||||
|
@ -442,40 +486,52 @@ final class Event extends Entity
|
|||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getTimestamp(): ?string
|
||||
{
|
||||
return $this->timestamp;
|
||||
}
|
||||
|
||||
|
||||
public function setTimestamp(?string $timestamp): self
|
||||
{
|
||||
$this->timestamp = $timestamp;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getEvent(): ?string
|
||||
{
|
||||
return $this->event;
|
||||
}
|
||||
|
||||
|
||||
public function setEvent(?string $event): self
|
||||
{
|
||||
$this->event = $event;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getUtimestamp(): ?int
|
||||
{
|
||||
return $this->utimestamp;
|
||||
}
|
||||
|
||||
|
||||
public function setUtimestamp(?int $utimestamp): self
|
||||
{
|
||||
$this->utimestamp = $utimestamp;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getEventType(): ?EventTypeEnum
|
||||
{
|
||||
return $this->eventType;
|
||||
}
|
||||
|
||||
|
||||
public function setEventType(null|string|EventTypeEnum $eventType): self
|
||||
{
|
||||
if (is_string($eventType) === true) {
|
||||
|
@ -487,30 +543,39 @@ final class Event extends Entity
|
|||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getIdAgentModule(): ?int
|
||||
{
|
||||
return $this->idAgentModule;
|
||||
}
|
||||
|
||||
|
||||
public function setIdAgentModule(?int $idAgentModule): self
|
||||
{
|
||||
$this->idAgentModule = $idAgentModule;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getIdAlertAm(): ?int
|
||||
{
|
||||
return $this->idAlertAm;
|
||||
}
|
||||
|
||||
|
||||
public function setIdAlertAm(?int $idAlertAm): self
|
||||
{
|
||||
$this->idAlertAm = $idAlertAm;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getSeverity(): ?EventSeverityEnum
|
||||
{
|
||||
return $this->severity;
|
||||
}
|
||||
|
||||
|
||||
public function setSeverity(null|string|EventSeverityEnum $severity): self
|
||||
{
|
||||
if (is_string($severity) === true) {
|
||||
|
@ -522,123 +587,161 @@ final class Event extends Entity
|
|||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getTags(): ?string
|
||||
{
|
||||
return $this->tags;
|
||||
}
|
||||
|
||||
|
||||
public function setTags(?string $tags): self
|
||||
{
|
||||
$this->tags = $tags;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getSource(): ?string
|
||||
{
|
||||
return $this->source;
|
||||
}
|
||||
|
||||
|
||||
public function setSource(?string $source): self
|
||||
{
|
||||
$this->source = $source;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getIdExtra(): ?string
|
||||
{
|
||||
return $this->idExtra;
|
||||
}
|
||||
|
||||
|
||||
public function setIdExtra(?string $idExtra): self
|
||||
{
|
||||
$this->idExtra = $idExtra;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getCriticalInstructions(): ?string
|
||||
{
|
||||
return $this->criticalInstructions;
|
||||
}
|
||||
|
||||
|
||||
public function setCriticalInstructions(?string $criticalInstructions): self
|
||||
{
|
||||
$this->criticalInstructions = $criticalInstructions;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getWarningInstructions(): ?string
|
||||
{
|
||||
return $this->warningInstructions;
|
||||
}
|
||||
|
||||
|
||||
public function setWarningInstructions(?string $warningInstructions): self
|
||||
{
|
||||
$this->warningInstructions = $warningInstructions;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getUnknownInstructions(): ?string
|
||||
{
|
||||
return $this->unknownInstructions;
|
||||
}
|
||||
|
||||
|
||||
public function setUnknownInstructions(?string $unknownInstructions): self
|
||||
{
|
||||
$this->unknownInstructions = $unknownInstructions;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getOwnerUser(): ?string
|
||||
{
|
||||
return $this->ownerUser;
|
||||
}
|
||||
|
||||
|
||||
public function setOwnerUser(?string $ownerUser): self
|
||||
{
|
||||
$this->ownerUser = $ownerUser;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getAckUtimestamp(): ?int
|
||||
{
|
||||
return $this->ackUtimestamp;
|
||||
}
|
||||
|
||||
|
||||
public function setAckUtimestamp(?int $ackUtimestamp): self
|
||||
{
|
||||
$this->ackUtimestamp = $ackUtimestamp;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getCustomData(): ?string
|
||||
{
|
||||
return $this->customData;
|
||||
}
|
||||
|
||||
|
||||
public function setCustomData(?string $customData): self
|
||||
{
|
||||
$this->customData = $customData;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getData(): ?string
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
|
||||
public function setData(?string $data): self
|
||||
{
|
||||
$this->data = $data;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getModuleStatus(): ?int
|
||||
{
|
||||
return $this->moduleStatus;
|
||||
}
|
||||
|
||||
|
||||
public function setModuleStatus(?int $moduleStatus): self
|
||||
{
|
||||
$this->moduleStatus = $moduleStatus;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getEventCustomId(): ?string
|
||||
{
|
||||
return $this->eventCustomId;
|
||||
}
|
||||
|
||||
|
||||
public function setEventCustomId(?string $eventCustomId): self
|
||||
{
|
||||
$this->eventCustomId = $eventCustomId;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -7,13 +7,18 @@ use PandoraFMS\Modules\PandoraITSM\Inventories\Services\GetPandoraITSMInventoryS
|
|||
|
||||
final class GetPandoraITSMInventoryAction
|
||||
{
|
||||
|
||||
|
||||
public function __construct(
|
||||
private GetPandoraITSMInventoryService $getPandoraITSMInventoryService
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
public function __invoke(int $idPandoraITSMInventory): array
|
||||
{
|
||||
return $this->getPandoraITSMInventoryService->__invoke($idPandoraITSMInventory);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -10,12 +10,15 @@ use PandoraFMS\Modules\Shared\Entities\PaginationData;
|
|||
|
||||
final class ListPandoraITSMInventoryAction
|
||||
{
|
||||
|
||||
|
||||
public function __construct(
|
||||
private ListPandoraITSMInventoryService $listPandoraITSMInventoryService,
|
||||
private CountPandoraITSMInventoryService $countPandoraITSMInventoryService
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
public function __invoke(PandoraITSMInventoryFilter $pandoraITSMInventoryFilter): array
|
||||
{
|
||||
return (new PaginationData(
|
||||
|
@ -25,4 +28,6 @@ final class ListPandoraITSMInventoryAction
|
|||
$this->listPandoraITSMInventoryService->__invoke($pandoraITSMInventoryFilter)
|
||||
))->toArray();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -11,25 +11,28 @@ use Psr\Http\Message\ServerRequestInterface as Request;
|
|||
|
||||
final class GetPandoraITSMInventoryController extends Controller
|
||||
{
|
||||
|
||||
|
||||
public function __construct(
|
||||
private GetPandoraITSMInventoryAction $getPandoraITSMInventoryAction,
|
||||
private ValidateAclSystem $acl
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @OA\Get(
|
||||
* security={{ "bearerAuth": {}}},
|
||||
* path="/pandoraITSM/inventory/{idPandoraITSMInventory}",
|
||||
* tags={"PandoraITSM"},
|
||||
* summary="Show pandoraITSMInventory",
|
||||
* @OA\Parameter(ref="#/components/parameters/parameterIdPandoraITSMInventory"),
|
||||
* @OA\Response(response=200, ref="#/components/responses/ResponsePandoraITSMInventory"),
|
||||
* @OA\Response(response=400, ref="#/components/responses/BadRequest"),
|
||||
* @OA\Response(response=401, ref="#/components/responses/Unauthorized"),
|
||||
* @OA\Response(response=403, ref="#/components/responses/Forbidden"),
|
||||
* @OA\Response(response=404, ref="#/components/responses/NotFound"),
|
||||
* @OA\Response(response=500, ref="#/components/responses/InternalServerError")
|
||||
* @OA\Parameter(ref="#/components/parameters/parameterIdPandoraITSMInventory"),
|
||||
* @OA\Response(response=200, ref="#/components/responses/ResponsePandoraITSMInventory"),
|
||||
* @OA\Response(response=400, ref="#/components/responses/BadRequest"),
|
||||
* @OA\Response(response=401, ref="#/components/responses/Unauthorized"),
|
||||
* @OA\Response(response=403, ref="#/components/responses/Forbidden"),
|
||||
* @OA\Response(response=404, ref="#/components/responses/NotFound"),
|
||||
* @OA\Response(response=500, ref="#/components/responses/InternalServerError")
|
||||
* )
|
||||
*/
|
||||
public function __invoke(Request $request, Response $response): Response
|
||||
|
@ -41,4 +44,6 @@ final class GetPandoraITSMInventoryController extends Controller
|
|||
$result = $this->getPandoraITSMInventoryAction->__invoke($idPandoraITSMInventory);
|
||||
return $this->getResponse($response, $result);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -12,40 +12,43 @@ use Psr\Http\Message\ServerRequestInterface as Request;
|
|||
|
||||
final class ListPandoraITSMInventoryController extends Controller
|
||||
{
|
||||
|
||||
|
||||
public function __construct(
|
||||
private ListPandoraITSMInventoryAction $listPandoraITSMInventoryAction,
|
||||
private ValidateAclSystem $acl,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @OA\Post(
|
||||
* security={{ "bearerAuth": {}}},
|
||||
* tags={"PandoraITSM"},
|
||||
* path="/pandoraITSM/inventory/list",
|
||||
* summary="List pandoraITSMInventories",
|
||||
* @OA\Parameter(ref="#/components/parameters/parameterPage"),
|
||||
* @OA\Parameter(ref="#/components/parameters/parameterSizePage"),
|
||||
* @OA\Parameter(ref="#/components/parameters/parameterSortField"),
|
||||
* @OA\Parameter(ref="#/components/parameters/parameterSortDirection"),
|
||||
* @OA\RequestBody(ref="#/components/requestBodies/requestBodyPandoraITSMInventoryFilter"),
|
||||
* @OA\Response(
|
||||
* @OA\Parameter(ref="#/components/parameters/parameterPage"),
|
||||
* @OA\Parameter(ref="#/components/parameters/parameterSizePage"),
|
||||
* @OA\Parameter(ref="#/components/parameters/parameterSortField"),
|
||||
* @OA\Parameter(ref="#/components/parameters/parameterSortDirection"),
|
||||
* @OA\RequestBody(ref="#/components/requestBodies/requestBodyPandoraITSMInventoryFilter"),
|
||||
* @OA\Response(
|
||||
* response="200",
|
||||
* description="List PandoraITSM Inventories Object",
|
||||
* content={
|
||||
* @OA\MediaType(
|
||||
* @OA\MediaType(
|
||||
* mediaType="application/json",
|
||||
* @OA\Schema(
|
||||
* @OA\Property(
|
||||
* @OA\Schema(
|
||||
* @OA\Property(
|
||||
* property="paginationData",
|
||||
* type="object",
|
||||
* ref="#/components/schemas/paginationData",
|
||||
* description="Page object",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* @OA\Property(
|
||||
* property="data",
|
||||
* type="array",
|
||||
* @OA\Items(
|
||||
* @OA\Items(
|
||||
* ref="#/components/schemas/PandoraITSMInventory",
|
||||
* description="Array of pandoraITSMInventory objects"
|
||||
* )
|
||||
|
@ -54,11 +57,11 @@ final class ListPandoraITSMInventoryController extends Controller
|
|||
* )
|
||||
* }
|
||||
* ),
|
||||
* @OA\Response(response=400, ref="#/components/responses/BadRequest"),
|
||||
* @OA\Response(response=401, ref="#/components/responses/Unauthorized"),
|
||||
* @OA\Response(response=403, ref="#/components/responses/Forbidden"),
|
||||
* @OA\Response(response=404, ref="#/components/responses/NotFound"),
|
||||
* @OA\Response(response=500, ref="#/components/responses/InternalServerError")
|
||||
* @OA\Response(response=400, ref="#/components/responses/BadRequest"),
|
||||
* @OA\Response(response=401, ref="#/components/responses/Unauthorized"),
|
||||
* @OA\Response(response=403, ref="#/components/responses/Forbidden"),
|
||||
* @OA\Response(response=404, ref="#/components/responses/NotFound"),
|
||||
* @OA\Response(response=500, ref="#/components/responses/InternalServerError")
|
||||
* )
|
||||
*/
|
||||
public function __invoke(Request $request, Response $response): Response
|
||||
|
@ -71,4 +74,6 @@ final class ListPandoraITSMInventoryController extends Controller
|
|||
$result = $this->listPandoraITSMInventoryAction->__invoke($pandoraITSMInventoryFilter);
|
||||
return $this->getResponse($response, $result);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -112,25 +112,37 @@ use PandoraFMS\Modules\Shared\Validators\Validator;
|
|||
*/
|
||||
final class PandoraITSMInventory extends Entity
|
||||
{
|
||||
|
||||
private ?int $idPandoraITSMInventory = null;
|
||||
|
||||
private ?string $agentAlias = null;
|
||||
|
||||
private ?string $osVersion = null;
|
||||
|
||||
private ?string $agentAddress = null;
|
||||
|
||||
private ?string $agentUrlAddress = null;
|
||||
|
||||
private ?bool $agentDisabled = null;
|
||||
|
||||
private ?string $groupName = null;
|
||||
|
||||
private ?int $groupId = null;
|
||||
|
||||
private ?string $osName = null;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public function fieldsReadOnly(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
return [
|
||||
|
@ -146,6 +158,7 @@ final class PandoraITSMInventory extends Entity
|
|||
];
|
||||
}
|
||||
|
||||
|
||||
public function getValidations(): array
|
||||
{
|
||||
return [
|
||||
|
@ -153,112 +166,142 @@ final class PandoraITSMInventory extends Entity
|
|||
Validator::INTEGER,
|
||||
Validator::GREATERTHAN,
|
||||
],
|
||||
'agentAlias' => Validator::STRING,
|
||||
'osVersion' => Validator::STRING,
|
||||
'agentAddress' => Validator::STRING,
|
||||
'agentUrlAddress' => Validator::STRING,
|
||||
'agentDisabled' => Validator::BOOLEAN,
|
||||
'groupName' => Validator::STRING,
|
||||
'groupId' => [
|
||||
'agentAlias' => Validator::STRING,
|
||||
'osVersion' => Validator::STRING,
|
||||
'agentAddress' => Validator::STRING,
|
||||
'agentUrlAddress' => Validator::STRING,
|
||||
'agentDisabled' => Validator::BOOLEAN,
|
||||
'groupName' => Validator::STRING,
|
||||
'groupId' => [
|
||||
Validator::INTEGER,
|
||||
Validator::GREATERTHAN,
|
||||
],
|
||||
'osName' => Validator::STRING,
|
||||
'osName' => Validator::STRING,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function validateFields(array $filters): array
|
||||
{
|
||||
return (new Validator())->validate($filters);
|
||||
}
|
||||
|
||||
|
||||
public function getIdPandoraITSMInventory(): ?int
|
||||
{
|
||||
return $this->idPandoraITSMInventory;
|
||||
}
|
||||
|
||||
|
||||
public function setIdPandoraITSMInventory(?int $idPandoraITSMInventory): self
|
||||
{
|
||||
$this->idPandoraITSMInventory = $idPandoraITSMInventory;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getAgentAlias(): ?string
|
||||
{
|
||||
return $this->agentAlias;
|
||||
}
|
||||
|
||||
|
||||
public function setAgentAlias(?string $agentAlias): self
|
||||
{
|
||||
$this->agentAlias = $agentAlias;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getOsVersion(): ?string
|
||||
{
|
||||
return $this->osVersion;
|
||||
}
|
||||
|
||||
|
||||
public function setOsVersion(?string $osVersion): self
|
||||
{
|
||||
$this->osVersion = $osVersion;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getAgentAddress(): ?string
|
||||
{
|
||||
return $this->agentAddress;
|
||||
}
|
||||
|
||||
|
||||
public function setAgentAddress(?string $agentAddress): self
|
||||
{
|
||||
$this->agentAddress = $agentAddress;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getAgentUrlAddress(): ?string
|
||||
{
|
||||
return $this->agentUrlAddress;
|
||||
}
|
||||
|
||||
|
||||
public function setAgentUrlAddress(?string $agentUrlAddress): self
|
||||
{
|
||||
$this->agentUrlAddress = $agentUrlAddress;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getGroupName(): ?string
|
||||
{
|
||||
return $this->groupName;
|
||||
}
|
||||
|
||||
|
||||
public function setGroupName(?string $groupName): self
|
||||
{
|
||||
$this->groupName = $groupName;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getOsName(): ?string
|
||||
{
|
||||
return $this->osName;
|
||||
}
|
||||
|
||||
|
||||
public function setOsName(?string $osName): self
|
||||
{
|
||||
$this->osName = $osName;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getGroupId(): ?int
|
||||
{
|
||||
return $this->groupId;
|
||||
}
|
||||
|
||||
|
||||
public function setGroupId(?int $groupId): self
|
||||
{
|
||||
$this->groupId = $groupId;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getAgentDisabled(): ?bool
|
||||
{
|
||||
return $this->agentDisabled;
|
||||
}
|
||||
|
||||
|
||||
public function setAgentDisabled(?bool $agentDisabled): self
|
||||
{
|
||||
$this->agentDisabled = $agentDisabled;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -47,9 +47,12 @@ use PandoraFMS\Modules\Shared\Validators\Validator;
|
|||
*/
|
||||
final class PandoraITSMInventoryFilter extends FilterAbstract
|
||||
{
|
||||
|
||||
private ?string $freeSearch = null;
|
||||
|
||||
private ?array $multipleSearch = null;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->setDefaultFieldOrder('tagente.id_agente');
|
||||
|
@ -57,6 +60,7 @@ final class PandoraITSMInventoryFilter extends FilterAbstract
|
|||
$this->setEntityFilter(new PandoraITSMInventory());
|
||||
}
|
||||
|
||||
|
||||
public function fieldsTranslate(): array
|
||||
{
|
||||
return [
|
||||
|
@ -72,11 +76,13 @@ final class PandoraITSMInventoryFilter extends FilterAbstract
|
|||
];
|
||||
}
|
||||
|
||||
|
||||
public function fieldsReadOnly(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
return [
|
||||
|
@ -85,22 +91,26 @@ final class PandoraITSMInventoryFilter extends FilterAbstract
|
|||
];
|
||||
}
|
||||
|
||||
|
||||
public function getValidations(): array
|
||||
{
|
||||
$validations = [];
|
||||
if($this->getEntityFilter() !== null) {
|
||||
if ($this->getEntityFilter() !== null) {
|
||||
$validations = $this->getEntityFilter()->getValidations();
|
||||
}
|
||||
|
||||
$validations['freeSearch'] = Validator::STRING;
|
||||
$validations['multipleSearch'] = Validator::ARRAY;
|
||||
return $validations;
|
||||
}
|
||||
|
||||
|
||||
public function validateFields(array $filters): array
|
||||
{
|
||||
return (new Validator())->validate($filters);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the value of freeSearch.
|
||||
*
|
||||
|
@ -111,11 +121,11 @@ final class PandoraITSMInventoryFilter extends FilterAbstract
|
|||
return $this->freeSearch;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the value of freeSearch.
|
||||
*
|
||||
* @param ?string $freeSearch
|
||||
*
|
||||
* @param string $freeSearch
|
||||
*/
|
||||
public function setFreeSearch(?string $freeSearch): self
|
||||
{
|
||||
|
@ -123,6 +133,7 @@ final class PandoraITSMInventoryFilter extends FilterAbstract
|
|||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the value of fieldsFreeSearch.
|
||||
*
|
||||
|
@ -136,6 +147,7 @@ final class PandoraITSMInventoryFilter extends FilterAbstract
|
|||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the value of multipleSearchString.
|
||||
*
|
||||
|
@ -146,14 +158,17 @@ final class PandoraITSMInventoryFilter extends FilterAbstract
|
|||
return $this->multipleSearch;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the value of multipleSearchString.
|
||||
*
|
||||
* @param ?array $multipleSearch
|
||||
* @param array $multipleSearch
|
||||
*/
|
||||
public function setMultipleSearch(?array $multipleSearch): self
|
||||
{
|
||||
$this->multipleSearch = $multipleSearch;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -7,18 +7,27 @@ use PandoraFMS\Modules\PandoraITSM\Inventories\Entities\PandoraITSMInventoryFilt
|
|||
|
||||
interface PandoraITSMInventoryRepository
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @return PandoraITSMInventory[],
|
||||
*/
|
||||
public function list(PandoraITSMInventoryFilter $pandoraITSMInventoryFilter): array;
|
||||
|
||||
|
||||
public function count(PandoraITSMInventoryFilter $pandoraITSMInventoryFilter): int;
|
||||
|
||||
|
||||
public function getOne(PandoraITSMInventoryFilter $pandoraITSMInventoryFilter): array;
|
||||
|
||||
|
||||
public function create(PandoraITSMInventory $pandoraITSMInventory): PandoraITSMInventory;
|
||||
|
||||
|
||||
public function update(PandoraITSMInventory $pandoraITSMInventory): PandoraITSMInventory;
|
||||
|
||||
|
||||
public function delete(int $id): void;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -13,11 +13,14 @@ use PandoraFMS\Modules\Shared\Services\Config;
|
|||
|
||||
class PandoraITSMInventoryRepositoryMySQL extends RepositoryMySQL implements PandoraITSMInventoryRepository
|
||||
{
|
||||
|
||||
|
||||
public function __construct(
|
||||
private Config $config
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return PandoraITSMInventory[],
|
||||
*/
|
||||
|
@ -40,6 +43,7 @@ class PandoraITSMInventoryRepositoryMySQL extends RepositoryMySQL implements Pan
|
|||
return $result;
|
||||
}
|
||||
|
||||
|
||||
public function count(PandoraITSMInventoryFilter $pandoraITSMInventoryFilter): int
|
||||
{
|
||||
$result = $this->getPandoraITSMInventoriesQuery($pandoraITSMInventoryFilter, true);
|
||||
|
@ -59,6 +63,7 @@ class PandoraITSMInventoryRepositoryMySQL extends RepositoryMySQL implements Pan
|
|||
return (int) $count;
|
||||
}
|
||||
|
||||
|
||||
public function getOne(PandoraITSMInventoryFilter $pandoraITSMInventoryFilter): array
|
||||
{
|
||||
try {
|
||||
|
@ -68,7 +73,6 @@ class PandoraITSMInventoryRepositoryMySQL extends RepositoryMySQL implements Pan
|
|||
if (empty($result_array) === false) {
|
||||
$result = array_shift($result_array);
|
||||
}
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
// Capture errors mysql.
|
||||
throw new InvalidArgumentException(
|
||||
|
@ -84,23 +88,27 @@ class PandoraITSMInventoryRepositoryMySQL extends RepositoryMySQL implements Pan
|
|||
return $result;
|
||||
}
|
||||
|
||||
|
||||
public function create(PandoraITSMInventory $pandoraITSMInventory): PandoraITSMInventory
|
||||
{
|
||||
return $pandoraITSMInventory;
|
||||
}
|
||||
|
||||
|
||||
public function update(PandoraITSMInventory $pandoraITSMInventory): PandoraITSMInventory
|
||||
{
|
||||
return $pandoraITSMInventory;
|
||||
}
|
||||
|
||||
|
||||
public function delete(int $id): void
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
private function getPandoraITSMInventoriesQuery(
|
||||
FilterAbstract $filter,
|
||||
bool $count = false
|
||||
bool $count=false
|
||||
): array {
|
||||
$pagination = '';
|
||||
$orderBy = '';
|
||||
|
@ -184,7 +192,7 @@ class PandoraITSMInventoryRepositoryMySQL extends RepositoryMySQL implements Pan
|
|||
if (isset($index_name_custom_fields[$name_field]) === true) {
|
||||
if ($index_name_custom_fields[$name_field]['is_password_type']) {
|
||||
$type = 'password';
|
||||
} elseif ($index_name_custom_fields[$name_field]['is_link_enabled']) {
|
||||
} else if ($index_name_custom_fields[$name_field]['is_link_enabled']) {
|
||||
$type = 'link';
|
||||
}
|
||||
}
|
||||
|
@ -201,4 +209,6 @@ class PandoraITSMInventoryRepositoryMySQL extends RepositoryMySQL implements Pan
|
|||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -7,13 +7,18 @@ use PandoraFMS\Modules\PandoraITSM\Inventories\Repositories\PandoraITSMInventory
|
|||
|
||||
final class CountPandoraITSMInventoryService
|
||||
{
|
||||
|
||||
|
||||
public function __construct(
|
||||
private PandoraITSMInventoryRepository $pandoraITSMInventoryRepository,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
public function __invoke(PandoraITSMInventoryFilter $pandoraITSMInventoryFilter): int
|
||||
{
|
||||
return $this->pandoraITSMInventoryRepository->count($pandoraITSMInventoryFilter);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -8,18 +8,25 @@ use PandoraFMS\Modules\PandoraITSM\Inventories\Repositories\PandoraITSMInventory
|
|||
|
||||
final class GetPandoraITSMInventoryService
|
||||
{
|
||||
|
||||
|
||||
public function __construct(
|
||||
private PandoraITSMInventoryRepository $pandoraITSMInventoryRepository,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
public function __invoke(int $idPandoraITSMInventory): array
|
||||
{
|
||||
$pandoraITSMInventoryFilter = new PandoraITSMInventoryFilter();
|
||||
/** @var PandoraITSMInventory $entityFilter */
|
||||
/*
|
||||
@var PandoraITSMInventory $entityFilter
|
||||
*/
|
||||
$entityFilter = $pandoraITSMInventoryFilter->getEntityFilter();
|
||||
$entityFilter->setIdPandoraITSMInventory($idPandoraITSMInventory);
|
||||
|
||||
return $this->pandoraITSMInventoryRepository->getOne($pandoraITSMInventoryFilter);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -7,13 +7,18 @@ use PandoraFMS\Modules\PandoraITSM\Inventories\Repositories\PandoraITSMInventory
|
|||
|
||||
final class ListPandoraITSMInventoryService
|
||||
{
|
||||
|
||||
|
||||
public function __construct(
|
||||
private PandoraITSMInventoryRepository $pandoraITSMInventoryRepository,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
public function __invoke(PandoraITSMInventoryFilter $pandoraITSMInventoryFilter): array
|
||||
{
|
||||
return $this->pandoraITSMInventoryRepository->list($pandoraITSMInventoryFilter);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -13,11 +13,11 @@ use OpenApi\Annotations as OA;
|
|||
|
||||
More useful links:
|
||||
|
||||
* <a target='_blank' href='https://pandorafms.com/en/pandora-fms-license-2024_en/'>Pandora FMS Licence </a>
|
||||
* <a target='_blank' href='https://support.pandorafms.com'> Pandora FMS Official Support </a>
|
||||
* <a target='_blank' href='https://pandorafms.com/en/community/'> Pandora FMS Community </a>
|
||||
* <a target='_blank' href='https://pandorafms.com/en/security/vulnerability-disclosure-policy/'> Vulnerability Disclosure Policy </a>
|
||||
* <a target='_blank' href='https://pandorafms.com/en/faq/'> Pandora FMS FAQ </a>",
|
||||
* <a target='_blank' href='https://pandorafms.com/en/pandora-fms-license-2024_en/'>Pandora FMS Licence </a>
|
||||
* <a target='_blank' href='https://support.pandorafms.com'> Pandora FMS Official Support </a>
|
||||
* <a target='_blank' href='https://pandorafms.com/en/community/'> Pandora FMS Community </a>
|
||||
* <a target='_blank' href='https://pandorafms.com/en/security/vulnerability-disclosure-policy/'> Vulnerability Disclosure Policy </a>
|
||||
* <a target='_blank' href='https://pandorafms.com/en/faq/'> Pandora FMS FAQ </a>",
|
||||
* version="0.0.1"
|
||||
* ),
|
||||
* @OA\Schemes(
|
||||
|
@ -60,7 +60,7 @@ More useful links:
|
|||
* name="Users",
|
||||
* description="API Endpoints of users"
|
||||
* ),
|
||||
* @OA\Tag(
|
||||
* @OA\Tag(
|
||||
* name="PandoraITSM",
|
||||
* description="API Endpoints of integration pandoraITSM"
|
||||
* ),
|
||||
|
@ -70,7 +70,7 @@ More useful links:
|
|||
* in="query",
|
||||
* description="page",
|
||||
* required=false,
|
||||
* @OA\Schema(
|
||||
* @OA\Schema(
|
||||
* type="integer",
|
||||
* default=0
|
||||
* ),
|
||||
|
@ -82,7 +82,7 @@ More useful links:
|
|||
* in="query",
|
||||
* description="Size page",
|
||||
* required=false,
|
||||
* @OA\Schema(
|
||||
* @OA\Schema(
|
||||
* type="integer",
|
||||
* default=0
|
||||
* ),
|
||||
|
@ -94,7 +94,7 @@ More useful links:
|
|||
* in="query",
|
||||
* description="sort field",
|
||||
* required=false,
|
||||
* @OA\Schema(
|
||||
* @OA\Schema(
|
||||
* type="string",
|
||||
* default=""
|
||||
* ),
|
||||
|
@ -106,7 +106,7 @@ More useful links:
|
|||
* in="query",
|
||||
* description="sort direction",
|
||||
* required=false,
|
||||
* @OA\Schema(
|
||||
* @OA\Schema(
|
||||
* type="string",
|
||||
* enum={
|
||||
* "ASC",
|
||||
|
@ -120,12 +120,12 @@ More useful links:
|
|||
* response="BadRequest",
|
||||
* description="Bad request",
|
||||
* content={
|
||||
* @OA\MediaType(
|
||||
* @OA\MediaType(
|
||||
* mediaType="application/json",
|
||||
* @OA\Schema(
|
||||
* @OA\Schema(
|
||||
* type="object",
|
||||
* description="Error",
|
||||
* @OA\Property(
|
||||
* @OA\Property(
|
||||
* property="error",
|
||||
* type="string",
|
||||
* default="Message error"
|
||||
|
@ -139,12 +139,12 @@ More useful links:
|
|||
* response="Unauthorized",
|
||||
* description="Unauthorized",
|
||||
* content={
|
||||
* @OA\MediaType(
|
||||
* @OA\MediaType(
|
||||
* mediaType="application/json",
|
||||
* @OA\Schema(
|
||||
* @OA\Schema(
|
||||
* type="object",
|
||||
* description="Error",
|
||||
* @OA\Property(
|
||||
* @OA\Property(
|
||||
* property="error",
|
||||
* type="string",
|
||||
* default="Message error"
|
||||
|
@ -158,12 +158,12 @@ More useful links:
|
|||
* response="Forbidden",
|
||||
* description="Forbidden",
|
||||
* content={
|
||||
* @OA\MediaType(
|
||||
* @OA\MediaType(
|
||||
* mediaType="application/json",
|
||||
* @OA\Schema(
|
||||
* @OA\Schema(
|
||||
* type="object",
|
||||
* description="Error",
|
||||
* @OA\Property(
|
||||
* @OA\Property(
|
||||
* property="error",
|
||||
* type="string",
|
||||
* default="Message error"
|
||||
|
@ -177,12 +177,12 @@ More useful links:
|
|||
* response="NotFound",
|
||||
* description="Not found",
|
||||
* content={
|
||||
* @OA\MediaType(
|
||||
* @OA\MediaType(
|
||||
* mediaType="application/json",
|
||||
* @OA\Schema(
|
||||
* @OA\Schema(
|
||||
* type="object",
|
||||
* description="Error",
|
||||
* @OA\Property(
|
||||
* @OA\Property(
|
||||
* property="error",
|
||||
* type="string",
|
||||
* default="Message error"
|
||||
|
@ -196,12 +196,12 @@ More useful links:
|
|||
* response="InternalServerError",
|
||||
* description="Internal server error",
|
||||
* content={
|
||||
* @OA\MediaType(
|
||||
* @OA\MediaType(
|
||||
* mediaType="application/json",
|
||||
* @OA\Schema(
|
||||
* @OA\Schema(
|
||||
* type="object",
|
||||
* description="Error",
|
||||
* @OA\Property(
|
||||
* @OA\Property(
|
||||
* property="error",
|
||||
* type="string",
|
||||
* default="Message error"
|
||||
|
@ -215,10 +215,10 @@ More useful links:
|
|||
* response="successfullyDeleted",
|
||||
* description="Successfully deleted",
|
||||
* content={
|
||||
* @OA\MediaType(
|
||||
* @OA\MediaType(
|
||||
* mediaType="application/json",
|
||||
* @OA\Schema(
|
||||
* @OA\Property(
|
||||
* @OA\Schema(
|
||||
* @OA\Property(
|
||||
* property="result",
|
||||
* type="string",
|
||||
* default="Successfully deleted"
|
||||
|
@ -227,76 +227,76 @@ More useful links:
|
|||
* )
|
||||
* }
|
||||
* )
|
||||
*
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="multipleSearch",
|
||||
* type="object",
|
||||
* @OA\Property(
|
||||
* @OA\Property(
|
||||
* property="field",
|
||||
* type="string",
|
||||
* nullable=true,
|
||||
* description="Field to search of query"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* @OA\Property(
|
||||
* property="data",
|
||||
* type="array",
|
||||
* nullable=true,
|
||||
* @OA\Items(type="integer"),
|
||||
* @OA\Items(type="integer"),
|
||||
* description="Values to search of query IN()"
|
||||
* )
|
||||
* )
|
||||
*
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="multipleSearchString",
|
||||
* type="object",
|
||||
* @OA\Property(
|
||||
* @OA\Property(
|
||||
* property="field",
|
||||
* type="string",
|
||||
* nullable=true,
|
||||
* description="Field to search of query"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* @OA\Property(
|
||||
* property="data",
|
||||
* type="array",
|
||||
* nullable=true,
|
||||
* @OA\Items(type="string"),
|
||||
* @OA\Items(type="string"),
|
||||
* description="Values to search of query IN()"
|
||||
* )
|
||||
* )
|
||||
*
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="paginationData",
|
||||
* type="object",
|
||||
* description="Info pagination data",
|
||||
* @OA\Property(
|
||||
* @OA\Property(
|
||||
* property="totalPages",
|
||||
* type="integer",
|
||||
* nullable=true,
|
||||
* description="Number of pages",
|
||||
* readOnly=true
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* @OA\Property(
|
||||
* property="sizePage",
|
||||
* type="integer",
|
||||
* nullable=true,
|
||||
* description="Items per page",
|
||||
* readOnly=true
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* @OA\Property(
|
||||
* property="totalRegisters",
|
||||
* type="integer",
|
||||
* nullable=true,
|
||||
* description="Number of items",
|
||||
* readOnly=true
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* @OA\Property(
|
||||
* property="totalRegistersPage",
|
||||
* type="integer",
|
||||
* nullable=true,
|
||||
* description="Number of items this page",
|
||||
* readOnly=true
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* @OA\Property(
|
||||
* property="currentPage",
|
||||
* type="integer",
|
||||
* nullable=true,
|
||||
|
|
|
@ -13,6 +13,8 @@ use Psr\Http\Message\ServerRequestInterface as Request;
|
|||
|
||||
final class UserTokenMiddleware
|
||||
{
|
||||
|
||||
|
||||
public function __construct(
|
||||
private readonly ValidateServerIdentifierTokenService $validateServerIdentifierTokenService,
|
||||
private readonly ValidateUserTokenService $validateUserTokenService,
|
||||
|
@ -23,10 +25,11 @@ final class UserTokenMiddleware
|
|||
) {
|
||||
}
|
||||
|
||||
|
||||
public function check(Request $request): bool
|
||||
{
|
||||
$authorization = ($request->getHeader('Authorization')[0] ?? '');
|
||||
|
||||
|
||||
$token = null;
|
||||
try {
|
||||
$authorization = str_replace('Bearer ', '', $authorization);
|
||||
|
@ -37,11 +40,12 @@ final class UserTokenMiddleware
|
|||
$authorization,
|
||||
$matches
|
||||
);
|
||||
|
||||
|
||||
$uuid = ($matches[0] ?? '');
|
||||
if (empty($uuid) === true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$strToken = str_replace($uuid.'-', '', $authorization);
|
||||
$validToken = $this->validateUserTokenService->__invoke($uuid, $strToken);
|
||||
$token = $this->getUserTokenService->__invoke($uuid);
|
||||
|
@ -79,4 +83,6 @@ final class UserTokenMiddleware
|
|||
|
||||
return $token !== null && $validToken;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@ use PandoraFMS\Modules\Shared\Services\Config;
|
|||
|
||||
class RepositoryMySQL extends Repository
|
||||
{
|
||||
|
||||
|
||||
protected function dbGetRow(
|
||||
string $field,
|
||||
string $table,
|
||||
|
@ -29,18 +31,20 @@ class RepositoryMySQL extends Repository
|
|||
return $result;
|
||||
}
|
||||
|
||||
|
||||
protected function dbGetValue(
|
||||
string $field,
|
||||
string $table,
|
||||
array $filters,
|
||||
string $whereJoin = 'AND'
|
||||
string $whereJoin='AND'
|
||||
): mixed {
|
||||
return \db_get_value_filter($field, $table, $filters, $whereJoin);
|
||||
}
|
||||
|
||||
|
||||
protected function dbGetValueSql(
|
||||
string $sql,
|
||||
?bool $cache = false
|
||||
?bool $cache=false
|
||||
): string {
|
||||
ob_start();
|
||||
$result = \db_get_value_sql($sql, $cache);
|
||||
|
@ -57,6 +61,7 @@ class RepositoryMySQL extends Repository
|
|||
return $result;
|
||||
}
|
||||
|
||||
|
||||
protected function dbGetRowSql(
|
||||
string $sql
|
||||
): array {
|
||||
|
@ -75,9 +80,10 @@ class RepositoryMySQL extends Repository
|
|||
return $result;
|
||||
}
|
||||
|
||||
|
||||
protected function dbGetAllRowsSql(
|
||||
string $sql,
|
||||
?bool $cache = false
|
||||
?bool $cache=false
|
||||
): array {
|
||||
ob_start();
|
||||
$result = \db_get_all_rows_sql($sql, $cache);
|
||||
|
@ -94,6 +100,7 @@ class RepositoryMySQL extends Repository
|
|||
return $result;
|
||||
}
|
||||
|
||||
|
||||
protected function dbInsert(string $table, array $values): mixed
|
||||
{
|
||||
ob_start();
|
||||
|
@ -110,6 +117,7 @@ class RepositoryMySQL extends Repository
|
|||
return $result;
|
||||
}
|
||||
|
||||
|
||||
protected function dbUpdate(string $table, array $values, array $condition): mixed
|
||||
{
|
||||
ob_start();
|
||||
|
@ -130,6 +138,7 @@ class RepositoryMySQL extends Repository
|
|||
return $result;
|
||||
}
|
||||
|
||||
|
||||
protected function dbDelete(string $table, array $where): mixed
|
||||
{
|
||||
ob_start();
|
||||
|
@ -147,7 +156,8 @@ class RepositoryMySQL extends Repository
|
|||
return $result;
|
||||
}
|
||||
|
||||
protected function dbFormatWhereClauseSQL(array $values, $prefix = ''): string
|
||||
|
||||
protected function dbFormatWhereClauseSQL(array $values, $prefix=''): string
|
||||
{
|
||||
ob_start();
|
||||
$values_prefix = [];
|
||||
|
@ -165,7 +175,8 @@ class RepositoryMySQL extends Repository
|
|||
return $result;
|
||||
}
|
||||
|
||||
public function buildQueryFilters(FilterAbstract $filter, ?DataMapperAbstract $mapper = null): string
|
||||
|
||||
public function buildQueryFilters(FilterAbstract $filter, ?DataMapperAbstract $mapper=null): string
|
||||
{
|
||||
$where_clause = '1=1';
|
||||
|
||||
|
@ -179,7 +190,7 @@ class RepositoryMySQL extends Repository
|
|||
$searchEntity = $filter->getEntityFilter()->toArray();
|
||||
$translates = $filter->fieldsTranslate();
|
||||
$searchEntity = array_filter($searchEntity, fn ($value) => !is_null($value) && $value !== '' && $value !== 'null');
|
||||
if(empty($searchEntity) === false) {
|
||||
if (empty($searchEntity) === false) {
|
||||
$resultEntity = [];
|
||||
foreach ($searchEntity as $key => $value) {
|
||||
if (isset($translates[$key]) === true) {
|
||||
|
@ -217,6 +228,7 @@ class RepositoryMySQL extends Repository
|
|||
return $where_clause;
|
||||
}
|
||||
|
||||
|
||||
private function freeSearch(array $fields, string $value): string
|
||||
{
|
||||
$clause = ' AND (';
|
||||
|
@ -234,12 +246,14 @@ class RepositoryMySQL extends Repository
|
|||
return $clause;
|
||||
}
|
||||
|
||||
|
||||
private function multipleSearch(FilterAbstract $filter): string
|
||||
{
|
||||
$fields = $filter->fieldsTranslate();
|
||||
$field = '';
|
||||
if (empty($fields) === false
|
||||
&& isset($fields[($filter->getMultipleSearch()['field'])]) === true) {
|
||||
&& isset($fields[($filter->getMultipleSearch()['field'])]) === true
|
||||
) {
|
||||
$field = ($fields[($filter->getMultipleSearch()['field'] ?? '')] ?? '');
|
||||
} else {
|
||||
throw new Exception(
|
||||
|
@ -256,16 +270,18 @@ class RepositoryMySQL extends Repository
|
|||
|
||||
$clause = ' AND ('.$field.' IN ('.implode(',', $filter->getMultipleSearch()['data']).')';
|
||||
|
||||
if(isset($filter->getMultipleSearch()['secondaryGroup']) === true
|
||||
if (isset($filter->getMultipleSearch()['secondaryGroup']) === true
|
||||
&& $filter->getMultipleSearch()['secondaryGroup'] === true
|
||||
) {
|
||||
$clause .= ' OR tagent_secondary_group.id_group IN ('.implode(',', $filter->getMultipleSearch()['data']).')';
|
||||
}
|
||||
|
||||
$clause .= ')';
|
||||
|
||||
return $clause;
|
||||
}
|
||||
|
||||
|
||||
private function multipleSearchString(FilterAbstract $filter): string
|
||||
{
|
||||
$fields = $filter->fieldsTranslate();
|
||||
|
@ -291,6 +307,7 @@ class RepositoryMySQL extends Repository
|
|||
return $clause;
|
||||
}
|
||||
|
||||
|
||||
public function buildQueryPagination(FilterAbstract $filter): string
|
||||
{
|
||||
$filter->setLimit($filter->getSizePage());
|
||||
|
@ -308,6 +325,7 @@ class RepositoryMySQL extends Repository
|
|||
return $sqlLimit;
|
||||
}
|
||||
|
||||
|
||||
public function buildQueryOrderBy(FilterAbstract $filter): string
|
||||
{
|
||||
$default = '';
|
||||
|
@ -338,6 +356,7 @@ class RepositoryMySQL extends Repository
|
|||
return $return;
|
||||
}
|
||||
|
||||
|
||||
public function buildQueryGroupBy(FilterAbstract $filter): string
|
||||
{
|
||||
$groupBy = '';
|
||||
|
@ -360,6 +379,7 @@ class RepositoryMySQL extends Repository
|
|||
return $groupBy;
|
||||
}
|
||||
|
||||
|
||||
private function checkDirectionOrderByMsql(?string $direction): string
|
||||
{
|
||||
$directionArray = [
|
||||
|
@ -370,7 +390,8 @@ class RepositoryMySQL extends Repository
|
|||
return (isset($directionArray[$direction]) === true) ? $directionArray[$direction] : 'ASC';
|
||||
}
|
||||
|
||||
public function checkAclGroupMysql(string $field, ?string $mode = ''): string
|
||||
|
||||
public function checkAclGroupMysql(string $field, ?string $mode=''): string
|
||||
{
|
||||
$config = new Config();
|
||||
$isAdmin = \users_is_admin($config->get('id_user'));
|
||||
|
@ -418,10 +439,11 @@ class RepositoryMySQL extends Repository
|
|||
return $filter;
|
||||
}
|
||||
|
||||
|
||||
public function buildQuery(
|
||||
FilterAbstract $filter,
|
||||
DataMapperAbstract $mapper,
|
||||
bool $count = false
|
||||
bool $count=false
|
||||
): string {
|
||||
$filters = $this->buildQueryFilters($filter, $mapper);
|
||||
if (empty($mapper->getSearchFieldRelated()) === false) {
|
||||
|
@ -489,18 +511,23 @@ class RepositoryMySQL extends Repository
|
|||
return $sql;
|
||||
}
|
||||
|
||||
|
||||
public function maxFieldSql(string $field): string
|
||||
{
|
||||
return 'MAX('.$field.')';
|
||||
}
|
||||
|
||||
|
||||
public function safeInput(?string $value): ?string
|
||||
{
|
||||
return \io_safe_input($value);
|
||||
}
|
||||
|
||||
|
||||
public function safeOutput(?string $value): ?string
|
||||
{
|
||||
return \io_safe_output($value);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -42,9 +42,12 @@ use PandoraFMS\Modules\Users\Validators\UserValidator;
|
|||
*/
|
||||
final class UserFilter extends FilterAbstract
|
||||
{
|
||||
|
||||
private ?string $freeSearch = null;
|
||||
|
||||
private ?array $multipleSearchString = null;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->setDefaultFieldOrder(UserDataMapper::ID_USER);
|
||||
|
@ -52,6 +55,7 @@ final class UserFilter extends FilterAbstract
|
|||
$this->setEntityFilter(new User());
|
||||
}
|
||||
|
||||
|
||||
public function fieldsTranslate(): array
|
||||
{
|
||||
return [
|
||||
|
@ -60,11 +64,13 @@ final class UserFilter extends FilterAbstract
|
|||
];
|
||||
}
|
||||
|
||||
|
||||
public function fieldsReadOnly(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
return [
|
||||
|
@ -72,6 +78,7 @@ final class UserFilter extends FilterAbstract
|
|||
];
|
||||
}
|
||||
|
||||
|
||||
public function getValidations(): array
|
||||
{
|
||||
$validations = [];
|
||||
|
@ -83,11 +90,13 @@ final class UserFilter extends FilterAbstract
|
|||
return $validations;
|
||||
}
|
||||
|
||||
|
||||
public function validateFields(array $filters): array
|
||||
{
|
||||
return (new UserValidator())->validate($filters);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the value of freeSearch.
|
||||
*
|
||||
|
@ -98,10 +107,11 @@ final class UserFilter extends FilterAbstract
|
|||
return $this->freeSearch;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the value of freeSearch.
|
||||
*
|
||||
* @param ?string $freeSearch
|
||||
* @param string $freeSearch
|
||||
*/
|
||||
public function setFreeSearch(?string $freeSearch): self
|
||||
{
|
||||
|
@ -109,6 +119,7 @@ final class UserFilter extends FilterAbstract
|
|||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the value of fieldsFreeSearch.
|
||||
*
|
||||
|
@ -122,6 +133,7 @@ final class UserFilter extends FilterAbstract
|
|||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the value of multipleSearchString.
|
||||
*
|
||||
|
@ -132,14 +144,17 @@ final class UserFilter extends FilterAbstract
|
|||
return $this->multipleSearchString;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the value of multipleSearchString.
|
||||
*
|
||||
* @param ?array $multipleSearchString
|
||||
* @param array $multipleSearchString
|
||||
*/
|
||||
public function setMultipleSearchString(?array $multipleSearchString): self
|
||||
{
|
||||
$this->multipleSearchString = $multipleSearchString;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -13896,3 +13896,8 @@ button.disabled {
|
|||
.text-nowrap {
|
||||
text-wrap: nowrap;
|
||||
}
|
||||
|
||||
#wizard_table span#image_prev img {
|
||||
height: 48px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue