diff --git a/sql/seed_warehouse_module_permissions.sql b/sql/seed_warehouse_module_permissions.sql index b50ce94..b50bbae 100644 --- a/sql/seed_warehouse_module_permissions.sql +++ b/sql/seed_warehouse_module_permissions.sql @@ -1,5 +1,5 @@ --- 仓储模块 + 店铺授权/订单 RBAC 权限(幂等) --- RBAC 库执行;执行后用户需重新登录或刷新权限缓存 +-- ???? + ????/?? RBAC ?????? +-- RBAC ????????????????????? SET @ADMIN_USER_ID = ( SELECT `Id` FROM `user` @@ -20,11 +20,14 @@ CROSS JOIN ( SELECT 'Warehouse.Sku.Delete' UNION ALL SELECT 'Warehouse.Inventory.Query' UNION ALL SELECT 'Warehouse.Inventory.Relocate' UNION ALL + SELECT 'Warehouse.BinLocation.Query' UNION ALL + SELECT 'Warehouse.BinLocation.Save' UNION ALL SELECT 'Warehouse.Parcel.Query' UNION ALL SELECT 'Warehouse.Parcel.Save' UNION ALL SELECT 'Warehouse.Parcel.Delete' UNION ALL SELECT 'Warehouse.InboundNotice.Query' UNION ALL SELECT 'Warehouse.InboundNotice.Save' UNION ALL + SELECT 'Warehouse.InboundNotice.ConfirmReceive' UNION ALL SELECT 'Warehouse.InboundNotice.Delete' UNION ALL SELECT 'Order.PlatformStore.Query' UNION ALL SELECT 'Order.PlatformStore.Save' UNION ALL diff --git a/src/Oms.Application/Shared/WarehouseCustomerHelper.cs b/src/Oms.Application/Shared/WarehouseCustomerHelper.cs index ae2c8f2..5c67aff 100644 --- a/src/Oms.Application/Shared/WarehouseCustomerHelper.cs +++ b/src/Oms.Application/Shared/WarehouseCustomerHelper.cs @@ -10,16 +10,22 @@ namespace Oms.Application.Shared; public static class WarehouseCustomerHelper { /// - /// 列表/汇总查询用的客户 ID:客户登录强制为自身;管理员未传 customerId 时返回 null(查询全部)。 + /// 列表/汇总查询用的客户 ID:客户登录强制为自身;管理员未传或传入 ≤0 时返回 null(查询全部)。 /// - public static Task ResolveListCustomerIdAsync( + public static async Task ResolveListCustomerIdAsync( ICustomerRepository customerRepository, ICurrentUser currentUser, - int? requestedCustomerId = null) => - OmsSessionHelper.ResolveListCustomerIdAsync(customerRepository, currentUser, requestedCustomerId); + int? requestedCustomerId = null) + { + var normalizedRequest = requestedCustomerId is > 0 ? requestedCustomerId : null; + return await OmsSessionHelper.ResolveListCustomerIdAsync( + customerRepository, + currentUser, + normalizedRequest); + } /// - /// 写入/删除等必须明确客户归属的操作:客户登录强制为自身;管理员须传 customerId。 + /// 写入/删除等必须明确客户归属的操作:客户登录强制为自身;管理员须传有效 customerId(>0)。 /// public static async Task ResolveRequiredCustomerIdAsync( ICustomerRepository customerRepository, @@ -27,7 +33,7 @@ public static class WarehouseCustomerHelper int? requestedCustomerId = null) { var customerId = await ResolveListCustomerIdAsync(customerRepository, currentUser, requestedCustomerId); - if (!customerId.HasValue) + if (!customerId.HasValue || customerId.Value <= 0) { throw new BusinessException("客户ID不能为空"); }