def admin_auth(f): @wraps(f) def decorated_function(*args, **kwargs): admin = Admin.query.join( Role ).filter( Role.id == Admin.role_id, Admin.id == session["admin_id"] ).first() auths = admin.role.auths auths = list(map(lambda v: int(v), auths.split(","))) auth_list = Auth.query.all() urls = [v.url for v in auth_list for val in auths if val == v.id] rule = request.url_rule if rule not in urls: abort(404) return f(*args, **kwargs) return decorated_function 老师, 这个Admin.query.join(Role)就是把所有的role type全部取出来么? 后面这个filter(Role.id == Admin.role_id,Admin.id == session["admin_id"] ).first()有点乱,不是很懂这个逻辑,能解释下么,谢谢老师