Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
    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"]