@autional/shared 0.1.0-rc.48 → 0.1.0-rc.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -123,6 +123,18 @@ describe('buildLoginUrl', () => {
|
|
|
123
123
|
);
|
|
124
124
|
});
|
|
125
125
|
|
|
126
|
+
// 回归锁(2026-11-08):/activity 与 /security 是 auth 站裸路由,
|
|
127
|
+
// 缺登记会被当成租户 slug → /activity/login、/security/login(未知租户页)。
|
|
128
|
+
it('treats /activity and /security as reserved auth routes', () => {
|
|
129
|
+
for (const route of ['activity', 'security']) {
|
|
130
|
+
mockWindow('auth.autional.local', 'https:', 'https://auth.autional.local', AUTH_CONFIG);
|
|
131
|
+
const target = `https://auth.autional.local/${route}`;
|
|
132
|
+
expect(buildLoginUrl(target)).toBe(
|
|
133
|
+
'https://auth.autional.local?redirect=' + encodeURIComponent(target),
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
|
|
126
138
|
it('preserves cross-domain returnUrl behavior (app domain)', () => {
|
|
127
139
|
mockWindow('auth.autional.local', 'https:', 'https://auth.autional.local', AUTH_CONFIG);
|
|
128
140
|
const url = buildLoginUrl('https://app.autional.com/admin');
|
package/src/auth/roles.ts
CHANGED
|
@@ -36,6 +36,10 @@ const AUTH_ROUTE_RESERVED = new Set([
|
|
|
36
36
|
'recover-account',
|
|
37
37
|
'account-deletion',
|
|
38
38
|
'verify-identity',
|
|
39
|
+
// auth 站裸路由:/activity(活动页,原 /security 改名)与 /security(旧路径重定向)。
|
|
40
|
+
// 缺这两段会把首段当租户 slug,生成 /activity/login、/security/login(未知租户页)。
|
|
41
|
+
'activity',
|
|
42
|
+
'security',
|
|
39
43
|
]);
|
|
40
44
|
|
|
41
45
|
/**
|
package/src/config/index.ts
CHANGED
|
@@ -93,6 +93,7 @@ const PORTAL_DEFAULTS: Record<string, PortalEntry> = {
|
|
|
93
93
|
platform: { host: 'platform', base: '' },
|
|
94
94
|
brand: { host: 'brand', base: '' },
|
|
95
95
|
secret: { host: 'secret', base: '' },
|
|
96
|
+
config: { host: 'config', base: '' },
|
|
96
97
|
};
|
|
97
98
|
|
|
98
99
|
let portalConfig: Record<string, PortalEntry> | null = null;
|
|
@@ -320,6 +321,7 @@ function getAllowedRedirectOrigins(): string[] {
|
|
|
320
321
|
'platform',
|
|
321
322
|
'brand',
|
|
322
323
|
'secret',
|
|
324
|
+
'config',
|
|
323
325
|
];
|
|
324
326
|
return portalIds
|
|
325
327
|
.map((id) => {
|
|
@@ -301,11 +301,13 @@ describe('usePortalCatalog', () => {
|
|
|
301
301
|
});
|
|
302
302
|
|
|
303
303
|
describe('isPortalVisible', () => {
|
|
304
|
-
it('secret 与 admin/security 同属管理面:member 不可见、管理面角色可见', () => {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
304
|
+
it('secret / config 与 admin/security 同属管理面:member 不可见、管理面角色可见', () => {
|
|
305
|
+
for (const code of ['secret', 'config']) {
|
|
306
|
+
expect(isPortalVisible(code, { role: 'member', isPlatformMember: false })).toBe(false);
|
|
307
|
+
expect(isPortalVisible(code, { role: null, isPlatformMember: false })).toBe(false);
|
|
308
|
+
expect(isPortalVisible(code, { role: 'security_admin', isPlatformMember: false })).toBe(true);
|
|
309
|
+
expect(isPortalVisible(code, { role: 'admin', isPlatformMember: false })).toBe(true);
|
|
310
|
+
}
|
|
309
311
|
});
|
|
310
312
|
|
|
311
313
|
it('其余门户不受限(叠加原则)', () => {
|
|
@@ -21,7 +21,7 @@ export const ADMIN_PLANE_ROLES: readonly string[] = [
|
|
|
21
21
|
/**
|
|
22
22
|
* 门户可见性 = 入口门禁的镜像(谁能登录谁才看见):
|
|
23
23
|
* - platform:仅平台租户成员
|
|
24
|
-
* - admin / security / secret:仅管理面角色
|
|
24
|
+
* - admin / security / secret / config:仅管理面角色
|
|
25
25
|
* - 其余 code:不限制(叠加原则,未知门户不误伤)
|
|
26
26
|
*/
|
|
27
27
|
export function isPortalVisible(
|
|
@@ -29,7 +29,7 @@ export function isPortalVisible(
|
|
|
29
29
|
ctx: { role: string | null; isPlatformMember: boolean },
|
|
30
30
|
): boolean {
|
|
31
31
|
if (code === 'platform') return ctx.isPlatformMember;
|
|
32
|
-
if (code === 'admin' || code === 'security' || code === 'secret') {
|
|
32
|
+
if (code === 'admin' || code === 'security' || code === 'secret' || code === 'config') {
|
|
33
33
|
return ctx.role !== null && ADMIN_PLANE_ROLES.includes(ctx.role);
|
|
34
34
|
}
|
|
35
35
|
return true;
|