Files
marqdo/ext/security/rbac.mq.md
T
cflmy 9331af78e2 release(2.8.0): 合入 CHANGELOG/README/发版说明/skills prove 任务;CI 链接指向 doc/releases
- CHANGELOG.md:v2.8.0 条目(中英双语);
- README.md:版本行 2.7.1→2.8.0 + 愿景第 6 条(知识可证明);
- doc/releases/v2.8.0.md:双语发版说明(亮点/用法/已知限制);
- skills/marqdo-dev/index.mq.md:新增 prove 任务(路径/目录模式/
  require_lean/json;参数用 + 行声明升参,check 与 narrative-ratio 通过);
- 设计文档 §12.5 标记已合入;发版链接统一指向 doc/releases/v2.8.0.md。
2026-11-18 10:29:26 +08:00

4.7 KiB
Executable File

markup, title, description, import
markup title description import
occlusion ext/security/rbac RBAC Resource (ADR 0007).
plugin sys table
lib/plugin.mq.md lib/sys.mq.md lib/table.mq.md

Role and permission data are explicit inputs to the native web checker. The security entry executes allow and deny cases without an identity provider. The can tool is associated with rbac rather than a receiver method because it reads only its arguments. Held wildcard and any-match needed permissions follow the native policy; do not reinterpret that as an all-permissions check.

_load

返回 类型 说明
result any No business value on completion; a missing native plugin reports the cause and exits this run.

Resolve and load the native web plugin before resource operations; missing binaries stop this run.

We retain p = Locate the installed native plugin.

  1. p We Load the native plugin required by this operation.

We [Print the prepared message](print(text="ext/security: native web plugin not found")). We End this run with the selected exit status. Return None.

rbac

返回 类型 说明
result any Offline helpers for role ⊥ permission. Prefer app.enable_rbac + gates for HTTP; use these for scripts/tests.

Offline helpers for role ⊥ permission. Prefer app.enable_rbac + gates for HTTP; use these for scripts/tests.

can

参数 类型 默认 说明
permissions any required Comma-separated permission names held by the current role or subject
needed any required Permission names required by the operation
返回 类型 说明
result any Return {ok, allowed} — whether held permission CSV includes any of needed (CSV). Held * allows all.

Use permissions, needed as the inputs for this operation.

Return {ok, allowed} — whether held permission CSV includes any of needed (CSV). Held * allows all.

We Load the native plugin required by this operation. Return [Return {ok, allowed} — whether held permission CSV includes any of needed (CSV). Held * allows all.](web_rbac_can(permissions=permissions, needed=needed)).

assign_role

参数 类型 默认 说明
url any required Resource connection URL; scheme selects the documented backend
username any required User name in the configured user store
role any required Role name within the selected user store
返回 类型 说明
result any Bind username (in web_users) to role name.

Use url, username, role as the inputs for this operation.

Bind username (in web_users) to role name.

We Load the native plugin required by this operation. Return [Bind username (in web_users) to role name.](web_rbac_assign_role(url=url, username=username, role=role)).

create_role

参数 类型 默认 说明
url any required Resource connection URL; scheme selects the documented backend
name any required Name registered or looked up by this operation
返回 类型 说明
result any Create a non-system role; returns {ok, id, name}.

Use url, name as the inputs for this operation.

Create a non-system role; returns {ok, id, name}.

We Load the native plugin required by this operation. Return [Create a non-system role; returns {ok, id, name}.](web_rbac_create_role(url=url, name=name)).

set_role_permissions

参数 类型 默认 说明
url any required Resource connection URL; scheme selects the documented backend
role any required Role name within the selected user store
permissions any required Comma-separated permission names held by the current role or subject
grantable any "" Permission catalog limiting which permissions may be granted
返回 类型 说明
result any Replace permissions on a non-system role (CSV). grantable restricts grants (anti-escalation); empty = full catalog.

Use url, role, permissions, grantable="" as the inputs for this operation.

Replace permissions on a non-system role (CSV). grantable restricts grants (anti-escalation); empty = full catalog.

We Load the native plugin required by this operation. Return [Replace permissions on a non-system role (CSV). grantable restricts grants (anti-escalation); empty = full catalog.](web_rbac_set_role_permissions(url=url, role=role, permissions=permissions, grantable=grantable)).