taskflow: task read roles and caller-filtered actions
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 12/100
Hướng nghiên cứu
Start with the proposal's design rather than code: it spans the task template schema, the gorm task store (new task_roles table written in the same transaction as the task row), GetTaskRenderInfo and GetAllTasks, renderer.Facts, and ZoneViewAssembler.Assemble. Work is already under way in linked PR 375, so review that first. Done means the proposal's access_roles and Commands filtering are implemented as specified, with the breaking changes handled.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
taskflow has no way to say who may open a task, or to show a caller only the actions they may take.
- Who may open a task.
GetTaskRenderInfoandGetAllTasksreturn any task to any caller. A host that wants to gate a task, or list only the caller's tasks, has nothing in the task record to match against. It ends up keeping its own task-to-role mapping outside taskflow, and that mapping can drift from the templates. - What a caller may do. The
PRE_RESUMEauthz extension decides on the server which commands a caller may issue. The zoneview renderer, however, keeps a handle whenever its command is legal in the current state. A caller who may see a section but not act on it still gets its actions, which the server rejects only when they submit.
Proposed Solution
Keep the policy in the host. taskflow stores what the templates declare and forwards what the host has resolved. The two parts are independent and ship as separate PRs.
-
Task read roles (#375). Task templates already carry
read.roles(#377), an optional list of opaque role strings:{ "id": "apply", "workflow_id": "apply-flow", "render_config_id": "apply-render", "read": { "roles": ["applicant", "reviewer"] } }StartTaskcopies them to the task asTaskRecord.ReadRoles. The gorm store writes them to atask_roles (task_id, role, case_id)table in the same transaction as the task row, so a task never exists without its roles. A host gates and lists tasks by joining its own record of who holds each role on(case_id, role). The roles never change after the task starts. A template with no read roles writes no rows. -
Caller-filtered actions (#378).
renderer.FactsgainsCommands map[string]bool: the commands the caller may issue, which the host resolves from the same rules its authz extension enforces. The zoneview renderer keeps a handle only if its command is legal in the state and allowed for the caller, so a visible section with no allowed actions renders read-only. nil means nothing is filtered.ZoneViewAssembler.Assembletakes aCaller{Claims, Commands}.
What each mechanism decides:
| Question | Decided by |
|---|---|
| Can the caller open the task? | read.roles, recorded in task_roles (#375) |
| Can the caller see a section? | visibleWhen.requireClaim (unchanged) |
| Can the caller take an action? | the commands authz allows, enforced on submit and reflected in Facts.Commands (#378) |
Breaking changes: hosts must create task_roles before upgrading (#375), and Assemble's signature changes (#378). Templates need no change.
Alternatives
- A separate, required
access_rolesfield on the task template. Dropped once #377 addedread.roles: two lists of who may read a task would drift from each other. - Roles with a permission each (e.g.
{"role": "read&write"}). Rejected. Whether a role may write is already answered per command by the authz rules, and a second answer would drift from them. It's also coarser: "write" can't tell approve apart from reject. - Roles as an array column on the task row. Rejected. Listing a caller's tasks needs a join and a B-tree index on
(case_id, role), which a row per role gives directly, along with idempotent inserts through the primary key. - Keep the task-to-role mapping only in the host. Possible, but the host would have to re-read templates and keep its copy in step with the task's manifest version. Recording roles when the task starts, in the same transaction as the row, avoids both.
- Ngôn ngữ chính
- Go
- Star
- 6
- Fork
- 8
- Merge trung bình
- 21 giờ 36 phút
- Pull request đã merge (30 ngày)
- 42
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của OpenNSW/core
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
payment: test fixtures hardcode real gateway names (govpay/lankapay) instead of generic placeholdersĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
nsw-sl cleanup Type/Improvement
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
Maintainer thường phản hồi trong vòng 1 ngày
-
remote: let the host inject a logger, and log with one consistent policyCó thể đã có người làm @mushrafmim đã nhận 5 ngày trước. Đang mởType/Improvement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 22/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
agent-research-finding chore
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
jordansmall/spindrift#7370 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
☢️ Bug v3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
The repo's gates check is clean and runs need no swapsCó thể đã có người làm @turbot-agent-fleet đã nhận hôm nay. Đang mởagent:ready
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
turbot/tailpipe#677 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-kind needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 2 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
crossplane-contrib/provider-keycloak#806 ·
Maintainer thường phản hồi trong vòng 1 ngày