def managerHomepage(): pageData = { "Name": Backend.getName(current_user.id), } sections = [] for section in list(Backend.getSections()): if current_user.id in section["Managers"]: sections.append(section) pageData["Sections"] = sections return render_template("managerHomepage.html", pageData=pageData)
def adminHomepage(): pageData = { "Name": Backend.getName(current_user.id), "Items": Backend.getItems(), "Sections": list(Backend.getSections()) } managers = Backend.getManagers() sep = [] for manager in managers: sectNames = "" for sect in manager["Sections"]: sectNames += Backend.getSectName(sect) + ", " manager["SectionNames"] = sectNames[:-2] sep.append(manager) pageData["Managers"] = sep return render_template("adminHomepage.html", pageData=pageData)
def __init__(self, identification): # Gets User from database if type(identification) is str: q = db.db.Logins.find({"userName": identification}) elif type(identification) is int: q = db.db.Logins.find({"ID": identification}) else: raise Exception() # Check if a User was found if q.count() == 0: # was not found self.id = -1 self.password = "" else: # was found q = q.next() self.id = q["ID"] self.password = q["hashedPassword"] self.name = Backend.getName(self.id) self.attempts = q["attempts"]