UserCheck.py 477 Bytes
# coding=utf-8
#author:        4N
#createtime:    2022/1/14
#email:         nheweijun@sina.com
from authlib.integrations.flask_oauth2 import current_token
import configure
class UserCheck:

    @classmethod
    def verify(cls,owner):
        if configure.PermissionActive:
            operator = current_token.user.username
            if configure.PermissionActive and operator != "admin" and owner !=operator:
                raise Exception("缺乏权限!")