Пример #1
0
 def get_user(self, identifier):
     if self._is_numeric(identifier):
         return (self.db_session.query(self.user_model).get(identifier))
     for attr in get_identity_attributes():
         query = getattr(self.user_model, attr).ilike(identifier)
         rv = (self.db_session.query(self.user_model).filter(query).first())
         if rv is not None:
             return rv
Пример #2
0
    def get_user(self, identifier):
        if self._is_numeric(identifier):
            return self.db.query(self.user_model).query.get(identifier)

        for attr in get_identity_attributes():
            query = getattr(self.user_model, attr).ilike(identifier)
            rv = self.db.query(self.user_model).filter(query).first()
            if rv is not None:
                return rv
Пример #3
0
 def get_user(self, identifier):
     if self._is_numeric(identifier):
         return self.db.session.query(User).get(identifier)
     for attr in get_identity_attributes():
         query = func.lower(getattr(User, attr)) \
                 == func.lower(identifier)
         rv = self.db.session.query(User).filter(query).first()
         if rv is not None:
             return rv
Пример #4
0
 def get_user(self, identifier):
     '''
     Get user by email or id, for this deployment.
     '''
     if self._is_numeric(identifier):
         return self.user_model.query.get(identifier)
     for attr in get_identity_attributes():
         query = getattr(self.user_model, attr).ilike(identifier)
         rv = self.user_model.query.filter_by(
             deployment=current_app.config['NOI_DEPLOY']).filter(query).first()
         if rv is not None:
             return rv
Пример #5
0
    def get_user(self, identifier):
        # Note: identifier here is probably an email address
        user = self.user_model.query.get(identifier)
        if user is not None:
            return user

        for attr in get_identity_attributes():
            column = getattr(self.user_model, attr)
            user = self.user_model.query.get_by(column=column.name, value=identifier)
            if user is not None:
                return user
            else:
                return None
Пример #6
0
 def get_user(self, identifier):
     '''
     Get user by email or id, for this deployment.
     '''
     if self._is_numeric(identifier):
         return self.user_model.query.get(identifier)
     for attr in get_identity_attributes():
         query = getattr(self.user_model, attr).ilike(identifier)
         rv = self.user_model.query.filter_by(
             deployment=current_app.config['NOI_DEPLOY']).filter(
                 query).first()
         if rv is not None:
             return rv
Пример #7
0
    def get_user(self, identifier):
        # Note: identifier here is probably an email address
        user = self.user_model.query.get(identifier)
        if user is not None:
            return user

        for attr in get_identity_attributes():
            column = getattr(self.user_model, attr)
            user = self.user_model.query.get_by(column=column.name,
                                                value=identifier)
            if user is not None:
                return user
            else:
                return None
Пример #8
0
 def get_user(self, identifier):
     if isinstance(identifier, int):
         try:
             return self.user_model.get(
                 self.user_model.id == identifier)
         except self.user_model.DoesNotExist:
             pass
     for attr in get_identity_attributes():
         column = getattr(self.user_model, attr)
         try:
             return self.user_model.get(
                 fn.Lower(column) == fn.Lower(identifier))
         except self.user_model.DoesNotExist:
             pass