暂存提交
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
-- Any returned row represents a failed phase-one seed assertion.
|
||||
SELECT 'missing_auth_accounts' AS failure
|
||||
WHERE (SELECT COUNT(*) FROM baiyue_auth.auth_account
|
||||
WHERE username IN ('platform_admin', 'merchant_admin') AND account_status = 'ACTIVE') <> 2
|
||||
UNION ALL
|
||||
SELECT 'missing_active_identities'
|
||||
WHERE (SELECT COUNT(*) FROM baiyue_iam.iam_user u
|
||||
JOIN baiyue_iam.iam_membership m ON m.user_id = u.id
|
||||
WHERE u.auth_user_id IN (1000001, 1000002)
|
||||
AND u.status = 'ACTIVE' AND m.status = 'ACTIVE') <> 2
|
||||
UNION ALL
|
||||
SELECT 'unexpected_permission_type'
|
||||
WHERE EXISTS (SELECT 1 FROM baiyue_iam.iam_permission
|
||||
WHERE id BETWEEN 5100000 AND 5299999 AND permission_type NOT IN ('MENU', 'BUTTON'))
|
||||
UNION ALL
|
||||
SELECT 'invalid_menu_depth'
|
||||
WHERE EXISTS (
|
||||
SELECT 1 FROM baiyue_iam.iam_permission child
|
||||
JOIN baiyue_iam.iam_permission parent ON parent.id = child.parent_id
|
||||
WHERE child.id BETWEEN 5100000 AND 5299999
|
||||
AND child.permission_type = 'MENU' AND parent.parent_id <> 0
|
||||
)
|
||||
UNION ALL
|
||||
SELECT 'invalid_button_parent'
|
||||
WHERE EXISTS (
|
||||
SELECT 1 FROM baiyue_iam.iam_permission button_permission
|
||||
LEFT JOIN baiyue_iam.iam_permission menu_permission ON menu_permission.id = button_permission.parent_id
|
||||
WHERE button_permission.id BETWEEN 5100000 AND 5299999
|
||||
AND button_permission.permission_type = 'BUTTON'
|
||||
AND (menu_permission.id IS NULL OR menu_permission.permission_type <> 'MENU' OR menu_permission.parent_id = 0)
|
||||
)
|
||||
UNION ALL
|
||||
SELECT 'platform_admin_not_fully_granted'
|
||||
WHERE (SELECT COUNT(*) FROM baiyue_iam.iam_role_permission WHERE role_id = 4000001)
|
||||
<> (SELECT COUNT(*) FROM baiyue_iam.iam_permission WHERE tenant_id = 0 AND app_code = 'PLATFORM' AND permission_type IN ('MENU', 'BUTTON'))
|
||||
UNION ALL
|
||||
SELECT 'merchant_owner_not_fully_granted'
|
||||
WHERE (SELECT COUNT(*) FROM baiyue_iam.iam_role_permission WHERE role_id = 4000101)
|
||||
<> (SELECT COUNT(*) FROM baiyue_iam.iam_permission WHERE tenant_id = 10001 AND app_code = 'MERCHANT' AND permission_type IN ('MENU', 'BUTTON'));
|
||||
Reference in New Issue
Block a user