This method MUST retain the state of the current instance, and return
an instance that contains the specified user information.
195294
function it_retains_the_original_state_of_the_instance_duplicated_with_new_user_info()
    {
        $original_uri = (string) $this->getWrappedObject();

        $new_user_info = $this->withUserInfo("corge", "grault");

        $this->__toString()->shouldReturn($original_uri);
    }
414960
function(user) {
		if (typeof user !== "object" || !user.id) return;
		app.states.users[user.id] = user;
		return user;
	}
733401
def _get_instance(user):
  

  inst = None
  f = Usuario.objects.filter(user=user)
  if f.exists():
    inst = f[0]
    for sub_u in Usuario.__subclasses__():
      if hasattr(inst, sub_u.__name__.lower()):
        inst = getattr(inst, sub_u.__name__.lower())
        break
  return inst
237316
def InitUser():
  
  result = AppUser.query(AppUser.user == users.get_current_user()).fetch()

  if result:
    app_user = result[0]
  else:
    app_user = AppUser(user=users.get_current_user(),
                       email=users.get_current_user().email())
    app_user.put()

  return app_user
700240
def _get_user_info(user=None):
    '''
    
    '''
    if not user:
        # Get user Salt runnining as
        user = __salt__['config.option']('user')

    userinfo = __salt__['user.info'](user)

    if not userinfo:
        if user == 'salt':
            # Special case with `salt` user:
            # if it doesn't exist then fall back to user Salt running as
            userinfo = _get_user_info()
        else:
            raise SaltInvocationError('User {0} does not exist'.format(user))

    return userinfo
1298225
def get_current_user(self, objectmask=None):
        """"""

        if objectmask is None:
            objectmask = "mask[userStatus[name], parent[id, username]]"
        return self.account_service.getCurrentUser(mask=objectmask)
539640
def current_user():
    
    user_id = current_user_id()
    guard = current_guard()
    user = guard.user_class.identify(user_id)
    PraetorianError.require_condition(
        user is not None,
        "Could not identify the current user from the current id",
    )
    return user
979257
public Map<String, Object> getUser() {
        Map<String, Object> userFields = DDPStateSingleton.getInstance()
                .getDocument("users", getUserId());
        if (userFields != null) {
            return userFields;
        }
        return null;
    }
175584
private static String extractUser(String userInfo) {
    if (userInfo == null) {
      return null;
    }

    int index = userInfo.lastIndexOf(':');
    if (index == -1) {
      return userInfo;
    } else {
      return userInfo.substring(0, index);
    }
  }
872707
def user(self):
        
        if self._user is not None:
            return self._user

        cert = self.transport.getPeerCertificate()
        self._user = user = userForCert(self.store, cert)
        return user
619967
public static Object getUser()
    {
        HttpSession session = WebContextFactory.get().getSession(true);
        return session.getAttribute(USER);
    }
146542
def state(self):
        
        return dict(
            (attr, getattr(self, attr))
            for attr in (
                'consumer_key', 'consumer_secret', 'callback_uri',
                'verified', 'oauth_token', 'oauth_token_secret',
                'oauth_session_handle', 'oauth_expires_at',
                'oauth_authorization_expires_at', 'scope'
            )
            if getattr(self, attr) is not None
        )
927204
public static Class<?> getUserClass(Object instance) {
		Assert.notNull(instance, "Instance must not be null");
		return getUserClass(instance.getClass());
	}
622025
def get_user(user=None):
    
    if user is None:
        # Return the current authenticated user
        user = getSecurityManager().getUser()
    elif isinstance(user, MemberData):
        # MemberData wrapped user -> get the user object
        user = user.getUser()
    elif isinstance(user, basestring):
        # User ID -> get the user
        user = get_member_by_login_name(get_portal(), user, False)
        if user:
            user = user.getUser()
    return user
388026
def get(self, sid):
        
        return UserContext(self._version, service_sid=self._solution['service_sid'], sid=sid, )
527560
public void restore(String state) {
        JsonObject json = JsonObject.readFrom(state);
        String accessToken = json.get("accessToken").asString();
        String refreshToken = json.get("refreshToken").asString();
        long lastRefresh = json.get("lastRefresh").asLong();
        long expires = json.get("expires").asLong();
        String userAgent = json.get("userAgent").asString();
        String tokenURL = json.get("tokenURL").asString();
        String baseURL = json.get("baseURL").asString();
        String baseUploadURL = json.get("baseUploadURL").asString();
        boolean autoRefresh = json.get("autoRefresh").asBoolean();
        int maxRequestAttempts = json.get("maxRequestAttempts").asInt();

        this.accessToken = accessToken;
        this.refreshToken = refreshToken;
        this.lastRefresh = lastRefresh;
        this.expires = expires;
        this.userAgent = userAgent;
        this.tokenURL = tokenURL;
        this.baseURL = baseURL;
        this.baseUploadURL = baseUploadURL;
        this.autoRefresh = autoRefresh;
        this.maxRequestAttempts = maxRequestAttempts;
    }
1095601
private UserEntity ensureRolesFetched(final UserEntity user)
	{
		if (user != null)
			user.getRoles().stream().map(r -> r.getId()).collect(Collectors.toList());

		return user;
	}