Fetch user for a given provider by id.
420713
def authenticate(self, provider=None, identifier=None):
        ""
        provider_q = Q(provider__name=provider)
        if isinstance(provider, Provider):
            provider_q = Q(provider=provider)
        try:
            access = AccountAccess.objects.filter(
                provider_q, identifier=identifier
            ).select_related('user')[0]
        except IndexError:
            return None
        else:
            return access.user
1365834
def get_user(
        self, identified_with, identifier, req, resp, resource, uri_kwargs
    ):
        """"""
        return self.user
6534
def find_by_id(key: str, user: str=None) -> Optional['ApiKey']:
        
        return ApiKey.from_db(db.get_key(key, user))
705505
def get_user(self, id, **data):
        
        
        return self.get("/users/{0}/".format(id), data=data)
830223
private function getUserById($id)
    {
        $user = $this->userService->findUserById($id);

        if (empty($user)) {
            throw $this->createNotFoundException('user not found');
        }

        return $user;
    }
248288
def fetch(cls, id, service=None, endpoint=None, *args, **kwargs):
        """"""
        if service is None and endpoint is None:
            raise InvalidArguments(service, endpoint)

        if endpoint is None:
            sid = service['id'] if isinstance(service, Entity) else service
            endpoint = 'services/{0}/integrations'.format(sid)

        return getattr(Entity, 'fetch').__func__(cls, id, endpoint=endpoint,
                                                 *args, **kwargs)
436114
def get_provider(self, provider_name='default'):
        """"""
        try:
            if self._providers is None:
                self._providers = self._initialize_providers()
            return self._providers[provider_name]
        except KeyError:
            raise AssertionError(f'No Provider registered with name {provider_name}')
879471
def get(self, user_id):
        """"""
        user = db.User.find_one(User.user_id == user_id)
        roles = db.Role.all()

        if not user:
            return self.make_response('Unable to find the user requested, might have been removed', HTTP.NOT_FOUND)

        return self.make_response({
            'user': user.to_json(),
            'roles': roles
        }, HTTP.OK)
1255027
def updated_by(self):
        
        if self.api and self.updated_by_id:
            return self.api._get_user(self.updated_by_id)
1213180
def fetch(self, customer_id, data={}, **kwargs):
        "
        return super(Customer, self).fetch(customer_id, data, **kwargs)
607510
def user(self, user):
        """"""

        resource = self.RUSER + '/' + user
        params = {}

        result = [page for page in self._fetch(resource, params)]

        return result[0]
1330137
public function getUserByProviderId($provider, $identifier)
    {
        $this->oDb->select('user_id');
        $this->oDb->where('provider', $provider);
        $this->oDb->where('identifier', $identifier);

        $oUser = $this->oDb->get(NAILS_DB_PREFIX . 'user_social')->row();

        if (empty($oUser)) {
            return false;
        }

        return $this->oUserModel->getById($oUser->user_id);
    }
436164
public function prepareUser($id)
    {
        $userClass = config('auth.providers.users.model');

        if (! class_exists($userClass)) {
            throw new Exception("User class {$userClass} not found.");
        }

        if(! $user = $userClass::whereId($id)->first()) {
            throw new Exception("User by ID {$id} not found.");
        }

        return $user;
    }
643245
def client_getter():
    """"""
    def wrapper(f):
        @wraps(f)
        def decorated(*args, **kwargs):
            if 'client_id' not in kwargs:
                abort(500)

            client = Client.query.filter_by(
                client_id=kwargs.pop('client_id'),
                user_id=current_user.get_id(),
            ).first()

            if client is None:
                abort(404)

            return f(client, *args, **kwargs)
        return decorated
    return wrapper
865779
def get(cls, user_id, db_session=None):
        
        db_session = get_db_session(db_session)
        return db_session.query(cls.model).get(user_id)
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
1352901
def by_id(self, id):
        """"""
        path = partial(_path, self.adapter)
        path = path(id)
        return self._get(path)