用户与应用程序权限
当应用程序通过 REST API 请求访问会议等用户资源时,它会使用与应用程序和授权该应用程序的用户关联的访问令牌。 API 可能需要应用程序和用户的许可。当权限返回并出现错误时user needs to have
如下图,表示需要用户权限。
In order to call this API endpoint, user needs to have [Meetings] permission \
for requested resource.
解决这个问题需要三个部分:
- 检查用户权限
- 查找权限的显示名称
- 给用户添加权限
1. 检查用户权限
括号内的文字是permissionId
。您可以通过调用权限检查接口来检查您的用户是否拥有该权限,如下:
GET /restapi/v1.0/account/~/extension/~/authz-profile/check?permissionId=Meetings
您将得到如下响应。这successful
属性将显示true
or false
取决于用户是否具有特定权限。如果您看到此错误,successful
应设置为false
.
{
"uri":"https://platform.ringcentral.com/restapi/v1.0/account/11111111/extension/22222222/authz-profile/check?permissionId=Meetings&targetExtensionId=11111111",
"successful":true,
"details":{
"permission":{
"uri":"https://platform.ringcentral.com/restapi/v1.0/dictionary/permission/Meetings",
"id":"Meetings",
"assignable":true,
"readOnly":false,
"siteCompatible":"Independent"
},
"effectiveRole":{
"uri":"https://platform.ringcentral.com/restapi/v1.0/dictionary/user-role/3",
"id":"3"
},
"scopes":[
"Self"
]
}
}
- Ref: https://developer.ringcentral.com/api-docs/latest/index.html#!#RefCheckUserPermissions
2. 查找权限的显示名称
要向用户添加此权限,需要获取权限的显示名称,该名称将用于通过在线帐户门户添加此权限(https://service.ringcentral.com用于生产)。
您可以通过调用权限的字典端点来获取此信息,其中permissionId
is Meetings
如下所示。
GET /restapi/v1.0/dictionary/permission/{permissionId}
GET /restapi/v1.0/dictionary/permission/Meetings
响应将有一个displayName
指示“会议应用程序访问”的属性是在线帐户门户中的 UI 权限。
或者,您可以进行 API 调用来获取权限列表并查找permissionId
这是Meetings
这里。在下面的回复摘录中,"displayName":"Meetings App Access"
设置为"id":"Meetings"
.
GET /restapi/v1.0/dictionary/permission
您将得到如下响应。为了简洁起见,我删除了所有其他权限:
{
"uri":"https://platform.ringcentral.com/restapi/v1.0/dictionary/permission?page=1&perPage=100",
"records":[
{
"uri":"https://platform.ringcentral.com/restapi/v1.0/dictionary/permission/Meetings",
"id":"Meetings",
"displayName":"Meetings App Access",
"assignable":true,
"readOnly":false,
"siteCompatible":"Independent",
"category":{
"uri":"https://platform.ringcentral.com/restapi/v1.0/dictionary/permission-category/Meetings",
"id":"Meetings"
},
"includedPermissions":[
]
}
]
}
- Ref: https://developer.ringcentral.com/api-docs/latest/index.html#!#RefDictionaryPermissionList.html
3.给用户添加权限
现在转到 RingCentral 在线帐户门户并确保用户在其角色中拥有此权限。
在线帐户门户位于:
- 生产环境:https://service.ringcentral.com
- 沙箱环境:https://service.devtest.ringcentral.com
登录后,按照以下说明查找用户的角色并确保该角色具有“会议应用程序访问”权限:
- KB: 如何设置用户角色和权限?如何为用户分配特定角色?
它在 UI 中看起来如下所示: