Notifying listeners before user deletion.

@param user
the user which is used in delete operation
@throws Exception
if any listener failed to handle the event
557921
private void preDelete(User user) throws Exception
   {
      for (UserEventListener listener : listeners)
      {
         listener.preDelete(user);
      }
   }
1289785
public void identity_user_user_DELETE(String user) throws IOException {
		String qPath = "/me/identity/user/{user}";
		StringBuilder sb = path(qPath, user);
		exec(qPath, "DELETE", sb.toString(), null);
	}
299506
private void preSetEnabled(User user) throws Exception
   {
      for (UserEventListener listener : listeners)
         listener.preSetEnabled(user);
   }
922687
private void createUser(Session session, UserImpl user, boolean broadcast) throws Exception
   {
      Node userStorageNode = utils.getUsersStorageNode(session);
      Node userNode = userStorageNode.addNode(user.getUserName());

      if (user.getCreatedDate() == null)
      {
         Calendar calendar = Calendar.getInstance();
         user.setCreatedDate(calendar.getTime());
      }
      user.setInternalId(userNode.getUUID());

      if (broadcast)
      {
         preSave(user, true);
      }

      writeUser(user, userNode);
      session.save();

      putInCache(user);

      if (broadcast)
      {
         postSave(user, true);
      }
   }
369371
public void deleteUser(String userName){
        ProtocolHeader header = new ProtocolHeader();
        header.setType(ProtocolType.DeleteUser);

        DeleteUserProtocol p = new DeleteUserProtocol(userName);

        connection.submitRequest(header, p, null);
    }
465219
public function deleteUser(User $user)
    {
        $url = self::makeUserUrl($user->tenantId, $user->username);
        $this->service->prepAndSend($url, array(204), 'DELETE', null, false, 'application/json', 'application/json');
	}
73317
public static void removeFavorite(@Nonnull User user, @Nonnull Item item) throws FavoriteException {
        try {
            if (isFavorite(user, item)) {
                FavoriteUserProperty fup = user.getProperty(FavoriteUserProperty.class);
                fup.removeFavorite(item.getFullName());
                FavoriteListener.fireOnRemoveFavourite(item, user);
            } else {
                throw new FavoriteException("Favourite is already unset for User: <" + user.getFullName() + "> Item: <" + item.getFullName() + ">");
            }
        } catch (IOException e) {
            throw new FavoriteException("Could not remove Favorite. User: <" + user.getFullName() + "> Item: <" + item.getFullName() + ">", e);
        }
    }
125237
public void delete(boolean notifyUser, boolean force) {
        String queryString = new QueryStringBuilder()
            .appendParam("notify", String.valueOf(notifyUser))
            .appendParam("force", String.valueOf(force))
            .toString();

        URL url = USER_URL_TEMPLATE.buildWithQuery(this.getAPI().getBaseURL(), queryString, this.getID());
        BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, "DELETE");
        BoxAPIResponse response = request.send();
        response.disconnect();
    }
277489
public synchronized void release(Object user) {
		usage--;
		if (users != null) {
			if (!users.remove(user))
				LCCore.getApplication().getDefaultLogger()
				.error("CachedObject released by " + user + " but not in users list", new Exception());
		}
	}
106096
public void withUser(boolean user) {
    if (user) {
      addQueryParameter(Constants.WITH_PARAM, Constants.WITH_USER);
    } else {
      removeQueryParameter(Constants.WITH_PARAM);
    }
  }
1245226
public function deleteUser(User $user)
    {

        /* When the api will identify a user, please uncomment this
        if ($this->container->get('security.token_storage')->getToken()->getUser()->getId() === $user->getId()) {
            throw new \Exception('A user cannot delete himself');
        }*/
        $userRole = $this->roleManager->getUserRoleByUser($user);

        //soft delete~
        $user->setMail('mail#' . $user->getId());
        $user->setFirstName('firstname#' . $user->getId());
        $user->setLastName('lastname#' . $user->getId());
        $user->setPlainPassword(uniqid());
        $user->setUsername('username#' . $user->getId());
        $user->setPublicUrl('removed#' . $user->getId());
        $user->setAdministrativeCode('code#' . $user->getId());
        $user->setIsEnabled(false);

        // keeping the user's workspace with its original code
        // would prevent creating a user with the same username
        // todo: workspace deletion should be an option
        $ws = $user->getPersonalWorkspace();

        if ($ws) {
            $ws->setCode($ws->getCode() . '#deleted_user#' . $user->getId());
            $ws->setDisplayable(false);
            $this->objectManager->persist($ws);
        }

        if ($userRole) {
            $this->objectManager->remove($userRole);
        }
        $this->objectManager->persist($user);
        $this->objectManager->flush();

        $this->strictEventDispatcher->dispatch('claroline_users_delete', 'GenericDatas', array(array($user)));
        $this->strictEventDispatcher->dispatch('log', 'Log\LogUserDelete', array($user));
        $this->strictEventDispatcher->dispatch('delete_user', 'DeleteUser', array($user));
    }
1314241
public function handleEvent(Event $event, UserNotificationEventHandler $service)
    {
        // If our event is the wrong type, just do a null/void return
        if (!$event instanceof DeactivateUser) {
            return;
        }

        $entity = $event->getUserEntity();

        if ($entity) {
            $service->deactivated($event);
        }
    }
1145812
void handleDataToListener(String dataId, ConsumerConfig config, ProviderInfoListener listener) {
        if (!canNotify()) {
            return;
        }
        if (lastUserData != null) {
            ComposeUserData composeUserData = composeUserAndConfigData(lastUserData, lastConfigData);
            notifyToListener(listener, composeUserData);
        }
    }
185644
static void onPersist(final EntityManager em, final User user) 
	{
		logger.info("");
		logger.info("");
		logger.info("#######################Persisting##########################################");
		logger.info("");
		logger.info(user.toString());
		persist(user, em);
		logger.info("");
		System.out.println("#######################Persisting##########################################");
		logger.info("");
		logger.info("");
	}
1143911
public function onKernelView(GetResponseForControllerResultEvent $event): void
    {
        $request = $event->getRequest();
        if (!RequestAttributesExtractor::extractAttributes($request)) {
            return;
        }

        $user = $event->getControllerResult();
        if (!$user instanceof UserInterface || $request->isMethodSafe(false)) {
            return;
        }

        if ('DELETE' === $request->getMethod()) {
            $this->userManager->deleteUser($user);
            $event->setControllerResult(null);
        } else {
            $this->userManager->updateUser($user);
        }
    }
1254519
public static void deleteUser(String username) throws RequestExecutionException
    {
        QueryProcessor.process(String.format("DELETE FROM %s.%s WHERE name = '%s'",
                                             AUTH_KS,
                                             USERS_CF,
                                             escape(username)),
                               consistencyForUser(username));
    }
726068
public void updateUser(User user){
        ProtocolHeader header = new ProtocolHeader();
        header.setType(ProtocolType.UpdateUser);

        UpdateUserProtocol p = new UpdateUserProtocol(user);

        connection.submitRequest(header, p, null);
    }