make all this have a login page, use ldap, put a logo on, moved some upstream stuff to static/ -- need to do more here to be consistent with bootstrap 5, but for another day

This commit is contained in:
2022-06-19 22:45:54 +10:00
parent 4725f006bc
commit c29f73f8ab
14 changed files with 274 additions and 9 deletions

29
user.py Normal file
View File

@@ -0,0 +1,29 @@
from main import db
from sqlalchemy import Sequence
from flask_login import UserMixin, login_required
from main import db, app, ma
# pylint: disable=no-member
################################################################################
# Class describing Person in the database and DB via sqlalchemy
# id is unique id in DB
# dn is ldap distinguised name
# any entry in this DB is effectively a record you already authed successfully
# so acts as a session marker. If you fail ldap auth, you dont get a row here
################################################################################
class BDBUser(UserMixin,db.Model):
__tablename__ = "bdb_user"
id = db.Column(db.Integer, db.Sequence('bdb_user_id_seq'), primary_key=True)
dn = db.Column(db.String)
def __repr__(self):
str=f"<{self.__class__.__name__}("
for k, v in self.__dict__.items():
str += f"{k}={v!r}, "
str=str.rstrip(", ") + ")>"
return str
def get_id(self):
return self.dn