Example #1
0
class Role(db.Model):
    __tablename__ = 'roles'
    id = db.Column(db.Integer, primary_key=True)
    user_id = db.Column(db.Integer)
    role_name = db.Column(db.String(50))
    role_type = db.Column(db.String(50))
    created_at = db.Column(db.DateTime, default=datetime.utcnow())
    modified_at = db.Column(db.DateTime, default=datetime.utcnow())
Example #2
0
class User(db.Model, UserMixin):
    __tablename__ = 'users'
    id = db.Column(db.Integer, primary_key=True)
    pid = db.Column(db.Integer, unique=True)
    username = db.Column(db.Integer, unique=True)
    firstname = db.Column(db.String(100))
    lastname = db.Column(db.String(100))
    email = db.Column(db.String(200))
    password = db.Column(db.String(255))
    login_method = db.Column(db.String(6), default='LDAP')
    pk1 = db.Column(db.Integer)
    created_at = db.Column(db.DateTime, default=datetime.utcnow())
    modified_at = db.Column(db.DateTime, default=datetime.utcnow())

    def __repr__(self):
        return '<User %r>' % self.username
Example #3
0
class User(ModelBase, UserMixin, db.Model):
    __tablename__ = 'users'
    pid = db.Column(db.Integer, unique=True)
    username = db.Column(db.Integer, unique=True)
    firstname = db.Column(db.String(100))
    lastname = db.Column(db.String(100))
    email = db.Column(db.String(200))
    password = db.Column(db.String(255))
    login_method = db.Column(db.String(6), default='LDAP')
    pk1 = db.Column(db.Integer)

    def verify_password(self, password):
        return True if bcrypt.hashpw(bytes(password, encoding='UTF-8'),
                                     self.password) == self.password else False

    def __repr__(self):
        return '<User %r>' % self.username