Returns the :class:`~plexapi.myplex.MyPlexUser` that matches the email or username specified.

            Parameters:
                username (str): Username, email or id of the user to return.
508329
def user(self, username):
        
        for user in self.users():
            # Home users don't have email, username etc.
            if username.lower() == user.title.lower():
                return user

            elif (user.username and user.email and user.id and username.lower() in
                 (user.username.lower(), user.email.lower(), str(user.id))):
                return user

        raise NotFound('Unable to find user %s' % username)
1149976
def GetUsername(self, event, default_username='-'):
    
    username = getattr(event, 'username', None)
    if username and username != '-':
      return username

    session_identifier = event.GetSessionIdentifier()
    if session_identifier is None:
      return default_username

    user_sid = getattr(event, 'user_sid', None)
    username = self._knowledge_base.GetUsernameByIdentifier(
        user_sid, session_identifier=session_identifier)
    return username or default_username
152949
def get_by_username(cls, username):
        
        return cls.query.filter(
            UserProfile._username == username.lower()
        ).one()
1287729
def get_user_id(remote, email):
    
    try:
        url = '{}?usernames={}'.format(GLOBUS_USER_ID_URL, email)
        user_id = get_dict_from_response(remote.get(url))
        return user_id['identities'][0]['id']
    except KeyError:
        # If we got here the response was successful but the data was invalid.
        # It's likely the URL is wrong but possible the API has changed.
        raise OAuthResponseError('Failed to fetch user id, likely server '
                                 'mis-configuration', None, remote)
553802
def user_query(username, email):
    
    query = db.query(User)
    if username:
        query = query.filter_by(username=username)

    if email:
        query = query.filter_by(username=username)

    return query
465193
def get_user(self, id=None, name=None, email=None):
        
        log.info("Picking user: %s (%s) (%s)" % (name, email, id))
        from qubell.api.private.user import User
        if email:
            user = User.get(self._router, organization=self, email=email)
        else:
            user = self.users[id or name]
        return user
940338
def hasUser(self):
        
        username = self.getUsername()
        if not username:
            return False
        user = api.get_user(username)
        return user is not None
244018
def User(self, Username=''):
        
        if not Username:
            Username = self.CurrentUserHandle
        o = User(self, Username)
        o.OnlineStatus # Test if such a user exists.
        return o
139404
def get_user(id=None, username=None, email=None, federated_id=None, provider=None, jwt=None):
    
    if id:
        return _user(models.AuthUser.get(id))
    elif username:
        return _user(models.AuthUser.get_by_username(username))
    elif email:
        return _user(models.AuthUser.get_by_email(email))
    elif federated_id and provider:
        user = models.AuthUserFederation.get_user(provider, federated_id)
        return _user(user) if user else None
    elif jwt:
        pass
693866
def get_member_details(self, username):
        
        members = self.get_members()
        for member in members:
            if member.username == username:
                return member
762500
def username(self, value=None):
        
        if value is not None:
            return URL._mutate(self, username=value)
        return unicode_unquote(self._tuple.username)
801257
def user(self, username=None):
        """"""
        if username is None:
            username = self.__getUsername()
        parsedUsername = urlparse.quote(username)
        url = self.root + "/%s" % parsedUsername
        return User(url=url,
                    securityHandler=self._securityHandler,
                    proxy_url=self._proxy_url,
                    proxy_port=self._proxy_port,
                    initialize=False)
1070470
def get_user(self, username):
        """"""
        ret = {}
        tmp = self._get_user(self._byte_p2(username), ALL_ATTRS)
        if tmp is None:
            raise UserDoesntExist(username, self.backend_name)
        attrs_tmp = tmp[1]
        for attr in attrs_tmp:
            value_tmp = attrs_tmp[attr]
            if len(value_tmp) == 1:
                ret[attr] = value_tmp[0]
            else:
                ret[attr] = value_tmp
        return ret
365534
def get_user_name(self, uid, return_none_on_error=True):
        
        response = self.raw_command(netfn=0x06, command=0x46, data=(uid,))
        if 'error' in response:
            if return_none_on_error:
                return None
            raise Exception(response['error'])
        name = None
        if 'data' in response:
            data = response['data']
            if len(data) == 16:
                # convert int array to string
                n = ''.join(chr(data[i]) for i in range(0, len(data)))
                # remove padded \x00 chars
                n = n.rstrip("\x00")
                if len(n) > 0:
                    name = n
        return name
590761
def user_exists(self, username):
        

        response = self._get(self.rest_url + "/user",
                             params={"username": username})

        if not response.ok:
            return None

        return True
1115577
def with_username(username, password):
    
    user = models.AuthUser.get_by_username(username)
    return _user(user) if user and user.password_matched(password) else None
625248
def get_member(self, username, api=None):
        
        api = api if api else self._API

        response = api.get(
            url=self._URL['member'].format(id=self.id, username=username),
        )
        data = response.json()
        return Member(api=api, **data)