Пример #1
0
        def load_user(id):
            print("loading user")
            if (session.get('user_type')):
                if (session['user_type'] == 'Employee'):
                    emp = Employee.getById(int(id))
                    if isinstance(emp, Employee) == False:
                        return None
                elif (session['user_type'] == 'Admin'):
                    emp = Administrator.getById(int(id))
                    if isinstance(emp, Administrator) == False:
                        return None

                emp.is_authenticated = True
                print(emp)
                return emp
            return None
Пример #2
0
 def getEmployee(self):
     from models.Employee import Employee
     employee = Employee.getById(self.employee_id)
     return employee