diff --git a/pandora_console/api/documentation/swagger-initializer.js b/pandora_console/api/documentation/swagger-initializer.js index eabfaabb93..d00409f2a7 100644 --- a/pandora_console/api/documentation/swagger-initializer.js +++ b/pandora_console/api/documentation/swagger-initializer.js @@ -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 }); diff --git a/pandora_console/include/lib/Modules/Profiles/Entities/Profile.php b/pandora_console/include/lib/Modules/Profiles/Entities/Profile.php index 465346cb7f..ceea2a7ee4 100644 --- a/pandora_console/include/lib/Modules/Profiles/Entities/Profile.php +++ b/pandora_console/include/lib/Modules/Profiles/Entities/Profile.php @@ -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( diff --git a/pandora_console/include/lib/Modules/Users/Services/CreateUserService.php b/pandora_console/include/lib/Modules/Users/Services/CreateUserService.php index 73b898ba56..d5135ab416 100644 --- a/pandora_console/include/lib/Modules/Users/Services/CreateUserService.php +++ b/pandora_console/include/lib/Modules/Users/Services/CreateUserService.php @@ -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()) ); diff --git a/pandora_console/include/lib/Modules/Users/UserProfiles/Services/CreateUserProfileService.php b/pandora_console/include/lib/Modules/Users/UserProfiles/Services/CreateUserProfileService.php index 564174b523..ad250d482b 100644 --- a/pandora_console/include/lib/Modules/Users/UserProfiles/Services/CreateUserProfileService.php +++ b/pandora_console/include/lib/Modules/Users/UserProfiles/Services/CreateUserProfileService.php @@ -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; diff --git a/pandora_console/include/lib/Modules/Users/UserProfiles/Services/DeleteUserProfileService.php b/pandora_console/include/lib/Modules/Users/UserProfiles/Services/DeleteUserProfileService.php index 29e5b9f899..1af74c5c70 100644 --- a/pandora_console/include/lib/Modules/Users/UserProfiles/Services/DeleteUserProfileService.php +++ b/pandora_console/include/lib/Modules/Users/UserProfiles/Services/DeleteUserProfileService.php @@ -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 ); } }