- 文档
- 应用
- Get App Menu and Permission
Get App Menu and Permission¶
获取应用的权限点及菜单列表。
操作权限¶
用户需要登录 Application Portal。
约束条件¶
- 关联的应用已被组织购买
- 用户需要对该应用的菜单或者权限点有对应的权限(否则返回结果为空)
请求格式¶
GET https://{apigw-address}/app-portal-service/v2.2/user/app/resource/info
请求参数(URI)¶
名称 | 位置(Path/Query) | 必需/可选 | 数据类型 | 描述 |
---|---|---|---|---|
accessKey | Query | 必需 | String | 应用的服务账号,应用以 accessKey 进行鉴权以获得其被授权访问的数据。如何获取accessKey信息>> |
请求参数(Header)¶
名称 | 必需/可选 | 数据类型 | 描述 |
---|---|---|---|
Authorization | 必需 | String | Access Token,以Bearer Token表示,需要通过调用 Log In 或 Refresh Access Token 接口后获取。 |
响应参数¶
名称 | 数据类型 | 描述 |
---|---|---|
data | data结构体 | 权限点和菜单列表。 |
data结构体¶
名称 | 数据类型 | 描述 |
---|---|---|
permissions | Permission列表 | 权限点列表。 |
menus | Menu列表 | 菜单列表。 |
Permission列表¶
名称 | 数据类型 | 描述 |
---|---|---|
id | String | 权限点ID。 |
identifier | String | 权限点唯一标识符。 |
name | String | 权限点名称。 |
nameJson | I18nString | 权限点名称,多语言,json结构。 |
Menu列表¶
名称 | 数据类型 | 描述 |
---|---|---|
id | String | 菜单ID。 |
name | String | 菜单名称。 |
nameJson | I18nString | 菜单名称,多语言,json结构。 |
identifier | String | 菜单唯一标识符。 |
displayOrder | Integer | 菜单展示排序,表示当前菜单在其所在层级内的排序,值为从1开始的整数,序号越小的菜单越排在上方。 |
url | String | 菜单URL。 |
parentId | String | 上级菜单。 |
children | Menu结构体 | 下级菜单。 |
错误码¶
代码 | 描述 |
---|---|
31400 | AccessKey不能为空 |
31401 | 提供的Access Token无效 |
31403 | 没有此应用权限 |
31404 | 应用不存在或组织未购买此应用 |
示例¶
请求示例¶
url: https://{apigw-address}/app-portal-service/v2.2/user/app/resource/info?accessKey=app_1
method: GET
headers: {"Authorization":"Bearer APP_PORTAL_S_TDKKeqfYBK3m5z3LRgKVqThWDYnRBN44"}
返回示例¶
{
"code": 0,
"message": "OK",
"data": {
"permissions": [],
"menus": [
{
"id": "accessKey",
"identifier": "menu",
"name": "menu",
"nameJson":{"default":"defName","en_Us":"enName", "zh_CN":"zhName"},
"url": "/a",
"displayOrder": 1,
"parentId": "",
"children": []
},
{
"id": "accessKey",
"identifier": "menu2",
"name": "menu2",
"nameJson":{"default":"defName","en_Us":"enName", "zh_CN":"zhName"},
"url": "/eos-wind-map/assetOverview.html",
"displayOrder": 2,
"parentId": "",
"children": []
}
]
}
}
Java SDK 调用示例¶
public class AppPortalSdkTest{
@Test
public void GetAppMenuAndPermissionTest() {
AppResourceRequest appResourceRequest = new AppResourceRequest("your_access_key", "your_access_token");
AppResourceResponse appResourceResponse = Poseidon.config(PConfig.init().appKey("your_access_key").appSecret("your_secret_key").debug())
.url("https://{apigw-address}").getResponse(appResourceRequest, AppResourceResponse.class);
System.out.println("Get app permission and menu res: " + JSON.toJSONString(appResourceResponse));
assertNotNull("Response should not be null", appResourceResponse);
assertNotNull("Response data should not be null", appResourceResponse.data);
assertNotNull("Menus should not be null", appResourceResponse.data.menus);
assertNotNull("Permissions should not be null", appResourceResponse.data.permissions);
}
}