Exemple #1
0
 def wrapper(*args, **kwargs):
     if user_type == "admin":
         if not admin.admin_info["name"]:
             admin.admin_login()
         return func(*args, **kwargs)
     elif user_type == "student":
         if not student.student_info["name"]:
             student.student_login()
         return func(*args, **kwargs)
     elif user_type == "teacher":
         if not teacher.teacher_info["name"]:
             teacher.teacher_login()
         return func(*args, **kwargs)
 def inner(*args, **kwargs):
     if type == 'admin':
         if admin.admin_info['user']:
             res = func(*args, **kwargs)
             return res
         else:
             admin.admin_login()
     if type == 'student':
         if student.student_info['user']:
             res = func(*args, **kwargs)
             return res
         else:
             student.student_login()
     if type == 'teacher':
         if teacher.teacher_info['user']:
             res = func(*args, **kwargs)
             return res
         else:
             teacher.teacher_login()
Exemple #3
0
 def wrapper(*args, **kwargs):
     if auth_type == 'admin':
         if not admin.admin_info['name']:
             print('请先登录')
             admin.admin_login()
         else:
             return func(*args, **kwargs)
     elif auth_type == 'teacher':
         if not teacher.teacher_info['name']:
             print('请先登录')
             teacher.teacher_login()
         else:
             return func(*args, **kwargs)
     elif auth_type == 'student':
         if not student.student_info['name']:
             print('请先登录')
             student.student_login()
         else:
             return func(*args, **kwargs)
Exemple #4
0
 def inner(*args, **kwargs):
     if auth_type == 'student':
         if student.student_status['user'] is None:
             print('请先登录!')
             student.student_login()
         else:
             return func(*args, **kwargs)
     elif auth_type == 'teacher':
         if teacher.teacher_status['user'] is None:
             print('请先登录!')
             teacher.teacher_login()
         else:
             return func(*args, **kwargs)
     elif auth_type == 'admin':
         if admin.admin_status['user'] is None:
             print('请先登录!')
             admin.admin_login()
         else:
             return func(*args, **kwargs)
Exemple #5
0
        def wrapper(*args, **kwargs):

            if user_type == 'admin':
                if not admin.admin_info["name"]:
                    admin.admin_login()
                else:
                    return func(*args, **kwargs)

            if user_type == 'teacher':
                if not teacher.teacher_info["name"]:
                    teacher.teacher_login()
                else:
                    return func(*args, **kwargs)

            if user_type == 'student':
                if not student.student_info["name"]:
                    student.student_login()
                else:
                    return func(*args, **kwargs)
Exemple #6
0
        def inner(*args, **kwargs):
            if role == 'admin':
                if admin.admin_info.get('user'):
                    res = func(*args, **kwargs)
                    return res
                else:
                    admin.admin_login()

            elif role == 'student':
                if student.student_info.get('user'):
                    res = func(*args, **kwargs)
                    return res
                else:
                    student.student_login()

            elif role == 'teacher':
                if teacher.teacher_info.get('user'):
                    res = func(*args, **kwargs)
                    return res
                else:
                    teacher.teacher_login()

            else:
                print('权限不足')
Exemple #7
0
 def inner(*args, **kwargs):
     if role == 'admin':
         if admin.admin_info.get('user'):
             res = func(*args, **kwargs)
             return res
         else:
             print('请先登录!')
             admin.admin_login()
     elif role == 'student':
         if student.student_info.get('user'):
             res = func(*args, **kwargs)
             return res
         else:
             print('请先登录!')
             student.student_login()
     elif role == 'teacher':
         if teacher.teacher_info.get('user'):
             res = func(*args, **kwargs)
             return res
         else:
             print('请先登录!')
             teacher.teacher_login()
     else:
         print('当前视图没有权限')