Docs
Permissions
Groups, permission strings and the can() check that guards menus, pages and API routes of OSAGI Console, and how to manage access.
Rights are granted to groups, and a user gets the union of the rights of all their groups. The same can() from lib/auth/perms.ts decides on the server, in the API routes and in the menu.
Permission strings
A right is a string module:action:scope, for example requests:view:own or sla:view:all.
| Part | Values |
|---|---|
| Module | requests, support, chat, sla, workload, leads, marketing, docs, access, and ops for Operations |
| Action | view reads, edit creates and changes records, manage works with everyone's records and the module settings |
| Scope | own: records of the user; all: every record |
How can() reads them:
manageincludesedit, andeditincludesview.allcovers a check forown; a check without a scope is met by any scope (menus and buttons use it).- An owner (
*) may do everything. - Rows with an unknown module, action or scope are dropped, so a typo never widens access.
What each action opens
| Module | view | edit | manage |
|---|---|---|---|
requests | The journal and request cards: own for the user's requests, all for everyone's; approvers named on the Access screen decide on the requests they can see | Create requests and drafts | With all: change the status of any request |
support | The user's tickets | Open tickets, write messages, add attachments; with all: the team queue | Same as edit |
chat | The chat in the menu | Talk to the assistant, keep sessions and assistant memory | Other people's sessions and the Assistants screen (/consultants) |
sla, workload, leads | With all and the open section: the report screen and its API | No extra actions | No extra actions |
marketing | With all and the open section: the Marketing screen | Create tasks and act on news and finds | Same as edit |
docs | Read the docs, search and recent changes | Same as view | With all: edit pages and review AI suggestions |
access | Nothing on its own | Nothing on its own | With all: the Access screen |
ops | With all and the open Operations section: every Operations screen and its API | With all: switch alert rules, acknowledge alerts, run endpoint actions | With all: decommission endpoints |
The AI cost of a request is shown to its author and to people with access:manage:all or requests:manage:all; for everyone else the server leaves it out.
Sections
A section is a console screen opened for a group, separate from the data right: the assistant may need a module's data for a user who should not see its screen. A report page opens only when both hold: the user has <module>:view:all AND the section is enabled for one of their groups (screenAllowedFor() in lib/auth/screens.ts). An owner sees every section.
Where the checks run
| Check | Used by |
|---|---|
requireUser(req, { module, action, scope }) | Every page and route handler: 401 without a session, 403 without the right |
requireModuleApi(req, module) | Report APIs: the data right AND the open section |
guardModulePage(headers, module) | Report pages: sends to sign-in or shows a "no access" screen |
runAsUser(need, fn) | Server actions, such as saving a docs page |
config/nav.ts and lib/shell/nav.ts | The menu, filtered with the same can() |
Warning
Hiding a menu item is not protection. Every page, route handler and server action checks again on the server.
Managing access
The Access screen (/access, needs access:manage) edits groups, their rights in a matrix, the sections they open and the approvers of requests.
The demo user is an owner, so every screen is open. To see the console as a restricted user, return a smaller set from permsOf() in lib/auth/identity.kit.ts:
import { mergePerms } from "./perms";
const ANALYST = mergePerms( [ { action: "edit", module: "requests", scope: "own" }, { action: "view", module: "sla", scope: "all" }, ], false, ["requests", "sla"]);With a real loader, wrap it in createPermsCache(): rights are cached for 60 seconds, and invalidatePerms() drops the cache after a change.