Access control answers a simple question: who can do what, to which data, and in which scope? In a real application, that decision is not just a role dropdown. The server has to identify the caller, resolve the organization and project, find the requested data source inside that project, apply the relevant policy, and then perform the operation without crossing a tenant boundary.
Role-based access control (RBAC) helps by separating a person’s role from the permissions associated with it. That separation makes policy easier to review and change, but it is only one part of authorization. Scope, API credentials, endpoint policy, validation, and audit history all matter too.
Roles are bundles; permissions are individual grants
A permission represents one capability. In Dashier’s RBAC core, source-level grants use keys such as members.read, members.create, members.update, and members.delete. The key says what can happen to which source; it does not identify the person who receives the grant.
A role is a named set of capabilities. Dashier has the system roles Owner, Admin, Editor, and Viewer, and also supports custom roles with explicit grants. The system-role rules are intentionally simple: Owner and Admin have management-level access, Editor can work with records, and Viewer is read-only. Custom roles are checked against their grants instead of being treated as a rank in a hierarchy.
That distinction is important in code. Do not scatter checks such as “Editor is higher than Viewer” through route handlers and assume the ordering is the policy. Resolve the caller to a role and explicit grants, then test the exact operation. The core also keeps compatibility with the older {source}.write key by treating it as create and update; new granular policies can use the verb-specific keys directly.
Model authorization as subject, scope, resource, and action
A useful decision model is:
subject + scope + resource + action = decision
The subject is a signed-in member or an API key. The scope is the organization, project, and data source. The resource may be a collection or a record. The action is an operation such as read, create, update, or delete.
Dashier’s REST API uses /api/v1/{data-source-slug} for list and create, and /api/v1/{data-source-slug}/{record-id} for get, update, and delete. Those routes resolve a method-specific endpoint policy before the shared record handlers run. A read check should not silently become a write or delete check just because the caller has a valid credential.
The separation also makes access matrices concrete. members.read and members.update describe different capabilities, and a role that can update records does not automatically need delete access. For custom dashboard roles, test the exact grant rather than relying on a display name such as “almost Admin.”
Keep organization, project, and source scope in every lookup
Dashier’s data hierarchy is organization → project → data source → record. A source slug is unique within a project, not globally. Resolving a source by slug alone would make it possible to select the wrong project’s source, so the API resolver first establishes the organization and project, then finds the source with both project_id and the requested slug.
The same rule applies to membership. A session caller is checked against organization membership and, when project IDs are assigned, against the allowed projects. A member source allowlist can narrow access again. These checks restrict where a caller may work; they do not replace the permission or endpoint-policy check that decides what the caller may do.
A practical request path is:
- Resolve the organization and project from the authenticated session or a validated API key.
- Confirm that the project belongs to that organization.
- Resolve the source through the project, not by slug alone.
- Apply project and source membership restrictions.
- Load the policy for the requested HTTP method and evaluate the caller’s access mode and credential scope.
- Run the record operation with the resolved source and organization context.
Record queries should keep the source constraint at the data-access layer too. Route-level authorization is not a substitute for filtering reads and writes by the resolved source and organization context.
Treat API keys as integration identities
An API key is not a human role. It is a project credential attached to an organization and carries its own read, write, or admin scopes. Dashier accepts a key in either the x-api-key header or an Authorization: Bearer header. The server hashes the presented value, rejects unknown or revoked keys, and resolves the key’s project before looking up the requested source.
The current API scope behavior is deliberately narrow: GET needs read (or a broader scope), while non-GET methods need write (or admin). For a Role endpoint, an API caller must have the admin scope; it does not inherit a human member’s dashboard role. This is a separate policy path from custom role grants in the dashboard.
Keep the raw key out of source control, browser bundles, URLs, and client-visible form code. The implementation shows the secret only when the key is created and stores its hash for later lookup. Revoke keys that are no longer needed, and issue the smallest scope that fits the integration.
Endpoint policy is separate from team RBAC
Each generated API method has an endpoint policy with a mode of Public, Authenticated, or Role. The policy also controls whether the endpoint is enabled, whether it is exposed through the API channel, and its per-minute rate limit.
- Public requires no credential. Use it only when the data is intentionally public.
- Authenticated requires a signed-in session or an API key with the method’s required scope.
- Role requires an allowed member role for session callers. Owner is treated specially in the current resolver; API callers need an admin-scoped key.
A disabled route or an API-hidden route is rejected before a credential grants access. A Viewer’s dashboard role and a public API endpoint describe different audiences, so neither should be used as a shortcut for the other.
The rate limiter is part of this API-resolution path. It keys requests by API key when one is present and otherwise by the request’s forwarded IP identity, using the policy’s configured limit. That limits traffic; it is not a replacement for authorization or input validation.
Make missing policy fail closed
Deny-by-default means incomplete configuration does not become access. In the API resolver, a missing policy falls back to an authenticated, enabled, API-allowed policy with a configured default limit, while explicit disabled or API-hidden settings are rejected. Access mode and credentials are still evaluated afterward.
Keep the decision branches explicit and validate unknown values. A policy check should distinguish “no credential,” “invalid or revoked key,” “key lacks the required scope,” and “member role is not allowed,” while returning only the detail an untrusted caller needs. Internal logs can retain the reason useful to operators without disclosing tenant or policy information.
Do not put authorization only in a UI component. The API route, shared record operation, and database access path all need the relevant organization and source constraints. Request bodies still need server-side validation; a caller who can reach a source is not thereby allowed to submit arbitrary field values.
Build the access matrix before the permissions screen
Write down the combinations that the product actually supports: role, project, source, operation, endpoint mode, and API channel. For example:
| Role or caller | Read records | Create/update | Delete | Manage roles and policies |
|---|---|---|---|---|
| Owner | Yes | Yes | Yes | Yes |
| Admin | Yes | Yes | Yes | Yes, subject to product rules |
| Editor | Yes | Yes | Yes in current system-role behavior | No |
| Viewer | Yes | No | No | No |
| Custom role | Only with the matching grant | Only with matching create/update grants | Only with the matching delete grant | Only where the application grants it |
| Read-scoped API key | GET on an Authenticated endpoint | No | No | No |
The table is a starting point, not a promise that every endpoint uses the same audience. Add project and source scope to each case. A Viewer in one project is not automatically a Viewer in another, and a key from one organization must not select a source from another through query parameters.
Use the matrix as a test fixture. For every allowed action, add the adjacent denied action: a Viewer should be able to read an allowed source but not update it; a read-scoped key should pass GET and fail a write request; a custom role with members.read should not gain members.update.
Test the boundary, not only the happy path
Authorization tests should cover both the decision and the data lookup. Important cases include:
- A session member restricted to one project cannot read a source in another project.
- A source slug in Project A cannot resolve a same-named source in Project B.
- A key from Organization A cannot select Organization B’s source through query parameters.
- A source allowlist blocks an unlisted source for a session caller.
- A revoked or unknown key fails before the record operation runs.
- A disabled or API-hidden endpoint fails regardless of the caller’s role.
- A role-protected endpoint rejects a key without
adminscope. - An unknown role, method, or missing membership does not silently broaden access.
Then test record behavior after authorization. List, create, update, and delete use different route shapes and policies. Create and update pass through field, reference, and uniqueness validation; record mutations write audit events with organization, actor, source, entity, and old/new values where applicable. Those checks are part of a safe authorization boundary, not optional polish.
Use audit history to explain changes
An audit log should answer who changed what, where, and when. Dashier records create, update, and delete activity with organization and source context, and policy changes are also written to the audit log by the management route. Raw API keys should never be copied into audit values.
Audit history helps investigate an unexpected denial, confirm that a role or policy change took effect, and review a permission expansion. Protect the log itself: the people who manage records should not automatically be able to erase the evidence of their changes.
Where Dashier fits
Dashier provides organization and project boundaries around data sources, records, generated tables and forms, REST endpoints, roles, API keys, endpoint policies, and audit history. Its RBAC model is useful when those boundaries are explicit: team members use system or custom roles, while integrations use project API keys with separate scopes.
The important boundary is that Dashier’s dashboard RBAC and generated API policy are related but not interchangeable. Custom source grants govern the dashboard’s record permissions; API callers are evaluated through API key scopes and the endpoint’s Public, Authenticated, or Role mode. Keep those decisions separate in product requirements, implementation, and tests.
