/** * Creates a user account. * The username can be an email or a mobile. * * @param string $username * @param string $password * @param string[] $roles * * @return string the already created uniqueness * * @throws EmptyPasswordInternalException * @throws InvalidUsernameInternalException * @throws ExistentUsernameInternalException */ public function create($username, $password, $roles) { $uniqueness = $this->createUniquenessSharedWorker->create(); try { $this->createProfilesInternalWorker->create($uniqueness, $username, $password, $roles); } catch (EmptyPasswordInternalException $e) { throw $e; } catch (InvalidUsernameInternalException $e) { throw $e; } catch (ExistentUsernameInternalException $e) { throw $e; } $this->logOperationInternalWorker->logCreation($uniqueness); return $uniqueness; }
/** * Deletes a user account. * * @param string $uniqueness * * @throws NonExistentIdSharedException */ public function delete($uniqueness) { try { $this->deleteUniquenessSharedWorker->delete($uniqueness); } catch (NonExistentIdSharedException $e) { throw $e; } try { $this->deleteMobileProfileSharedWorker->delete($uniqueness); } catch (NonExistentMobileProfileSharedException $e) { } try { $this->deleteInternetProfileSharedWorker->delete($uniqueness); } catch (NonExistentInternetProfileSharedException $e) { } $this->deletePrivilegeProfileSharedWorker->delete($uniqueness); $this->deleteAuthenticationProfileSharedWorker->delete($uniqueness); $this->deleteCreditProfileSharedWorker->delete($uniqueness); $this->deleteRechargeCardProfileSharedWorker->delete($uniqueness); $this->deleteInfoSmsProfileSharedWorker->delete($uniqueness); $this->logOperationInternalWorker->logDeletion($uniqueness); }