> ## Documentation Index
> Fetch the complete documentation index at: https://docs.memorylake.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# 列出数据库资源可选权限级别

> 您可以在数据库资源上设置的权限级别

```
GET /openapi/memorylake/admin/v1/access/{resource_type}/{resource_id}/permission-levels/{subject_type}/{subject_id}/options
```

针对数据库连接、数据源和分析模型的[列出可选权限级别](https://docs.memorylake.cn/features/memorylake/api-reference/access-control/list-permission-level-options.md)。

| `resource_type` | `resource_id` 取值 | 所需权限 |
| - | - | - |
| `db-connections` | `connection_id` | `dbconn:assign`（作用于 `connection_id`） 同时需要：`dbconn:read`（作用于 `connection_id`） |
| `db-datasources` | `datasource_id` | `db_datasource:assign`（作用于 `datasource_id`） 同时需要：`db_datasource:read`（作用于 `datasource_id`） |
| `analysis-models` | `model_id` | `analysis_model:assign`（作用于 `model_id`） 同时需要：`analysis_model:read`（作用于 `model_id`） |

### 路径参数

**resource\_type** `string` *required*

资源类型，取上表中的值之一

**resource\_id** `string` *required*

资源 ID，取值见上表

**subject\_type** `string` *required*

`members`（用户组不能持有权限级别）可选值：`members`、`access-groups`。

**subject\_id** `string` *required*

成员的 `principal_id`

```bash cURL theme={null}
curl -X GET 'https://app.memorylake.cn/openapi/memorylake/admin/v1/access/db-connections/4c2da948e33c54f60ddd71e9b47076d4/permission-levels/members/89914667f74821b220f374d323f0f4b0/options' \
  -H 'Authorization: Bearer sk_xxxxxx'
```

### 响应

**data** `object`

**Permission Level Options 对象**

**can\_set\_none** `boolean`

调用方能否移除该成员的权限级别（级别 `none`）

**settable\_levels** `array`

调用方可为该成员设置的级别（不含当前级别）

**blocked\_reason** `string`

当前级别无法降低或移除的原因：`outranked` 表示该成员的级别不低于调用方；`last_manager` 表示该成员是最后一个可管理该资源的人；`no_permission` 表示调用方无法共享该资源

**current\_level** `string`

在此实例上为该成员设置的权限级别；未设置时省略。可选值：`read`、`write`、`manage`。

```json Success (200) theme={null}
{
  "success": true,
  "message": "Operation completed successfully",
  "data": {
    "can_set_none": true,
    "settable_levels": [
      "example"
    ],
    "blocked_reason": "outranked",
    "current_level": "read"
  }
}
```

### 错误

出错时返回 `success: false`、`message` 和 `error_code`。全部错误码见[错误码](https://docs.memorylake.cn/features/memorylake/api-reference/errors.md)。

| 状态码 | 含义 |
| - | - |
| `400` | 参数或请求体无效 |
| `401` | API Key 缺失、无效、已停用或已过期 |
| `403` | 该 Key 无权执行此操作 |
| `404` | 资源不存在 |
| `422` | 请求体或参数未通过校验 |
| `429` | 请求过多，请按 `Retry-After` 等待后重试 |
| `500` | 服务端错误 |
| `503` | 暂时不可用，请稍后重试 |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.