App without tenancy
Not every product has tenants. An internal back-office tool might simply have admins, editors and viewers. wardn handles that with no scopes at all.
The policy
Section titled “The policy”permissions: article:view: View articles article:edit: Edit articles article:publish: Publish articles user:manage: Manage users
roles: admin: ["*"] editor: [article:view, article:edit, article:publish] viewer: [article:view]Everything happens at global
Section titled “Everything happens at global”w.System().Assign(ctx, "user-001", "admin", wardn.Global)
r.With(w.Require("article:publish")).Post("/articles/{id}/publish", publish)Routes need no ScopeFrom: without one, every check happens at global, where these assignments live.
Growing later
Section titled “Growing later”If the tool later serves several departments, add a scope type and assign roles at departments instead. Existing global assignments keep working everywhere.
scopes: department: {}Questions about this page?
Ask below, point out something wrong or unclear, or suggest an improvement. Reading needs no account; to post, sign in with GitHub.