更新角色
1. 接口描述
接口请求域名: essbasic.tencentcloudapi.com 。
此接口(ChannelModifyRole)用来更新企业自定义角色。
适用场景1:更新当前企业的自定义角色的名称或描述等其他信息,更新时不进行权限的设置(PermissionGroups 参数不传)。
适用场景2:更新当前企业的自定义角色的权限信息,更新时进行权限的设置(PermissionGroups 参数要传),权限树内容 PermissionGroups 可参考查询角色列表接口 的输出。此处注意权限树内容可能会更新,需尽量拉取最新的权限树内容,并且权限树内容 PermissionGroups 必须是一颗完整的权限树。
默认接口请求频率限制:20次/秒。
推荐使用 API Explorer
点击调试API Explorer 提供了在线调用、签名验证、SDK 代码生成和快速检索接口等能力。您可查看每次调用的请求内容和返回结果以及自动生成 SDK 调用示例。
2. 输入参数
以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数。
参数名称 | 必选 | 类型 | 描述 |
---|---|---|---|
Action | 是 | String | 公共参数,本接口取值:ChannelModifyRole。 |
Version | 是 | String | 公共参数,本接口取值:2021-05-26。 |
Region | 否 | String | 公共参数,此参数为可选参数。 |
Agent | 是 | Agent | 代理企业和员工的信息。 |
Name | 是 | String | 角色名称,最大长度为20个字符,仅限中文、字母、数字和下划线组成。 |
RoleId | 是 | String | 角色Id,可通过接口 ChannelDescribeRoles 查询获取 |
Description | 否 | String | 角色描述,最大长度为50个字符 |
PermissionGroups.N | 否 | Array of PermissionGroup | 权限树,权限树内容 PermissionGroups 可参考接口 ChannelDescribeRoles的输出 |
3. 输出参数
参数名称 | 类型 | 描述 |
---|---|---|
RoleId | String | 角色id |
RequestId | String | 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 |
4. 示例
示例1 更新角色(带权限树参数)
更新角色并同时设置角色中的权限内容,设置权限树参数 PermissionGroups ,PermissionGroups 展开为树形结构,可以需要的权限节点下将 IsChecked 属性设置为true。 注意:父权限节点 IsChecked 属性为true,则需要将其下所有子节点的 IsChecked属性同时设置为true,否则校验不通过。
输入示例
POST / HTTP/1.1
Host: essbasic.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ChannelModifyRole
<公共请求参数>
{
"Agent": {
"AppId": " jsdk812kxkdfjks***k88123123",
"ProxyOrganizationOpenId": "test_org_openid",
"ProxyOperator": {
"OpenId": "test_openid"
}
},
"RoleId": "123456**89",
"Name": "xxx角色",
"Description": "这是一个自定义角色",
"PermissionGroups": [
{
"GroupKey": "bill",
"GroupName": "费用中心",
"Hide": 0,
"Permissions": [
{
"Children": [
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 1,
"IsChecked": false,
"Key": "BillOrderManagement",
"Name": "订单管理",
"ParentKey": "",
"Type": 2
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 1,
"IsChecked": false,
"Key": "BillSetMealManagement",
"Name": "套餐管理",
"ParentKey": "",
"Type": 2
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 1,
"IsChecked": false,
"Key": "BillInvoiceManagement",
"Name": "发票管理",
"ParentKey": "",
"Type": 2
}
],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 0,
"IsChecked": false,
"Key": "BillManagement",
"Name": "费用管理",
"ParentKey": "",
"Type": 1
}
]
},
{
"GroupKey": "channel",
"GroupName": "开发者中心",
"Hide": 0,
"Permissions": [
{
"Children": [
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 1,
"IsChecked": false,
"Key": "DescribeChannelComponents",
"Name": "渠道控件查看",
"ParentKey": "",
"Type": 2
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 1,
"IsChecked": false,
"Key": "InsertOrModifyChannelComponents",
"Name": "渠道控件编辑",
"ParentKey": "",
"Type": 2
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 1,
"IsChecked": false,
"Key": "DeleteChannelComponents",
"Name": "渠道控件删除",
"ParentKey": "",
"Type": 2
}
],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 0,
"IsChecked": false,
"Key": "WidgetManagement",
"Name": "渠道模板控件管理",
"ParentKey": "",
"Type": 1
},
{
"Children": [
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 1,
"IsChecked": false,
"Key": "DescribeChannelTemplate",
"Name": "渠道模板库查看",
"ParentKey": "",
"Type": 2
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 1,
"IsChecked": false,
"Key": "InsertOrModifyChannelTemplate",
"Name": "渠道模板库编辑",
"ParentKey": "",
"Type": 2
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 1,
"IsChecked": false,
"Key": "DeleteChannelTemplate",
"Name": "渠道模板库删除",
"ParentKey": "",
"Type": 2
}
],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 0,
"IsChecked": false,
"Key": "ChannelTemplateManagement",
"Name": "渠道模板库管理",
"ParentKey": "",
"Type": 1
}
]
},
{
"GroupKey": "Flow",
"GroupName": "合同中心",
"Hide": 0,
"Permissions": [
{
"Children": [
{
"Children": [],
"DataLabel": 2,
"DataRange": 1,
"DataTo": "",
"DataType": 0,
"Hide": 0,
"IsChecked": false,
"Key": "DescribeAllFlows",
"Name": "企业全部合同",
"ParentKey": "FlowsManagement",
"Type": 2
}
],
"DataLabel": 1,
"DataRange": 0,
"DataTo": "",
"DataType": 2,
"Hide": 0,
"IsChecked": false,
"Key": "FlowsManagement",
"Name": "查询合同",
"ParentKey": "",
"Type": 1
},
{
"Children": [],
"DataLabel": 1,
"DataRange": 0,
"DataTo": "FlowsManagement",
"DataType": 1,
"Hide": 0,
"IsChecked": false,
"Key": "FlowsManagement-Preview",
"Name": "合同详情&预览",
"ParentKey": "",
"Type": 1
},
{
"Children": [],
"DataLabel": 1,
"DataRange": 0,
"DataTo": "FlowsManagement",
"DataType": 1,
"Hide": 0,
"IsChecked": false,
"Key": "FlowsManagement-Download",
"Name": "下载合同",
"ParentKey": "",
"Type": 1
},
{
"Children": [
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 0,
"IsChecked": false,
"Key": "FlowByImportedFile",
"Name": "上传文件发起",
"ParentKey": "",
"Type": 2
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 0,
"IsChecked": false,
"Key": "FlowByOrganizationTemplate",
"Name": "企业模版发起",
"ParentKey": "",
"Type": 1
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 0,
"IsChecked": false,
"Key": "CreateMultiFlowSignQRCode",
"Name": "创建签署二维码",
"ParentKey": "",
"Type": 1
}
],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 0,
"IsChecked": false,
"Key": "CreateFlow",
"Name": "发起合同",
"ParentKey": "",
"Type": 2
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 1,
"IsChecked": false,
"Key": "FlowsManagement-Pickup",
"Name": "领取合同",
"ParentKey": "",
"Type": 1
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 0,
"IsChecked": false,
"Key": "CancelFlow",
"Name": "撤销合同",
"ParentKey": "",
"Type": 2
}
]
},
{
"GroupKey": "Organization",
"GroupName": "组织员工",
"Hide": 0,
"Permissions": [
{
"Children": [
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 1,
"IsChecked": false,
"Key": "CreateUserRoles",
"Name": "为员工分配角色",
"ParentKey": "",
"Type": 2
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 1,
"IsChecked": false,
"Key": "ModifyYuFuOrg",
"Name": "编辑组织架构",
"ParentKey": "",
"Type": 1
}
],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 0,
"IsChecked": false,
"Key": "OrgManagement",
"Name": "组织架构管理",
"ParentKey": "",
"Type": 1
},
{
"Children": [
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 1,
"IsChecked": false,
"Key": "CreateRole",
"Name": "创建角色",
"ParentKey": "",
"Type": 2
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 1,
"IsChecked": false,
"Key": "ModifyRole",
"Name": "修改角色",
"ParentKey": "",
"Type": 2
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 1,
"IsChecked": false,
"Key": "DeleteRole",
"Name": "删除角色",
"ParentKey": "",
"Type": 2
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 1,
"IsChecked": false,
"Key": "ModifyRoleStatus",
"Name": "启用&禁用角色",
"ParentKey": "",
"Type": 2
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 1,
"IsChecked": false,
"Key": "CreateRoleUsers",
"Name": "添加员工",
"ParentKey": "",
"Type": 2
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 1,
"IsChecked": false,
"Key": "DeleteRoleUsers",
"Name": "取消关联",
"ParentKey": "",
"Type": 2
}
],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 0,
"IsChecked": false,
"Key": "RoleManagement",
"Name": "角色管理",
"ParentKey": "",
"Type": 1
}
]
},
{
"GroupKey": "Seal",
"GroupName": "印章中心",
"Hide": 0,
"Permissions": [
{
"Children": [
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 1,
"IsChecked": false,
"Key": "QueryHoldSeal",
"Name": "查询印章",
"ParentKey": "",
"Type": 2
}
],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 0,
"IsChecked": false,
"Key": "SealManagement-Hold",
"Name": "我持有企业印章",
"ParentKey": "",
"Type": 1
},
{
"Children": [
{
"Children": [
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 1,
"IsChecked": false,
"Key": "SealManagement-Manage-Detail-Holder",
"Name": "授权记录",
"ParentKey": "",
"Type": 2
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 1,
"IsChecked": false,
"Key": "SealManagement-Manage-Detail-Holder-Template",
"Name": "关联模版",
"ParentKey": "",
"Type": 2
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 1,
"IsChecked": false,
"Key": "SealManagement-Manage-Detail-Holder-Use-Record",
"Name": "用印记录",
"ParentKey": "",
"Type": 2
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 1,
"IsChecked": false,
"Key": "SealManagement-Manage-Detail-Holder-Change-Record",
"Name": "变更记录",
"ParentKey": "",
"Type": 1
}
],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 0,
"IsChecked": false,
"Key": "SealManagement-Manage-Detail",
"Name": "查询印章",
"ParentKey": "",
"Type": 2
},
{
"Children": [
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 1,
"IsChecked": false,
"Key": "SealManagement-Manage-Create-Template",
"Name": "印章管理-可管理印章-新建印章-模版印章",
"ParentKey": "",
"Type": 1
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 1,
"IsChecked": false,
"Key": "SealManagement-Manage-Create-Upload",
"Name": "印章管理-可管理印章-新建印章-本地上传",
"ParentKey": "",
"Type": 1
}
],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 0,
"IsChecked": false,
"Key": "CreateSeal",
"Name": "创建印章",
"ParentKey": "",
"Type": 2
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 0,
"IsChecked": false,
"Key": "ModifySeal",
"Name": "修改印章",
"ParentKey": "",
"Type": 2
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 0,
"IsChecked": false,
"Key": "CreateSealPolicy",
"Name": "分配印章管理人",
"ParentKey": "",
"Type": 2
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 0,
"IsChecked": false,
"Key": "DeleteSeal",
"Name": "删除印章",
"ParentKey": "",
"Type": 2
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 0,
"IsChecked": false,
"Key": "ApplySealOnce",
"Name": "单次用印审批",
"ParentKey": "",
"Type": 2
}
],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 0,
"IsChecked": false,
"Key": "SealManagement",
"Name": "印章管理",
"ParentKey": "",
"Type": 1
}
]
},
{
"GroupKey": "Template",
"GroupName": "模板中心",
"Hide": 0,
"Permissions": [
{
"Children": [
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 0,
"IsChecked": false,
"Key": "TemplateManagement-Query",
"Name": "查询模板",
"ParentKey": "",
"Type": 1
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 0,
"IsChecked": false,
"Key": "OfficialFlowTemplateCollection",
"Name": "官方模板收藏",
"ParentKey": "",
"Type": 1
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 0,
"IsChecked": false,
"Key": "TemplateManagement-Download",
"Name": "下载模板",
"ParentKey": "",
"Type": 1
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 0,
"IsChecked": false,
"Key": "TemplateManagement-Create",
"Name": "创建模板",
"ParentKey": "",
"Type": 1
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 0,
"IsChecked": false,
"Key": "DeleteFlowTemplates",
"Name": "删除模板",
"ParentKey": "",
"Type": 2
},
{
"Children": [],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 0,
"IsChecked": false,
"Key": "ModifyFlowTemplate",
"Name": "编辑模板",
"ParentKey": "",
"Type": 2
}
],
"DataLabel": 0,
"DataRange": 0,
"DataTo": "",
"DataType": 0,
"Hide": 0,
"IsChecked": false,
"Key": "TemplateManagement",
"Name": "模板管理",
"ParentKey": "",
"Type": 1
}
]
}
]
}
输出示例
{
"Response": {
"RoleId": "123456**89",
"RequestId": " s19ksdjkkds****ldsjfkdfdf"
}
}
示例2 更新角色(不带权限树参数)
更新一个自定义角色,并且不带权限信息
输入示例
POST / HTTP/1.1
Host: essbasic.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ChannelModifyRole
<公共请求参数>
{
"Agent": {
"AppId": " jsdk812kxkdfjks***k88123123",
"ProxyOrganizationOpenId": "test_org_openid",
"ProxyOperator": {
"OpenId": "test_openid"
}
},
"RoleId": "123456**89",
"Name": "xxx角色",
"Description": "这是一个自定义角色"
}
输出示例
{
"Response": {
"RoleId": "123456**89",
"RequestId": " s19ksdjkkds****ldsjfkdfdf"
}
}
5. 错误码
以下仅列出了接口业务逻辑相关的错误码,其他错误码详见 公共错误码。
错误码 | 描述 |
---|---|
FailedOperation | 操作失败。 |
InternalError | 内部错误。 |
InvalidParameter | 参数错误。 |
InvalidParameter.ParamError | 参数错误。 |
MissingParameter | 缺少参数错误。 |
OperationDenied | 操作被拒绝。 |
UnauthorizedOperation | 未授权操作。 |