Skip to content

Add token role and merge endpoints - #287

Merged
BobAnkh merged 2 commits into
devfrom
role-auth
Oct 24, 2026
Merged

BobAnkh merged 2 commits into
devfrom
role-auth

Conversation

@un-lock-able

Copy link
Copy Markdown

Tokens now carry a required role claim (1 = user, 2 = worker, 3 = agent), and the four auth middlewares are replaced by one, auth_middleware::<ROLES>. A route lists the roles it accepts (USER, WORKER, AGENT); a token with any other role gets 403 before the handler runs. Handlers for a single role still extract AuthUser / AuthWorker. Handlers open to several roles extract AuthIdentity and match on it. System admin is no longer part of the middleware: /admin layers a separate admin_middleware that reads AuthUser.admin.

Agent hooks, coming in the agent PR, run before any task is fetched, so they have no task uuid to name an attachment by. Workers used to name an attachment by task uuid, and the coordinator looked up that task's group. To give tasks and hooks one attachment endpoint, a worker now names the group directly: WorkerTaskResp carries group_name. The coordinator serves the download only while the worker is running a task of that group. Before, any worker token could download any attachment, given any task uuid of its group.

@un-lock-able
un-lock-able requested a review from BobAnkh October 23, 2026 09:00

@BobAnkh BobAnkh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is good overall but a little bit confused at some points. Please explain them.

Comment thread netmito/src/service/auth/mod.rs Outdated
@un-lock-able
un-lock-able requested a review from BobAnkh October 24, 2026 15:08

@BobAnkh BobAnkh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@BobAnkh
BobAnkh merged commit 515f450 into dev Oct 24, 2026
11 checks passed
@BobAnkh
BobAnkh deleted the role-auth branch October 24, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants