新增
This commit is contained in:
@@ -12,7 +12,8 @@ from sqlalchemy import func, select, update
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from auth.account_quota import default_stop_worker, sync_user_account_quota
|
||||
from auth.roles import is_admin
|
||||
from auth.roles import has_global_scope, has_permission, is_admin
|
||||
from auth.permissions import ORDERS_READ, PAYMENTS_MANAGE
|
||||
from auth.system_settings import SystemSettingsData, load_settings
|
||||
from models.models import PaymentOrder, User
|
||||
from . import alipay, wechat
|
||||
@@ -347,7 +348,12 @@ async def list_orders(
|
||||
page_size = max(1, min(100, page_size))
|
||||
|
||||
filters = []
|
||||
if not is_admin(current_user.role):
|
||||
# Global order list for built-in admin, payments.manage, or data.scope_all.
|
||||
if not (
|
||||
is_admin(current_user.role)
|
||||
or has_permission(current_user.role, PAYMENTS_MANAGE)
|
||||
or has_global_scope(current_user.role)
|
||||
):
|
||||
filters.append(PaymentOrder.user_id == current_user.id)
|
||||
if status:
|
||||
filters.append(PaymentOrder.status == status)
|
||||
|
||||
Reference in New Issue
Block a user