tachybase_todo/docs/en-US/api/acl/acl-resource.md
chenos a6eebb940f
feat: update docs (#990)
* feat: improve code

* feat: update docs

* feat: update docs

* Update index.md

* Update features.md

* Update when.md

* Update contributing.md

* Update translations.md

* feat: clean up

* Add files via upload

* Update the-first-app.md

* Update plugins.md

* Update a-b-c.md

* Update blocks.md

* feat: update docs

* Add files via upload

* Update charts.md

* feat: update navs

* Update index.md

* Update index.md

* Update features.md

* Update index.md

* Update docker-compose.md

* Update create-nocobase-app.md

* Update git-clone.md

* Update contributing.md

* Update translations.md

* Update plugins.md

* Update the-first-app.md

* Add files via upload

* Update charts.md

* Update charts.md

* Update a-b-c.md

* Update collections.md

* Update menus.md

* Update menus.md

Co-authored-by: Zhou <zhou.working@gmail.com>
2022-10-31 11:52:17 +08:00

58 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ACLResource
ACLResourceACL 系统中的资源类。在 ACL 系统中,为用户授予权限时会自动创建对应的资源。
## 类方法
### `constructor()`
构造函数
**签名**
* `constructor(options: AclResourceOptions)`
**类型**
```typescript
type ResourceActions = { [key: string]: RoleActionParams };
interface AclResourceOptions {
name: string; // 资源名称
role: ACLRole; // 资源所属角色
actions?: ResourceActions;
}
```
**详细信息**
`RoleActionParams`详见 [`aclRole.grantAction`](./acl-role.md#grantaction)
### `getActions()`
获取资源的所有 Action返回结果为 `ResourceActions` 对象。
### `getAction()`
根据名称返回 Action 的参数配置,返回结果为 `RoleActionParams` 对象。
**详细信息**
`RoleActionParams`详见 [`aclRole.grantAction`](./acl-role.md#grantaction)
### `setAction()`
在资源内部设置一个 Action 的参数配置,返回结果为 `RoleActionParams` 对象。
**签名**
* `setAction(name: string, params: RoleActionParams)`
**详细信息**
* name - 要设置的 action 名称
* `RoleActionParams`详见 [`aclRole.grantAction`](./acl-role.md#grantaction)
### `setActions()`
**签名**
* `setActions(actions: ResourceActions)`
批量调用 `setAction` 的便捷方法