示例#1
0
 def inner(*args, **kwargs):
     if admin.admin_key:
         res = func(*args, **kwargs)
         return res
     else:
         print('用户还没有登录喔!')
         admin.admin_login()
示例#2
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)
示例#3
0
 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()
示例#4
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)
示例#5
0
文件: common.py 项目: szk5043/python
 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)
示例#6
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)
示例#7
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('权限不足')
示例#8
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('当前视图没有权限')
示例#9
0
 def warpper(*args, **kwargs):
     if not db_handler.admint_get():
         admin.admin_login()
     else:
         return func(*args, **kwargs)
示例#10
0
 def wrapper(*args, **kwargs):
     if user_type == 'admin':
         if not admin.admin_info['name']:
             admin.admin_login()
         else:
             func(*args, **kwargs)