Report verified personnel names for assistance links
This commit is contained in:
1 parent
b5dd3560b6
commit
41e0bfba71
8 files changed
+224
-8
No files matched your search
@@ -12,6 +12,7 @@ import { CliError, validationError, usageError } from "../../core/errors.js";
|
||||
import { createSealClient, createSealClientForUrl } from "../../core/http/factory.js";
|
||||
import { resolveSealCustomHeaders } from "../../core/http/request-headers.js";
|
||||
import { createDelegation, getMe } from "../../domains/seal/api.js";
|
||||
import { resolveHoseLinkIdentity, resolveSealLinkIdentity, summarizeSealLinkIdentity } from "../../domains/seal/enterprise/assist-identity.js";
|
||||
import {
|
||||
booleanOption,
|
||||
parseDelegationExpireHours,
|
||||
@@ -59,6 +60,7 @@ export async function handleAuthCommand(action: string | undefined, corp: CorpCo
|
||||
const delegation = await createDelegation(client, { note, expiresInHours });
|
||||
|
||||
printJson({
|
||||
...summarizeSealLinkIdentity(me.user),
|
||||
tenant: {
|
||||
id: me.tenant.id,
|
||||
name: me.tenant.name,
|
||||
@@ -115,14 +117,15 @@ export async function handleAuthCommand(action: string | undefined, corp: CorpCo
|
||||
console.error(`👉 提示: 企业「${corp.name}」源类型为 Seal 原生测试环境,已自动为您生成委托免登直达链接。`);
|
||||
}
|
||||
const delegationRecord = delegation as Record<string, unknown>;
|
||||
const staffName = "staffName" in corp.source && typeof corp.source.staffName === "string" ? corp.source.staffName : undefined;
|
||||
const expiresAt = formatBeijingIso(Date.now() + expiresInHours * 3600 * 1000);
|
||||
const identity = await resolveSealLinkIdentity(client);
|
||||
if (identity.identityStatus === "unresolved") console.error("提示:链接已生成,但未能核实实际登录人员姓名;请勿将 staffId 当作姓名或推断管理员身份。");
|
||||
printJson({
|
||||
id: delegationRecord.id,
|
||||
corpId: corp.source.corpId ?? corp.id,
|
||||
corpName: corp.name,
|
||||
staffId: corp.source.staffId,
|
||||
...(staffName ? { staffName } : {}),
|
||||
...identity,
|
||||
link: delegationRecord.link,
|
||||
expiresAt,
|
||||
token: delegationRecord.token
|
||||
@@ -138,13 +141,14 @@ export async function handleAuthCommand(action: string | undefined, corp: CorpCo
|
||||
booleanOption(args.options.refresh) === true ||
|
||||
booleanOption(args.options.f) === true;
|
||||
const provisional = await getHoseProvisionalAuthLink(corp, expiresIn, { force });
|
||||
const staffName = "staffName" in corp.source && typeof corp.source.staffName === "string" ? corp.source.staffName : undefined;
|
||||
const expiresAt = formatBeijingIso(Date.now() + expiresIn * 1000);
|
||||
const identity = await resolveHoseLinkIdentity(corp);
|
||||
if (identity.identityStatus === "unresolved") console.error("提示:链接已生成,但未能核实实际登录人员姓名;请勿将 staffId 当作姓名或推断管理员身份。");
|
||||
printJson({
|
||||
corpId: corp.source.corpId ?? corp.id,
|
||||
corpName: corp.name,
|
||||
staffId: corp.source.staffId,
|
||||
...(staffName ? { staffName } : {}),
|
||||
...identity,
|
||||
link: provisional.url,
|
||||
expiresAt,
|
||||
token: provisional.token
|
||||
|
||||
Reference in new issue
Block a user