# 数据权限控制

接着，我们学习接口的数据权限控制，其核心是`@fromclaim`指令。

`@fromclaim`指令，又叫 [HTTP请求流程指令](/ji-chu-ke-shi-hua-kai-fa/api-gou-jian/api-zhi-ling.md#deng-lu-xiao-yan-zhi-ling) ，是注入指令的一种，适用于查询、变更和订阅OPERATION。

使用该指令后，有2个影响：

* **登录校验**：登录后才能访问当前接口，这部分和单独在设置中开启授权功能一致。
* **参数注入**：将登录用户的信息注入到入参中，保证该变量不被客户端修改。

<figure><img src="/files/XtLIT8lBMQSrAQLJfXTv" alt=""><figcaption><p>@fromclaim指令</p></figcaption></figure>

该指令用于不同类型OPERATION，有不同用途：

* **用于查询或订阅**：则保证只能查看当前用户拥有的数据，如获取登录用户的所有文章。
* **用于变更**：则保证创建的记录中包含登录用户的信息，如`post`表的`uid`。

该指令支持注入如下信息：

* USERID：用户UID
* EMAIL：用户邮箱
* EMAIL\_VERIFIED：邮箱是否验证
* NAME：用户姓名
* NICKNAME：用户昵称
* LOCATION：用户住址
* PROVIDER：供应商，例如authing、auth0

***

// <mark style="color:red;">todo</mark>

自定义信息注入

* ROLES：ROLES 是一个字符串数组，请在\[in, notIn]中使用。OIDC协议并未声明该字段，因此无法从OIDC供应商的获取用户端点拿到该字段。若想为该字段赋值，<mark style="color:red;">请参考 ...</mark>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fireboom.io/ji-chu-ke-shi-hua-kai-fa/shen-fen-yan-zheng/shu-ju-quan-xian-kong-zhi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
