示例#1
0
 def inaccessible_callback(self, name, **kwargs):
     # redirect to login page if user doesn't have access
     dao.add_activity_log(
         activity="Đăng xuất tự động",
         description="Nhân viên truy cập vào trang không được phân quyền",
         employee_id=current_user.id)
     logout_user()
     return redirect(url_for('login_employee', next=request.url))
示例#2
0
    def check(*args, **kwargs):
        if not current_user.is_authenticated or not current_user.active:
            logout_user()
            return redirect(url_for("login_employee", next=request.url))

        if current_user.employee_role != EmployeeRole.EMPLOYEE or current_user.position_id != 1:
            dao.add_activity_log(
                activity="Đăng xuất tự động",
                description=
                "Nhân viên truy cập vào trang không được phân quyền",
                employee_id=current_user.id)
            logout_user()
            return redirect(url_for("login_employee", next=request.url))

        return f(*args, **kwargs)
示例#3
0
def logout_employee_auto(employee_id):
    if dao.add_activity_log(activity="Đăng xuất tự động",
                            description="Nhân viên không có hoạt động",
                            employee_id=current_user.id):
        logout_user()
        return jsonify({"status": 200})

    return jsonify({"status": 500, "error_message": "Something Wrong!!!"})
示例#4
0
 def index(self):
     dao.add_activity_log(activity="Đăng xuất",
                          description="",
                          employee_id=current_user.id)
     logout_user()
     return redirect("/")