@SuppressWarnings("NullableProblems")
	@Override
	public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer,
			NativeWebRequest webRequest, WebDataBinderFactory binderFactory) {
		User currentUser = getUserContext().getCurrentUser();

		String userParam = webRequest.getParameter("ownerId");
		if (StringUtils.isNotBlank(userParam) && currentUser.getRole().hasPermission(Permission.SWITCH_TO_ANYONE)) {
			return getUserService().getOne(userParam);
		}

		// User want to do something through other User status and this
		// switchUser is other user Id
		String switchUser = null;
		Cookie[] cookies = getCookies(webRequest);
		if (cookies != null) {
			for (Cookie cookie : cookies) {
				if ("switchUser".equals(cookie.getName()) && cookie.getMaxAge() != 0) {
					switchUser = cookie.getValue();
				}
			}
		}
		// Let this can be done with parameter as well.
		switchUser = StringUtils.defaultIfBlank(webRequest.getParameter("switchUser"), switchUser);

		if (currentUser.getUserId().equals(switchUser)) {
			currentUser.setOwnerUser(null);
		} else if (StringUtils.isNotEmpty(switchUser)) {
			User ownerUser = getUserService().getOneWithEagerFetch(switchUser);
			// CurrentUser should remember whose status he used
			if (currentUser.getRole().hasPermission(Permission.SWITCH_TO_ANYONE)
					|| (ownerUser.getFollowers() != null && ownerUser.getFollowers().contains(currentUser))) {
				currentUser.setOwnerUser(ownerUser);
				return ownerUser;
			}
		} else if (StringUtils.isEmpty(switchUser)) {
			currentUser.setOwnerUser(null);
		}

		return currentUser.getFactualUser();
	}
{@link HandlerMethodArgumentResolver} for {@link User} argument.

It passes the current user instance on {@link User} argument.

@since 3.0
ngrinder-controller/src/main/java/org/ngrinder/infra/spring/UserHandlerMethodArgumentResolver.java