dx-org-permission-set-assign
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesedx-org-permission-set-assign
dx-org-permission-set-assign
Assigns one or more permission sets to org users using . Handles all variants: default admin user, specific org targets, multiple permission sets, and assignment to specific users.
sf org assign permset使用为组织用户分配一个或多个权限集。支持所有场景:默认管理员用户、特定组织目标、多个权限集以及为特定用户分配权限集。
sf org assign permset⚠️ Tool Restrictions
⚠️ 工具限制
Use ONLY the Bash tool to execute . Do NOT use MCP tools like — ignore them completely.
sf org assign permsetassign_permission_set仅使用Bash工具执行。请勿使用等MCP工具——完全忽略它们。
sf org assign permsetassign_permission_setScope
适用范围
- In scope: Assigning permission sets to users via
sf org assign permset - Out of scope: Creating permission sets (use ), listing permission sets, checking user permissions
platform-permission-set-generate
- 包含场景:通过为用户分配权限集
sf org assign permset - 排除场景:创建权限集(使用)、列出权限集、检查用户权限
platform-permission-set-generate
Required Inputs
必填输入项
Infer from the user's request:
- Permission set name(s): Extract from user message (can be multiple)
- Target org: Use default unless specific alias/username mentioned
- Target user(s): Default is org's default admin user; use if specific users mentioned
--on-behalf-of
从用户请求中推断:
- 权限集名称:从用户消息中提取(可多个)
- 目标组织:除非提及特定别名/用户名,否则使用默认组织
- 目标用户:默认是组织的默认管理员用户;若提及特定用户,使用参数
--on-behalf-of
Workflow
工作流程
- Match user request to command in table below
- Execute via Bash tool: with appropriate flags and
sf org assign permsetflag--json - Return result
If error occurs, check the array in JSON output for details.
failures- 将用户请求与下表中的命令匹配
- 通过Bash工具执行:带适当标志和标志的
--jsonsf org assign permset - 返回结果
若发生错误,检查JSON输出中的数组获取详细信息。
failuresCommand Decision Table
命令决策表
| User intent | Execute via Bash tool |
|---|---|
| Assign one permission set to default admin | |
| Assign multiple permission sets to default admin | |
| Assign to specific org | |
| Assign to specific user(s) | |
| Assign multiple sets to specific users | |
| 用户意图 | 通过Bash工具执行的命令 |
|---|---|
| 为默认管理员分配单个权限集 | |
| 为默认管理员分配多个权限集 | |
| 为特定组织分配权限集 | |
| 为特定用户分配权限集 | |
| 为特定用户分配多个权限集 | |
Rules / Constraints
规则与约束
| Constraint | Rationale |
|---|---|
Always use | Provides structured output for reliable parsing and error handling |
| Permission set names are case-sensitive | Use exact API names as they appear in the org |
Multiple | More efficient than separate commands per permission set |
Multiple | Batch assignment in single command; processed sequentially to avoid auth file collisions |
| Use CLI username aliases, not Salesforce User.Alias field | The |
| Duplicate assignments are idempotent | Re-assigning an already-assigned permission set succeeds silently |
| Partial success is possible | Command can return both successes and failures in one run; non-zero exit code if any failures |
| 约束条件 | 理由 |
|---|---|
始终使用 | 提供结构化输出,便于可靠解析和错误处理 |
| 权限集名称区分大小写 | 使用组织中显示的准确API名称 |
可在单个命令中组合多个 | 比为每个权限集单独执行命令更高效 |
多个 | 单命令批量分配;按顺序处理以避免认证文件冲突 |
| 使用CLI用户名别名,而非Salesforce User.Alias字段 | |
| 重复分配具有幂等性 | 重新分配已分配的权限集会静默执行成功 |
| 可能出现部分成功 | 命令可在一次运行中同时返回成功和失败结果;若存在任何失败,退出码为非零 |
Gotchas
常见问题与解决方法
| Issue | Resolution |
|---|---|
| Permission set name with spaces | Enclose in double quotes: |
| "PermissionSet not found" error | Verify permission set exists in target org; check for typos in name |
| Assignment succeeds but user doesn't see permissions | Check |
| "User not found" error | Username/alias doesn't exist in target org — verify with |
| Partial success (some users succeed, others fail) | Check JSON output — command returns both |
| 问题 | 解决方法 |
|---|---|
| 权限集名称包含空格 | 用双引号包裹: |
| "PermissionSet not found"错误 | 验证权限集是否存在于目标组织;检查名称拼写错误 |
| 分配成功但用户看不到权限 | 检查权限集元数据中的 |
| "User not found"错误 | 用户名/别名在目标组织中不存在——使用 |
| 部分成功(部分用户成功,部分失败) | 检查JSON输出——命令会返回 |
Output Expectations
输出预期
The command returns JSON output with status code and result details.
See and for response structures.
examples/success_output.jsonexamples/error_output.json命令返回包含状态码和结果详情的JSON输出。
查看和了解响应结构。
examples/success_output.jsonexamples/error_output.jsonReference File Index
参考文件索引
| File | When to read |
|---|---|
| To understand successful assignment response structure |
| To handle common error scenarios |
| For detailed explanation of all available flags |
| 文件 | 阅读场景 |
|---|---|
| 了解成功分配的响应结构 |
| 处理常见错误场景 |
| 获取所有可用标志的详细说明 |