new api 2.0
This commit is contained in:
parent
79a70ac588
commit
7145503284
|
@ -11,7 +11,7 @@ window.onload = function() {
|
|||
const servers = [
|
||||
{
|
||||
url: endpoint + jsonSpec.servers[0].url,
|
||||
description: "Integria API"
|
||||
description: "Pandora Fms Api"
|
||||
}
|
||||
];
|
||||
const newJsonSpec = Object.assign({}, jsonSpec, { servers });
|
||||
|
|
|
@ -13,7 +13,7 @@ use PandoraFMS\Modules\Shared\Validators\Validator;
|
|||
* property="idProfile",
|
||||
* type="integer",
|
||||
* nullable=false,
|
||||
* description="Id Incidence Type",
|
||||
* description="Id Profile",
|
||||
* readOnly=true
|
||||
* ),
|
||||
* @OA\Property(
|
||||
|
|
|
@ -27,7 +27,7 @@ final class CreateUserService
|
|||
|
||||
$this->audit->write(
|
||||
AUDIT_LOG_USER_MANAGEMENT,
|
||||
' Create user '.$user->getIdUser(),
|
||||
'Create user '.$user->getIdUser(),
|
||||
json_encode($user->toArray())
|
||||
);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace PandoraFMS\Modules\Users\UserProfiles\Services;
|
||||
|
||||
use PandoraFMS\Modules\Profiles\Services\GetProfileService;
|
||||
use PandoraFMS\Modules\Shared\Services\Audit;
|
||||
use PandoraFMS\Modules\Users\UserProfiles\Entities\UserProfile;
|
||||
use PandoraFMS\Modules\Users\UserProfiles\Repositories\UserProfileRepository;
|
||||
|
@ -12,6 +13,7 @@ final class CreateUserProfileService
|
|||
public function __construct(
|
||||
private UserProfileRepository $userProfileRepository,
|
||||
private UserProfileValidation $userProfileValidation,
|
||||
private GetProfileService $getProfileService,
|
||||
private Audit $audit
|
||||
) {
|
||||
}
|
||||
|
@ -22,9 +24,14 @@ final class CreateUserProfileService
|
|||
|
||||
$userProfile = $this->userProfileRepository->create($userProfile);
|
||||
|
||||
$profile = $this->getProfileService->__invoke($userProfile->getIdprofile());
|
||||
|
||||
// TODO: Notificaciones.
|
||||
|
||||
$this->audit->write(
|
||||
'User Management',
|
||||
' create in this user #'.$userProfile->getIdUser().' profile #'.$userProfile->getIdprofile()
|
||||
AUDIT_LOG_USER_MANAGEMENT,
|
||||
'Added profile: '.$profile->getName().' for user: '.$userProfile->getIdUser(),
|
||||
json_encode($userProfile->toArray())
|
||||
);
|
||||
|
||||
return $userProfile;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace PandoraFMS\Modules\Users\UserProfiles\Services;
|
||||
|
||||
use PandoraFMS\Modules\Profiles\Services\GetProfileService;
|
||||
use PandoraFMS\Modules\Shared\Services\Audit;
|
||||
use PandoraFMS\Modules\Shared\Services\Config;
|
||||
use PandoraFMS\Modules\Users\UserProfiles\Entities\UserProfile;
|
||||
|
@ -12,19 +13,21 @@ final class DeleteUserProfileService
|
|||
public function __construct(
|
||||
private Config $config,
|
||||
private Audit $audit,
|
||||
private GetProfileService $getProfileService,
|
||||
private UserProfileRepository $userProfileRepository,
|
||||
) {
|
||||
}
|
||||
|
||||
public function __invoke(UserProfile $userProfile): void
|
||||
{
|
||||
$id = $userProfile->getIdUserProfile();
|
||||
$idUser = $userProfile->getIdUser();
|
||||
$profile = $this->getProfileService->__invoke($userProfile->getIdprofile());
|
||||
|
||||
$this->userProfileRepository->delete($id);
|
||||
$this->userProfileRepository->delete($userProfile->getIdUserProfile());
|
||||
|
||||
$this->audit->write(
|
||||
'Incidence Management',
|
||||
' Deleted field incidence type #'.$id
|
||||
AUDIT_LOG_USER_MANAGEMENT,
|
||||
'Deleted profile: '.$profile->getName().' for user: '.$idUser
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue