service-omni-permission-set-assign
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseservice-omni-permission-set-assign
service-omni-permission-set-assign
Assign one or more PermissionSets to N agent users via Data API POSTs. The default target is , the permission set granting the OmniChannel widget, presence-status access, and demo-queue visibility — without an assignment row, agents cannot open the widget or receive routed work. Detection is SOQL-based, so the skill only creates the assignments that are missing. Agent users come from , and it runs alongside so assigned agents can both open the widget and select a status.
PermissionSetAssignmentOmni_Agentservice-omni-agent-users-createservice-omni-presence-status-deploy通过数据API的POST请求,为N个代理用户分配一个或多个PermissionSet。默认目标是权限集,该权限集授予OmniChannel组件、在线状态访问权限以及演示队列可见性——如果没有分配记录,代理将无法打开组件或接收路由任务。检测基于SOQL实现,因此该技能仅创建缺失的权限分配。代理用户来自服务,并且该服务会与服务一同运行,以便已分配权限的代理既能打开组件,又能选择在线状态。
PermissionSetAssignmentOmni_Agentservice-omni-agent-users-createservice-omni-presence-status-deployInputs
输入参数
bash
bash scripts/verify-and-assign.sh <org-alias> [count=3] [permission-set-names-csv=Omni_Agent]- (required).
org-alias - (optional, default
count, range3) — must match the agent user count.1..10 - (optional, default
permission-set-names-csv) — comma-separated for multiple. Every user gets every listed set (cross-product):Omni_Agent× 2 sets = up to 6 assignments.count=3
bash
bash scripts/verify-and-assign.sh <org-alias> [count=3] [permission-set-names-csv=Omni_Agent]- (必填)。
org-alias - (可选,默认值
count,范围3)——必须与代理用户数量匹配。1..10 - (可选,默认值
permission-set-names-csv)——多个权限集用逗号分隔。每个用户都会获得列表中的所有权限集(笛卡尔积):Omni_Agent× 2个权限集 = 最多6个分配记录。count=3
Preconditions and safety
前置条件与安全机制
- Target org authenticated via CLI, Service Cloud license,
sfCLI ≥ 2.139.6.sf - The agent users exist (); a count mismatch blocks with a pointer back to that skill.
service-omni-agent-users-create - The executing user has (standard on System Administrator) — required even for org admins;
PermissionsAssignPermissionSetsalone is insufficient.ModifyAllData - At least one Omni presence status exists before self-heals — the bundled set grants agent capability via
Omni_Agentfor whichever curated statuses exist (e.g.servicePresenceStatusAccesses/Available_Case+Available_Voice), generated at deploy time. RunBusyfirst; the coordinator sequences presence before permset for this reason.service-omni-presence-status-deploy - The three-way guard applies — assigning permission sets on a production org can escalate a real user's privileges, so it blocks with no override.
safe_to_write
Self-heal (run mode only). When the default set is absent, the skill deploys the bundled metadata once, then assigns. In mode it never deploys — it reports and exits read-only. This covers only the bundled asset; any other permission set must already exist or the run blocks with a click-path.
Omni_AgentOmni_Agent--planaction_neededOmni_Agent- 目标组织已通过CLI完成身份验证,拥有Service Cloud许可证,且
sfCLI版本≥2.139.6。sf - 代理用户已存在(由服务创建);如果数量不匹配,将阻止操作并提示回到该服务。
service-omni-agent-users-create - 执行用户拥有权限(系统管理员默认拥有)——即使是组织管理员也需要该权限;仅拥有
PermissionsAssignPermissionSets权限是不够的。ModifyAllData - 在权限集自修复前,至少存在一个Omni在线状态——捆绑的权限集通过
Omni_Agent为部署时生成的所有预设状态(如servicePresenceStatusAccesses/Available_Case+Available_Voice)授予代理能力。请先运行Busy服务;出于此原因,协调器会先处理在线状态,再处理权限集。service-omni-presence-status-deploy - 启用三重防护机制——在生产组织中分配权限集可能会提升真实用户的权限,因此会直接阻止操作且无法覆盖。
safe_to_write
自修复(仅运行模式) 当默认的权限集不存在时,该技能会部署一次捆绑的元数据,然后进行分配。在模式下,它绝不会部署——只会报告并以只读模式退出。此功能仅覆盖捆绑的资源;任何其他权限集必须已存在,否则运行将被阻止并提供操作路径。
Omni_AgentOmni_Agent--planaction_neededOmni_AgentRun
运行流程
verify-and-assign.sh- Compute ; derive the 8-char org suffix.
safe_to_write - Resolve the agent users by the pattern; block if any are missing.
agent{1..N}.<suffix>@example.com - Resolve each by name; self-heal
PermissionSetif absent, else block naming which is missing.Omni_Agent - Query existing for the (user × set) cross-product; compute the missing pairs.
PermissionSetAssignment - POST one assignment per missing pair (individual POSTs, no ).
allOrNone - Re-query to confirm final state and emit the report.
verify-and-assign.sh- 计算值;提取8位字符的组织后缀。
safe_to_write - 通过模式解析代理用户;如果有任何用户缺失,则阻止操作。
agent{1..N}.<suffix>@example.com - 按名称解析每个;如果
PermissionSet缺失则进行自修复,否则阻止操作并指出缺失的权限集名称。Omni_Agent - 查询现有记录,获取(用户×权限集)的笛卡尔积;计算缺失的配对。
PermissionSetAssignment - 为每个缺失的配对发送一个POST请求(单独发送POST,不使用参数)。
allOrNone - 重新查询以确认最终状态并生成报告。
Behavior
行为特性
Cross-product. Every user gets every listed set; a partial assignment is a failure, not a feature.
Idempotency. has a database uniqueness constraint on (AssigneeId, PermissionSetId), so a re-POST raises ; the skill detects existing pairs first and treats as a safety net for concurrent races. It POSTs individually so one duplicate or error never rolls back its successful siblings, and it re-queries after all POSTs — a 201 only means Salesforce accepted the write; a subsequent SOQL confirms the assignment is active.
PermissionSetAssignmentDUPLICATE_VALUEDUPLICATE_VALUENon-destructive. The skill is create-only; it never deletes existing assignments (users may hold out-of-band permissions from other admins) and derives users from the agent pattern rather than accepting an explicit user-id list, so it never assigns demo permissions to real named users.
笛卡尔积分配 每个用户都会获得列表中的所有权限集;部分分配视为失败,而非功能特性。
幂等性 在(AssigneeId, PermissionSetId)上有数据库唯一性约束,因此重复POST会触发错误;该技能会先检测现有配对,并将视为并发竞争的安全防护。它单独发送每个POST请求,因此单个重复或错误不会回滚其他成功的请求,并且在所有POST完成后会重新查询——201状态码仅表示Salesforce接受了写入操作;后续的SOQL查询会确认分配是否生效。
PermissionSetAssignmentDUPLICATE_VALUEDUPLICATE_VALUE非破坏性 该技能仅支持创建操作;绝不会删除现有分配记录(用户可能拥有其他管理员授予的额外权限),并且通过代理模式推导用户,而非接受显式的用户ID列表,因此绝不会将演示权限分配给真实的命名用户。
Output contract
输出约定
A single JSON object with ∈ | | | , the resolved , , , (= ), a snapshot, /, , an snapshot, , and .
statusassignedreusedpartialblockedpermission_setsorg_suffixrequested_countexpected_assignment_countrequested_count × len(permission_sets)beforeassigned_this_runassigned_countreused_countaftermanual_actionsblocking_issue- — at least one new assignment created; all expected pairs exist after.
assigned - — all expected pairs already existed; nothing POSTed.
reused - — some POSTs failed; final count is below expected.
partial - — precondition failed (production org, missing set, missing users, missing permissions).
blocked
assigned_count + reused_count == expected_assignment_countpartialblocking_issueblockedpartial返回单个JSON对象,包含(取值为 | | | )、已解析的、、、(= )、快照、/、、快照、和。
statusassignedreusedpartialblockedpermission_setsorg_suffixrequested_countexpected_assignment_countrequested_count × len(permission_sets)beforeassigned_this_runassigned_countreused_countaftermanual_actionsblocking_issue- — 至少创建了一个新的分配记录;所有预期配对在操作后都已存在。
assigned - — 所有预期配对已存在;未发送任何POST请求。
reused - — 部分POST请求失败;最终数量低于预期。
partial - — 前置条件不满足(生产组织、权限集缺失、用户缺失、权限缺失)。
blocked
除非状态为,否则;仅当状态为/时,不为空。
partialassigned_count + reused_count == expected_assignment_countblockedpartialblocking_issueLimitations
局限性
- Assigns individual PermissionSets only — a is a different sObject and is out of scope.
PermissionSetGroup - Self-heal covers only the bundled ; it is not a general-purpose permission-set authoring surface.
Omni_Agent - Create-only; it does not remove assignments.
- 仅支持分配单个PermissionSet — 是不同的sObject,不在本技能的范围内。
PermissionSetGroup - 自修复仅覆盖捆绑的权限集;它不是通用的权限集创建工具。
Omni_Agent - 仅支持创建操作;不支持删除分配记录。
References
参考文档
| File | When to read |
|---|---|
| Load when the default |
| Before the POST loop — PermissionSetAssignment schema, its |
| 文件 | 阅读时机 |
|---|---|
| 当默认的 |
| 在执行POST循环前阅读——了解PermissionSetAssignment的架构、 |