fix: align phase5 overseas permissions
This commit is contained in:
@@ -8,24 +8,38 @@ CREATE PROCEDURE guard_phase5_delivery_permission_ids()
|
||||
BEGIN
|
||||
IF EXISTS (
|
||||
SELECT 1 FROM iam_permission
|
||||
WHERE (id = 5107016 AND permission_code <> 'platform:overseas-warehouse:dispatch:edit')
|
||||
WHERE (id = 5107064 AND permission_code <> 'platform:overseas-warehouse:dispatch:list')
|
||||
OR (id = 5107016 AND permission_code <> 'platform:overseas-warehouse:dispatch:edit')
|
||||
OR (id = 5107017 AND permission_code <> 'platform:overseas-warehouse:dispatch:cancel')
|
||||
OR (id = 5107018 AND permission_code <> 'platform:overseas-warehouse:dispatch:transfer-delivery')
|
||||
OR (id = 5107090 AND permission_code <> 'platform:overseas-warehouse:outbound:list')
|
||||
OR (id = 5107091 AND permission_code <> 'platform:overseas-warehouse:outbound:create')
|
||||
OR (id = 5107092 AND permission_code <> 'platform:overseas-warehouse:delivery:list')
|
||||
OR (id = 5107093 AND permission_code <> 'platform:overseas-warehouse:outbound:cancel')
|
||||
OR (id = 5107070 AND permission_code <> 'platform:overseas-warehouse:exception-order:list')
|
||||
OR (id = 5107071 AND permission_code <> 'platform:overseas-warehouse:exception-order:create')
|
||||
OR (id = 5107072 AND permission_code <> 'platform:overseas-warehouse:delivery:return')
|
||||
OR (id = 5107080 AND permission_code <> 'platform:overseas-warehouse:customer-visit:list')
|
||||
OR (id = 5107081 AND permission_code <> 'platform:overseas-warehouse:customer-visit:edit')
|
||||
OR (id = 5107082 AND permission_code <> 'platform:overseas-warehouse:delivery:status')
|
||||
OR (id = 5306000 AND permission_code <> 'merchant:warehouse:delivery:list')
|
||||
OR (id = 5306001 AND permission_code <> 'merchant:warehouse:delivery:create')
|
||||
) OR EXISTS (
|
||||
SELECT 1 FROM iam_permission
|
||||
WHERE (permission_code = 'platform:overseas-warehouse:dispatch:edit' AND id <> 5107016)
|
||||
WHERE (permission_code = 'platform:overseas-warehouse:dispatch:list' AND id <> 5107064)
|
||||
OR (permission_code = 'platform:overseas-warehouse:dispatch:edit' AND id <> 5107016)
|
||||
OR (permission_code = 'platform:overseas-warehouse:dispatch:cancel' AND id <> 5107017)
|
||||
OR (permission_code = 'platform:overseas-warehouse:dispatch:transfer-delivery' AND id <> 5107018)
|
||||
OR (permission_code = 'platform:overseas-warehouse:outbound:list' AND id <> 5107090)
|
||||
OR (permission_code = 'platform:overseas-warehouse:outbound:create' AND id <> 5107091)
|
||||
OR (permission_code = 'platform:overseas-warehouse:delivery:list' AND id <> 5107092)
|
||||
OR (permission_code = 'platform:overseas-warehouse:outbound:cancel' AND id <> 5107093)
|
||||
OR (permission_code = 'platform:overseas-warehouse:exception-order:list' AND id <> 5107070)
|
||||
OR (permission_code = 'platform:overseas-warehouse:exception-order:create' AND id <> 5107071)
|
||||
OR (permission_code = 'platform:overseas-warehouse:delivery:return' AND id <> 5107072)
|
||||
OR (permission_code = 'platform:overseas-warehouse:customer-visit:list' AND id <> 5107080)
|
||||
OR (permission_code = 'platform:overseas-warehouse:customer-visit:edit' AND id <> 5107081)
|
||||
OR (permission_code = 'platform:overseas-warehouse:delivery:status' AND id <> 5107082)
|
||||
OR (permission_code = 'merchant:warehouse:delivery:list' AND id <> 5306000)
|
||||
OR (permission_code = 'merchant:warehouse:delivery:create' AND id <> 5306001)
|
||||
) THEN
|
||||
@@ -40,14 +54,21 @@ INSERT INTO iam_permission
|
||||
(id, tenant_id, app_code, permission_type, parent_id, permission_code,
|
||||
permission_name, route_path, http_method, sort_no, status, built_in, deleted)
|
||||
VALUES
|
||||
(5107016,0,'PLATFORM','BUTTON',5107010,'platform:overseas-warehouse:dispatch:edit','编辑海外排车',NULL,'PUT',716,'ACTIVE',1,0),
|
||||
(5107017,0,'PLATFORM','BUTTON',5107010,'platform:overseas-warehouse:dispatch:cancel','取消海外排车',NULL,'POST',717,'ACTIVE',1,0),
|
||||
(5107018,0,'PLATFORM','BUTTON',5107010,'platform:overseas-warehouse:dispatch:transfer-delivery','排车转派送',NULL,'POST',718,'ACTIVE',1,0),
|
||||
(5107064,0,'PLATFORM','MENU',0,'platform:overseas-warehouse:dispatch:list','海外排车单','/overseas-warehouse/dispatches','GET',764,'ACTIVE',1,0),
|
||||
(5107016,0,'PLATFORM','BUTTON',5107064,'platform:overseas-warehouse:dispatch:edit','编辑海外排车',NULL,'PUT',716,'ACTIVE',1,0),
|
||||
(5107017,0,'PLATFORM','BUTTON',5107064,'platform:overseas-warehouse:dispatch:cancel','取消海外排车',NULL,'DELETE',717,'ACTIVE',1,0),
|
||||
(5107018,0,'PLATFORM','BUTTON',5107064,'platform:overseas-warehouse:dispatch:transfer-delivery','排车转派送',NULL,'POST',718,'ACTIVE',1,0),
|
||||
(5107070,0,'PLATFORM','MENU',0,'platform:overseas-warehouse:exception-order:list','海外异常订单','/overseas-warehouse/exception-orders','GET',770,'ACTIVE',1,0),
|
||||
(5107071,0,'PLATFORM','BUTTON',5107070,'platform:overseas-warehouse:exception-order:create','新增海外异常订单',NULL,'POST',771,'ACTIVE',1,0),
|
||||
(5107072,0,'PLATFORM','BUTTON',5107092,'platform:overseas-warehouse:delivery:return','派送单标记退货',NULL,'POST',772,'ACTIVE',1,0),
|
||||
(5107080,0,'PLATFORM','MENU',0,'platform:overseas-warehouse:customer-visit:list','客户回访','/overseas-warehouse/customer-visits','GET',780,'ACTIVE',1,0),
|
||||
(5107081,0,'PLATFORM','BUTTON',5107080,'platform:overseas-warehouse:customer-visit:edit','保存客户回访',NULL,'PUT',781,'ACTIVE',1,0),
|
||||
(5107082,0,'PLATFORM','BUTTON',5107092,'platform:overseas-warehouse:delivery:status','编辑派送单状态',NULL,'PUT',782,'ACTIVE',1,0),
|
||||
(5107090,0,'PLATFORM','MENU',0,'platform:overseas-warehouse:outbound:list','海外出库单','/overseas-warehouse/outbounds','GET',765,'ACTIVE',1,0),
|
||||
(5107091,0,'PLATFORM','BUTTON',5107090,'platform:overseas-warehouse:outbound:create','创建海外出库单',NULL,'POST',766,'ACTIVE',1,0),
|
||||
(5107092,0,'PLATFORM','MENU',0,'platform:overseas-warehouse:delivery:list','海外派送单','/overseas-warehouse/delivery-orders','GET',767,'ACTIVE',1,0),
|
||||
(5107093,0,'PLATFORM','BUTTON',5107090,'platform:overseas-warehouse:outbound:cancel','取消海外出库单',NULL,'POST',768,'ACTIVE',1,0),
|
||||
(5306000,0,'MERCHANT','MENU',0,'merchant:warehouse:delivery:list','海外仓派送单','/overseas-warehouse/delivery-orders','GET',60,'ACTIVE',1,0),
|
||||
(5306000,0,'MERCHANT','MENU',0,'merchant:warehouse:delivery:list','海外仓派送单','/orders/delivery','GET',60,'ACTIVE',1,0),
|
||||
(5306001,0,'MERCHANT','BUTTON',5306000,'merchant:warehouse:delivery:create','创建海外仓派送单',NULL,'POST',10,'ACTIVE',1,0)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
permission_type=VALUES(permission_type), parent_id=VALUES(parent_id),
|
||||
@@ -64,13 +85,20 @@ SELECT 0, role.id, permission.id, CURRENT_TIMESTAMP(3)
|
||||
AND UPPER(role.role_code) IN ('PLATFORM_ADMIN','PLATFORM_CUSTOM_ADMIN')
|
||||
AND role.status='ACTIVE' AND role.deleted=0
|
||||
AND permission.permission_code IN (
|
||||
'platform:overseas-warehouse:dispatch:list',
|
||||
'platform:overseas-warehouse:dispatch:edit',
|
||||
'platform:overseas-warehouse:dispatch:cancel',
|
||||
'platform:overseas-warehouse:dispatch:transfer-delivery',
|
||||
'platform:overseas-warehouse:outbound:list',
|
||||
'platform:overseas-warehouse:outbound:create',
|
||||
'platform:overseas-warehouse:outbound:cancel',
|
||||
'platform:overseas-warehouse:delivery:list')
|
||||
'platform:overseas-warehouse:delivery:list',
|
||||
'platform:overseas-warehouse:exception-order:list',
|
||||
'platform:overseas-warehouse:exception-order:create',
|
||||
'platform:overseas-warehouse:delivery:return',
|
||||
'platform:overseas-warehouse:delivery:status',
|
||||
'platform:overseas-warehouse:customer-visit:list',
|
||||
'platform:overseas-warehouse:customer-visit:edit')
|
||||
AND permission.status='ACTIVE' AND permission.deleted=0;
|
||||
|
||||
-- 仓库后台岗位按最小职责授权;PDA 岗位不得获得后台排车、出库或派送权限。
|
||||
@@ -81,6 +109,7 @@ CREATE TEMPORARY TABLE tmp_phase5_delivery_role_permission (
|
||||
PRIMARY KEY (role_code, permission_code)
|
||||
) ENGINE=MEMORY;
|
||||
INSERT INTO tmp_phase5_delivery_role_permission (role_code, permission_code) VALUES
|
||||
('WAREHOUSE_OPERATOR','platform:overseas-warehouse:dispatch:list'),
|
||||
('WAREHOUSE_OPERATOR','platform:overseas-warehouse:dispatch:edit'),
|
||||
('WAREHOUSE_OPERATOR','platform:overseas-warehouse:dispatch:cancel'),
|
||||
('WAREHOUSE_OPERATOR','platform:overseas-warehouse:dispatch:transfer-delivery'),
|
||||
@@ -88,8 +117,17 @@ INSERT INTO tmp_phase5_delivery_role_permission (role_code, permission_code) VAL
|
||||
('WAREHOUSE_OPERATOR','platform:overseas-warehouse:outbound:create'),
|
||||
('WAREHOUSE_OPERATOR','platform:overseas-warehouse:outbound:cancel'),
|
||||
('WAREHOUSE_OPERATOR','platform:overseas-warehouse:delivery:list'),
|
||||
('WAREHOUSE_OPERATOR','platform:overseas-warehouse:exception-order:list'),
|
||||
('WAREHOUSE_OPERATOR','platform:overseas-warehouse:exception-order:create'),
|
||||
('WAREHOUSE_OPERATOR','platform:overseas-warehouse:delivery:return'),
|
||||
('WAREHOUSE_OPERATOR','platform:overseas-warehouse:delivery:status'),
|
||||
('WAREHOUSE_OPERATOR','platform:overseas-warehouse:customer-visit:list'),
|
||||
('WAREHOUSE_OPERATOR','platform:overseas-warehouse:customer-visit:edit'),
|
||||
('WAREHOUSE_TALLY','platform:overseas-warehouse:dispatch:list'),
|
||||
('WAREHOUSE_TALLY','platform:overseas-warehouse:outbound:list'),
|
||||
('WAREHOUSE_TALLY','platform:overseas-warehouse:delivery:list');
|
||||
('WAREHOUSE_TALLY','platform:overseas-warehouse:delivery:list'),
|
||||
('WAREHOUSE_TALLY','platform:overseas-warehouse:exception-order:list'),
|
||||
('WAREHOUSE_TALLY','platform:overseas-warehouse:customer-visit:list');
|
||||
|
||||
DELETE grant_row FROM iam_role_permission grant_row
|
||||
JOIN iam_role role ON role.id=grant_row.role_id AND role.tenant_id=grant_row.tenant_id
|
||||
@@ -99,13 +137,20 @@ LEFT JOIN tmp_phase5_delivery_role_permission expected
|
||||
WHERE role.tenant_id=0 AND role.app_code='PLATFORM'
|
||||
AND role.role_code IN ('WAREHOUSE_OPERATOR','WAREHOUSE_TALLY','OVERSEAS_WAREHOUSE_PDA_OPERATOR','CN_FIRSTLEG_PDA_OPERATOR')
|
||||
AND permission.permission_code IN (
|
||||
'platform:overseas-warehouse:dispatch:list',
|
||||
'platform:overseas-warehouse:dispatch:edit',
|
||||
'platform:overseas-warehouse:dispatch:cancel',
|
||||
'platform:overseas-warehouse:dispatch:transfer-delivery',
|
||||
'platform:overseas-warehouse:outbound:list',
|
||||
'platform:overseas-warehouse:outbound:create',
|
||||
'platform:overseas-warehouse:outbound:cancel',
|
||||
'platform:overseas-warehouse:delivery:list')
|
||||
'platform:overseas-warehouse:delivery:list',
|
||||
'platform:overseas-warehouse:exception-order:list',
|
||||
'platform:overseas-warehouse:exception-order:create',
|
||||
'platform:overseas-warehouse:delivery:return',
|
||||
'platform:overseas-warehouse:delivery:status',
|
||||
'platform:overseas-warehouse:customer-visit:list',
|
||||
'platform:overseas-warehouse:customer-visit:edit')
|
||||
AND expected.permission_code IS NULL;
|
||||
|
||||
INSERT IGNORE INTO iam_role_permission (tenant_id, role_id, permission_id, created_at)
|
||||
@@ -139,6 +184,7 @@ BEGIN
|
||||
IF (SELECT COUNT(*) FROM iam_permission
|
||||
WHERE tenant_id=0 AND status='ACTIVE' AND deleted=0
|
||||
AND permission_code IN (
|
||||
'platform:overseas-warehouse:dispatch:list',
|
||||
'platform:overseas-warehouse:dispatch:edit',
|
||||
'platform:overseas-warehouse:dispatch:cancel',
|
||||
'platform:overseas-warehouse:dispatch:transfer-delivery',
|
||||
@@ -146,8 +192,14 @@ BEGIN
|
||||
'platform:overseas-warehouse:outbound:create',
|
||||
'platform:overseas-warehouse:outbound:cancel',
|
||||
'platform:overseas-warehouse:delivery:list',
|
||||
'platform:overseas-warehouse:exception-order:list',
|
||||
'platform:overseas-warehouse:exception-order:create',
|
||||
'platform:overseas-warehouse:delivery:return',
|
||||
'platform:overseas-warehouse:delivery:status',
|
||||
'platform:overseas-warehouse:customer-visit:list',
|
||||
'platform:overseas-warehouse:customer-visit:edit',
|
||||
'merchant:warehouse:delivery:list',
|
||||
'merchant:warehouse:delivery:create')) <> 9 THEN
|
||||
'merchant:warehouse:delivery:create')) <> 16 THEN
|
||||
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT='五期海外派送权限初始化失败:权限目录不完整';
|
||||
END IF;
|
||||
IF (SELECT COUNT(*) FROM iam_role_permission grant_row
|
||||
@@ -155,21 +207,49 @@ BEGIN
|
||||
JOIN iam_permission permission ON permission.id=grant_row.permission_id
|
||||
WHERE role.role_code='PLATFORM_ADMIN'
|
||||
AND permission.permission_code IN (
|
||||
'platform:overseas-warehouse:dispatch:list',
|
||||
'platform:overseas-warehouse:dispatch:edit',
|
||||
'platform:overseas-warehouse:dispatch:cancel',
|
||||
'platform:overseas-warehouse:dispatch:transfer-delivery',
|
||||
'platform:overseas-warehouse:outbound:list',
|
||||
'platform:overseas-warehouse:outbound:create',
|
||||
'platform:overseas-warehouse:outbound:cancel',
|
||||
'platform:overseas-warehouse:delivery:list')) <> 7 THEN
|
||||
'platform:overseas-warehouse:delivery:list',
|
||||
'platform:overseas-warehouse:exception-order:list',
|
||||
'platform:overseas-warehouse:exception-order:create',
|
||||
'platform:overseas-warehouse:delivery:return',
|
||||
'platform:overseas-warehouse:delivery:status',
|
||||
'platform:overseas-warehouse:customer-visit:list',
|
||||
'platform:overseas-warehouse:customer-visit:edit')) <> 14 THEN
|
||||
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT='五期海外派送权限初始化失败:平台管理员授权不完整';
|
||||
END IF;
|
||||
IF (SELECT COUNT(*) FROM iam_role_permission grant_row
|
||||
JOIN iam_role role ON role.id=grant_row.role_id AND role.tenant_id=grant_row.tenant_id
|
||||
JOIN iam_permission permission ON permission.id=grant_row.permission_id
|
||||
WHERE role.role_code='PLATFORM_CUSTOM_ADMIN'
|
||||
AND permission.permission_code IN (
|
||||
'platform:overseas-warehouse:dispatch:list',
|
||||
'platform:overseas-warehouse:dispatch:edit',
|
||||
'platform:overseas-warehouse:dispatch:cancel',
|
||||
'platform:overseas-warehouse:dispatch:transfer-delivery',
|
||||
'platform:overseas-warehouse:outbound:list',
|
||||
'platform:overseas-warehouse:outbound:create',
|
||||
'platform:overseas-warehouse:outbound:cancel',
|
||||
'platform:overseas-warehouse:delivery:list',
|
||||
'platform:overseas-warehouse:exception-order:list',
|
||||
'platform:overseas-warehouse:exception-order:create',
|
||||
'platform:overseas-warehouse:delivery:return',
|
||||
'platform:overseas-warehouse:delivery:status',
|
||||
'platform:overseas-warehouse:customer-visit:list',
|
||||
'platform:overseas-warehouse:customer-visit:edit')) <> 14 THEN
|
||||
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT='五期海外派送权限初始化失败:平台自定义管理员授权不完整';
|
||||
END IF;
|
||||
SELECT COALESCE(SUM(role_code='WAREHOUSE_OPERATOR'),0),
|
||||
COALESCE(SUM(role_code='WAREHOUSE_TALLY'),0)
|
||||
INTO v_warehouse_operator_permission_count, v_warehouse_tally_permission_count
|
||||
FROM tmp_phase5_delivery_role_permission;
|
||||
IF v_warehouse_operator_permission_count <> 7
|
||||
OR v_warehouse_tally_permission_count <> 2 THEN
|
||||
IF v_warehouse_operator_permission_count <> 14
|
||||
OR v_warehouse_tally_permission_count <> 5 THEN
|
||||
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT='五期海外派送权限初始化失败:仓库岗位最小权限矩阵异常';
|
||||
END IF;
|
||||
IF EXISTS (SELECT 1 FROM iam_role_permission grant_row
|
||||
@@ -177,13 +257,20 @@ BEGIN
|
||||
JOIN iam_permission permission ON permission.id=grant_row.permission_id
|
||||
WHERE role.role_code IN ('OVERSEAS_WAREHOUSE_PDA_OPERATOR','CN_FIRSTLEG_PDA_OPERATOR')
|
||||
AND permission.permission_code IN (
|
||||
'platform:overseas-warehouse:dispatch:list',
|
||||
'platform:overseas-warehouse:dispatch:edit',
|
||||
'platform:overseas-warehouse:dispatch:cancel',
|
||||
'platform:overseas-warehouse:dispatch:transfer-delivery',
|
||||
'platform:overseas-warehouse:outbound:list',
|
||||
'platform:overseas-warehouse:outbound:create',
|
||||
'platform:overseas-warehouse:outbound:cancel',
|
||||
'platform:overseas-warehouse:delivery:list')) THEN
|
||||
'platform:overseas-warehouse:delivery:list',
|
||||
'platform:overseas-warehouse:exception-order:list',
|
||||
'platform:overseas-warehouse:exception-order:create',
|
||||
'platform:overseas-warehouse:delivery:return',
|
||||
'platform:overseas-warehouse:delivery:status',
|
||||
'platform:overseas-warehouse:customer-visit:list',
|
||||
'platform:overseas-warehouse:customer-visit:edit')) THEN
|
||||
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT='五期海外派送权限初始化失败:PDA岗位错误获得后台权限';
|
||||
END IF;
|
||||
IF (SELECT COUNT(*) FROM iam_role_permission grant_row
|
||||
|
||||
@@ -124,7 +124,7 @@ paths:
|
||||
get:
|
||||
tags: [IAM Resources / IAM 资源]
|
||||
summary: 查询当前用户有效权限
|
||||
description: 返回当前有效平台成员权限编码;只要求有效 PLATFORM JWT,不依赖 `platform:role:list`。五期海外排车、出库与派送分别返回 `platform:overseas-warehouse:dispatch:edit`、`platform:overseas-warehouse:dispatch:cancel`、`platform:overseas-warehouse:dispatch:transfer-delivery`、`platform:overseas-warehouse:outbound:list`、`platform:overseas-warehouse:outbound:create`、`platform:overseas-warehouse:outbound:cancel`、`platform:overseas-warehouse:delivery:list`;列表权限包含详情只读,写操作独立授权。
|
||||
description: 返回当前有效平台成员权限编码;只要求有效 PLATFORM JWT,不依赖 `platform:role:list`。五期海外仓返回 `platform:overseas-warehouse:dispatch:list`、`platform:overseas-warehouse:dispatch:edit`、`platform:overseas-warehouse:dispatch:cancel`、`platform:overseas-warehouse:dispatch:transfer-delivery`、`platform:overseas-warehouse:outbound:list`、`platform:overseas-warehouse:outbound:create`、`platform:overseas-warehouse:outbound:cancel`、`platform:overseas-warehouse:delivery:list`、`platform:overseas-warehouse:delivery:return`、`platform:overseas-warehouse:delivery:status`、`platform:overseas-warehouse:exception-order:list`、`platform:overseas-warehouse:exception-order:create`、`platform:overseas-warehouse:customer-visit:list`、`platform:overseas-warehouse:customer-visit:edit`;列表权限包含详情和只读辅助接口,写操作独立授权。
|
||||
responses:
|
||||
'200':
|
||||
description: 当前平台成员权限查询成功
|
||||
|
||||
@@ -20,7 +20,19 @@ class IamOpenApiContractTest {
|
||||
|
||||
assertThat(document).contains("/api/platform/v1/iam/authorization/permissions:")
|
||||
.contains("/api/merchant/v1/iam/authorization/permissions:")
|
||||
.contains("platform:overseas-warehouse:dispatch:list")
|
||||
.contains("platform:overseas-warehouse:dispatch:edit")
|
||||
.contains("platform:overseas-warehouse:dispatch:cancel")
|
||||
.contains("platform:overseas-warehouse:dispatch:transfer-delivery")
|
||||
.contains("platform:overseas-warehouse:outbound:list")
|
||||
.contains("platform:overseas-warehouse:outbound:create")
|
||||
.contains("platform:overseas-warehouse:delivery:list")
|
||||
.contains("platform:overseas-warehouse:delivery:return")
|
||||
.contains("platform:overseas-warehouse:delivery:status")
|
||||
.contains("platform:overseas-warehouse:exception-order:list")
|
||||
.contains("platform:overseas-warehouse:exception-order:create")
|
||||
.contains("platform:overseas-warehouse:customer-visit:list")
|
||||
.contains("platform:overseas-warehouse:customer-visit:edit")
|
||||
.contains("platform:overseas-warehouse:outbound:cancel")
|
||||
.contains("merchant:warehouse:delivery:list")
|
||||
.contains("merchant:warehouse:delivery:create")
|
||||
|
||||
+43
-2
@@ -15,6 +15,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
class Phase5DeliveryPermissionSqlContractTest {
|
||||
private static final Pattern CODE = Pattern.compile("(?:platform:overseas-warehouse|merchant:warehouse):[a-z0-9:-]+");
|
||||
private static final Set<String> REQUIRED = Set.of(
|
||||
"platform:overseas-warehouse:dispatch:list",
|
||||
"platform:overseas-warehouse:dispatch:edit",
|
||||
"platform:overseas-warehouse:dispatch:cancel",
|
||||
"platform:overseas-warehouse:dispatch:transfer-delivery",
|
||||
@@ -22,6 +23,12 @@ class Phase5DeliveryPermissionSqlContractTest {
|
||||
"platform:overseas-warehouse:outbound:create",
|
||||
"platform:overseas-warehouse:outbound:cancel",
|
||||
"platform:overseas-warehouse:delivery:list",
|
||||
"platform:overseas-warehouse:exception-order:list",
|
||||
"platform:overseas-warehouse:exception-order:create",
|
||||
"platform:overseas-warehouse:delivery:return",
|
||||
"platform:overseas-warehouse:delivery:status",
|
||||
"platform:overseas-warehouse:customer-visit:list",
|
||||
"platform:overseas-warehouse:customer-visit:edit",
|
||||
"merchant:warehouse:delivery:list",
|
||||
"merchant:warehouse:delivery:create");
|
||||
|
||||
@@ -38,6 +45,25 @@ class Phase5DeliveryPermissionSqlContractTest {
|
||||
"列表权限同时覆盖列表和详情只读");
|
||||
}
|
||||
|
||||
@Test
|
||||
void keepsMenuRoutesAndHttpMethodsAlignedWithTheFrozenAdminAndClientContracts() throws Exception {
|
||||
String sql = sql();
|
||||
|
||||
assertThat(sql).contains(
|
||||
"'platform:overseas-warehouse:dispatch:list','海外排车单','/overseas-warehouse/dispatches','GET'",
|
||||
"'platform:overseas-warehouse:dispatch:cancel','取消海外排车',NULL,'DELETE'",
|
||||
"'platform:overseas-warehouse:exception-order:list','海外异常订单','/overseas-warehouse/exception-orders','GET'",
|
||||
"'platform:overseas-warehouse:exception-order:create','新增海外异常订单',NULL,'POST'",
|
||||
"'platform:overseas-warehouse:delivery:return','派送单标记退货',NULL,'POST'",
|
||||
"'platform:overseas-warehouse:delivery:status','编辑派送单状态',NULL,'PUT'",
|
||||
"'platform:overseas-warehouse:customer-visit:list','客户回访','/overseas-warehouse/customer-visits','GET'",
|
||||
"'platform:overseas-warehouse:customer-visit:edit','保存客户回访',NULL,'PUT'",
|
||||
"'merchant:warehouse:delivery:list','海外仓派送单','/orders/delivery','GET'");
|
||||
assertThat(sql).doesNotContain(
|
||||
"'platform:overseas-warehouse:dispatch:cancel','取消海外排车',NULL,'POST'",
|
||||
"'merchant:warehouse:delivery:list','海外仓派送单','/overseas-warehouse/delivery-orders'");
|
||||
}
|
||||
|
||||
@Test
|
||||
void grantsAdministratorsAndWarehouseRolesByTheFrozenMinimumMatrix() throws Exception {
|
||||
String sql = sql();
|
||||
@@ -45,15 +71,27 @@ class Phase5DeliveryPermissionSqlContractTest {
|
||||
assertThat(sql).contains(
|
||||
"UPPER(role.role_code) IN ('PLATFORM_ADMIN','PLATFORM_CUSTOM_ADMIN')",
|
||||
"tmp_phase5_delivery_role_permission",
|
||||
"('WAREHOUSE_OPERATOR','platform:overseas-warehouse:dispatch:list')",
|
||||
"('WAREHOUSE_OPERATOR','platform:overseas-warehouse:dispatch:edit')",
|
||||
"('WAREHOUSE_OPERATOR','platform:overseas-warehouse:outbound:create')",
|
||||
"('WAREHOUSE_OPERATOR','platform:overseas-warehouse:exception-order:create')",
|
||||
"('WAREHOUSE_OPERATOR','platform:overseas-warehouse:delivery:return')",
|
||||
"('WAREHOUSE_OPERATOR','platform:overseas-warehouse:delivery:status')",
|
||||
"('WAREHOUSE_OPERATOR','platform:overseas-warehouse:customer-visit:edit')",
|
||||
"('WAREHOUSE_TALLY','platform:overseas-warehouse:dispatch:list')",
|
||||
"('WAREHOUSE_TALLY','platform:overseas-warehouse:outbound:list')",
|
||||
"('WAREHOUSE_TALLY','platform:overseas-warehouse:delivery:list')",
|
||||
"('WAREHOUSE_TALLY','platform:overseas-warehouse:exception-order:list')",
|
||||
"('WAREHOUSE_TALLY','platform:overseas-warehouse:customer-visit:list')",
|
||||
"role.role_code IN ('OVERSEAS_WAREHOUSE_PDA_OPERATOR','CN_FIRSTLEG_PDA_OPERATOR')",
|
||||
"PDA岗位错误获得后台权限");
|
||||
assertThat(sql).doesNotContain(
|
||||
"('WAREHOUSE_TALLY','platform:overseas-warehouse:dispatch:edit')",
|
||||
"('WAREHOUSE_TALLY','platform:overseas-warehouse:outbound:create')",
|
||||
"('WAREHOUSE_TALLY','platform:overseas-warehouse:exception-order:create')",
|
||||
"('WAREHOUSE_TALLY','platform:overseas-warehouse:delivery:return')",
|
||||
"('WAREHOUSE_TALLY','platform:overseas-warehouse:delivery:status')",
|
||||
"('WAREHOUSE_TALLY','platform:overseas-warehouse:customer-visit:edit')",
|
||||
"('OVERSEAS_WAREHOUSE_PDA_OPERATOR','platform:overseas-warehouse:",
|
||||
"('CN_FIRSTLEG_PDA_OPERATOR','platform:overseas-warehouse:");
|
||||
}
|
||||
@@ -68,8 +106,9 @@ class Phase5DeliveryPermissionSqlContractTest {
|
||||
"SELECT COALESCE(SUM(role_code='WAREHOUSE_OPERATOR'),0)",
|
||||
"COALESCE(SUM(role_code='WAREHOUSE_TALLY'),0)",
|
||||
"INTO v_warehouse_operator_permission_count, v_warehouse_tally_permission_count",
|
||||
"IF v_warehouse_operator_permission_count <> 7",
|
||||
"OR v_warehouse_tally_permission_count <> 2 THEN");
|
||||
"IF v_warehouse_operator_permission_count <> 14",
|
||||
"OR v_warehouse_tally_permission_count <> 5 THEN",
|
||||
"平台自定义管理员授权不完整");
|
||||
assertThat(sql).doesNotContain(
|
||||
"IF (SELECT COUNT(*) FROM tmp_phase5_delivery_role_permission",
|
||||
"OR (SELECT COUNT(*) FROM tmp_phase5_delivery_role_permission");
|
||||
@@ -116,6 +155,8 @@ class Phase5DeliveryPermissionSqlContractTest {
|
||||
assertThat(readme).contains(
|
||||
"五期海外排车、出库与派送权限",
|
||||
"测试和部署只执行固定入口,不再单独执行模块脚本",
|
||||
"排车列表/编辑/取消/转派送",
|
||||
"异常订单列表/创建和客户回访列表/编辑十四项权限",
|
||||
"merchant:warehouse:delivery:list",
|
||||
"merchant:warehouse:delivery:create",
|
||||
"PDA 岗位不得获得上述后台权限");
|
||||
|
||||
Reference in New Issue
Block a user