Load a user's info from the user_id

We make sure that the user is a member of the current
context so as not to slide across silos.
776976
public static function loadUserInfoBypass($user_id)
    {
        global $CFG, $PDOX, $CONTEXT;
        $cacheloc = 'lti_user';
        $row = Cache::check($cacheloc, $user_id);
        if ( $row != false ) return $row;
        $stmt = $PDOX->queryDie(
            "SELECT displayname, email, user_key FROM {$CFG->dbprefix}lti_user AS U
            JOIN {$CFG->dbprefix}lti_membership AS M
            ON U.user_id = M.user_id AND M.context_id = :CID
            WHERE U.user_id = :UID",
            array(":UID" => $user_id, ":CID" => $CONTEXT->id)
        );
        $row = $stmt->fetch(\PDO::FETCH_ASSOC);
        if ( strlen($row['displayname']) < 1 && strlen($row['user_key']) > 0 ) {
            $row['displayname'] = 'user_key:'.substr($row['user_key'],0,25);
        }
        Cache::set($cacheloc, $user_id, $row);
        return $row;
    }
713494
def _load(self):
        
        while True:
            tarinfo = self.next()
            if tarinfo is None:
                break
        self._loaded = True
164862
def ensure_user(data)
      if @users.include?(data['id'].to_i)
        @users[data['id'].to_i]
      else
        @users[data['id'].to_i] = User.new(data, self)
      end
    end
16633
def user(id, &callback)
      http(:get, "/users/#{id}.json") do |data, http|
        Firering::User.instantiate(self, data, :user, &callback)
      end
    end
1106697
def user_context(self, worker_ctx, exc_info):
        
        user = {}
        for key in worker_ctx.context_data:
            for matcher in self.user_type_context_keys:
                if re.search(matcher, key):
                    user[key] = worker_ctx.context_data[key]
                    break

        self.client.user_context(user)
61586
def _identity_loader(self) -> Union[Identity, None]:
        
        if not isinstance(current_user._get_current_object(), AnonymousUser):
            return Identity(current_user.id)
421385
def _get_context_and_user_ids(self, context_name, user_name):
        """"""
        if context_name is None:
            return None, None

        context_id = self.get_context_info(context_name)['id']
        user_id = None
        if user_name:
            user_id = self._get_user_id_from_name(context_id, user_name)

        return context_id, user_id
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
187570
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
        return getSecurityComponents().userDetails.loadUserByUsername(username);
    }
381210
public void reloadUsers(int contextId) {
		List<User> users = new ArrayList<User>(usersExtension.getContextUserAuthManager(contextId).getUsers());
		tableModel = new UsersSelectTableModel(users);
		this.setModel(tableModel);
	}
915691
async def user_info(self, loop=None, **kwargs):
        """"""
        if not self.user_info_url:
            raise NotImplementedError(
                'The provider doesnt support user_info method.')

        data = await self.request('GET', self.user_info_url, loop=loop, **kwargs)
        user = User(**dict(self.user_parse(data)))
        return user, data
531029
def user(id)
      if id
        cached_user = users.detect {|u| u[:id] == id }
        user = cached_user || fetch_user(id)
        self.users << user
        user
      end
    end
310164
def _load_info(self):
        
        myself = self.get_me()
        if self.return_python_objects:
            self._id = myself.id
            self._username = myself.username
        else:
            self._id = myself["result"]["id"]
            self._username = myself["result"]["username"]
958275
def require_user(wa, email):
    """"""
    cache_key = 'user-list'
    try:
        # Get the cached value
        data = userCache[cache_key]
    except KeyError:
        # If we hit a key error above, indicating that
        # we couldn't find the key, we'll simply re-request
        # the data
        data = wa.users.loadUsers()
        userCache[cache_key] = data

    return AssertUser([x for x in data if x.username == email])
1273047
def load_permissions_on_identity_loaded(sender, identity):
    
    identity.provides.add(
        any_user
    )
    # if the user is not anonymous
    if current_user.is_authenticated:
        # Add the need provided to authenticated users
        identity.provides.add(
            authenticated_user
        )
119217
def load(*args)
      super(*args)
      self.id = self.uri.split('/').last if self.id.nil? and defined? self.uri
    end
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