Users, roles and permissions
Roles grant permissions to users and API clients at entity, action and field scope.
For the team workflow, see Give people the access they need.
Vox roles grant colon-separated permissions to users and API clients. Entity permissions include Read, Create,
Edit, Edit:{scope}, Action:{action}, Delete, Import:{import}, and Publish. A shorter grant includes its child
permissions, so Product:Edit permits editing every owned Product field in every
permission scope and * permits everything.
Draft saves do not bypass ordinary action permissions. A user needs the same create or edit permission whether the
result is saved as a draft or published immediately. Publishing additionally needs the separate Product:Publish
permission, which also controls scheduling, cancelling a schedule, reverting, resolving conflicts, and unpublishing
Product drafts. Deleting a published Product needs it too, besides Product:Delete, also when it's deleted from its
draft, since that deletes the published Product. This lets an editor prepare content while a publisher controls what
becomes live. Only authored entity types have drafts and the
Publish permission; an entity type that isn't authored is saved immediately with its create or edit permission.
With content releases, vox:ContentReleases permits managing them and is required when saving an entity action or a cell into
one. That save still requires the ordinary entity permission, and publishing the release requires {EntityType}:Publish
for every entity type it contains.
Reading drafts and releases needs permission too, since they aren't published. Reading in a release, with
scope=release:{releaseId}, needs vox:ContentReleases. Reading drafts, with scope=draft or the content
endpoint, needs the entity type's publish permission or the permission of one of its actions, eg its create or edit
permission. A draft within a release, scope=release-draft:{releaseId}, needs both. The read permission alone only
reads published content. The entity types endpoint tells with canReadDrafts whether the signed-in person may read an
entity type's drafts, and the admin UI reads what's published instead where they may not. A country manager with only
Market:Read then picks a store's market from the published markets while editing in the draft, rather than getting
an error, and sees the published markets in their list. Selecting a member of an application's restricted context type needs the permission the
context type is configured with, see Contexts.
The authoring scopes have preview permissions, which allow reading them without any permission to edit, publish or
manage them: vox:Preview:Drafts for the draft and vox:Preview:Releases for releases, and both for a draft within a
release. Every restricted application context type has one too, vox:Preview:{ContextType}, eg
vox:Preview:StaffExperiment. They suit a delivery application that publishes the preview of its sources, see
Synchronized contexts.
The system permissions are about Vox itself rather than an entity type, and the admin UI shows its screens for them only to those who have them:
| Permission | Permits |
|---|---|
vox:Schema | Inspecting the model and managing its migrations, and following the background work. |
vox:Perspectives | Creating, changing and deleting perspectives, and giving users their default perspective. Listing them is open to everyone signed in. |
vox:Attributes | Creating, changing, renaming and deleting attributes and their templates. Reading them is open. |
vox:Subscriptions | Managing the subscriptions to entity changes. |
vox:Audit | Searching the history of every entity type. |
vox:Calculations | Starting recalculations. |
vox:ReadSource | Reading the source that the build embeds: the source of the deployed calculations, eg through an MCP server, and the model source that Studio reads. |
vox:ProposeChanges | Proposing changes to the application's source in Studio: writing drafts with its forms and assistant, sending them for review, and reading the drafts that others have sent. It's used together with vox:ReadSource, and only by signed-in users with an email address. Listed only in a host that registers Studio and embeds model source. |
vox:ApplyChanges | Applying the changes proposed in Studio, abandoning an Apply that keeps failing, turning down applied changes that haven't gone live, and deleting anyone's proposals. Applying authorizes what the source change target does, eg a commit and a push, or a pull request. Listed only in a host that registers Studio and embeds model source. |
vox:ApplySetupChanges | Applying proposed changes to the application's setup, eg Program.cs or an extension method of IServiceCollection, together with vox:ApplyChanges. Listed only in a host that registers Studio and embeds model source. |
vox:Profiler | Turning the profiler on and off, and downloading and deleting its traces, which can contain entity ids and the names of users. |
vox:Nexus | Using the Nexus admin and its API: watching, enabling, disabling, pausing and running jobs and queues, and retrying their messages. Listed only in a host that serves the Nexus admin. |
API clients receive roles like users. Each client also has a default selection and a default scope.
DefaultSelection holds application contexts, in the syntax of context, eg language:sv, and a request's context
still wins for the context types it selects. DefaultScope is the scope of the client's reads, eg draft for an
ordinary draft preview or release:autumn for a release preview, unless a request names its own scope. Writes never
use it: they write in the request's explicit scope, or in published content. The client's roles need the permissions
above to read its defaults.
The permissions of the model
GET api/permissions lists every permission the model has, whatever the caller may do itself, so that whoever edits
roles can grant what they can't use: per entity type its read, create, edit, delete and publish permissions, its edit
scopes (of owned fields, the default scope when there are others, and index-backed relations), custom actions,
imports, assessments reported from outside, sensitive data classifications, restore, entity log, sanitizers and purge,
and whether a :My grant can match anything of it. It lists the system and preview permissions above, and the context
types a grant can be limited to, with which of them limit each entity type: those it's a member of, and those it varies
on, and whether users and API clients are members of each, so a grant can be limited to their own. It describes the model, not data, so its size follows the number of entity types, actions and imports. It needs
VoxRole:Read, and without user management it isn't found.
The admin UI edits a role's grants with it: a matrix of every entity type and its permissions, the finer permissions and
context limits of a type when its row is expanded, the system permissions, and every stored grant in words. A grant is
shown as included when a broader one includes it, eg Product:Read by *:Read.
Saving a role doesn't check its grants against the model. A grant that matches nothing, eg Prodcut:Read, the edit scope
of a removed field, or a limit to a context type that neither limits the entity type's memberships nor its values, is
stored and grants nothing. The admin UI flags it with the reason, so that it can be removed, rather than refusing the
role: a role with a grant of a removed scope stays editable, and a grant for an entity type that only another instance
has yet, eg during a rolling deployment, is kept. A renamed entity type is rewritten in the grants by its migration; a
removed or renamed edit scope, action or import isn't.
Principals and roles
A principal is the identity responsible for a request or background change. It may be a user, an API client or the system principal used by calculations and scheduled work. Stored history, change causes and entity logs retain that identity so a change remains attributable after the request has ended.
When Vox owns users, roles and API clients, they are entity types with the same history, actions and permissions model as application data. A user receives the union of the permissions granted by their roles. An API client authenticates with its own secret and receives its configured roles, which keeps integrations separate from human identities.
The application selects its concrete user entity explicitly. It may use the built-in VoxUser, or implement
IVoxUser to add domain fields and editor metadata:
[VoxRouteName("users")]
[Display(Name = "Users", GroupName = "Access", Order = 2000)]
public class ApplicationUser : IVoxUser
{
// IVoxEntity properties omitted.
[Required, EmailAddress, MaxLength(256), VoxFilterable, VoxSortable, VoxUnique]
public string Email { get; set; } = "";
public string? Name { get; set; }
public bool IsEnabled { get; set; } = true;
[VoxRelation(Name = "roles", InverseName = "users")]
public List<VoxReference<VoxRole>> Roles { get; set; } = [];
public List<VoxExternalIdentity> ExternalIdentities { get; set; } = [];
public string? Department { get; set; }
}
builder.AddVox(options => options.UseUsers<ApplicationUser>());
The users are the people who sign in, not the customers of a shop: customers, buyers or members are business data in an
entity type of their own. The admin UI puts the users type, roles and API clients in its Administration menu, under
Access, since few people need them every day, whatever their section; the users type is found by userEntityType in
the account response, and roles and API clients by their entity type names, which a subclass keeps.
The email and role metadata shown above is required because the normal model scanners provide authentication queries,
uniqueness, sorting, and relations. Only the configured concrete user type is registered. Authentication responses
remain explicit sign-in/account DTOs; they do not serialize every application-user field. Credentials are stored
by the user entity type's stable key and the user ID, so renaming the user type with RenameEntityType keeps every
password and API client secret.
Roles and API clients are built-in entity types whose semantics Vox owns, the grants of a role and the keys of a client, so they have no interface of their own. An application that needs fields of its own on them extends the built-in classes and registers the subclasses:
public class ApplicationRole : VoxRole
{
public string? CostCenter { get; set; }
}
builder.AddVox(options => options.UseUsers<ApplicationUser>(users => users
.UseRoles<ApplicationRole>()
.UseApiClients<ApplicationApiClient>()));
The subclass is the entity type of roles. It keeps the entity type name and route name of VoxRole, so permissions
such as VoxRole:Read, the route vox-roles and stored roles don't depend on the application's class name, and a
reference to VoxRole, eg Roles of a user, resolves to it. Only one class can extend each built-in one: Vox rejects
a second at startup.
An application can use Vox-managed credentials or connect users to an external identity provider. External identities map an issuer and subject to a Vox user, while role ownership can remain in Vox or come from trusted claims. The authorization model below is the same whichever component performs sign-in.
The first time someone signs in with the provider, their identity is linked to the Vox user with their email, but
only if the provider says the email is verified with an email_verified claim. Otherwise anyone who could sign in
with someone else's address, eg in a provider that lets users edit their email or that signs in several
organizations, would become that user. A username is never used, even if it looks like an email. For a provider
whose emails are all verified and managed by your organization but that doesn't send the claim, eg a single-tenant
directory, set LinkUnverifiedEmails in UseExternalAuthentication.
A principal also has preferences, eg which sections of the admin UI's rail are collapsed, so that a UI is the same on
every device. GET api/account/preferences returns them by their keys, and PUT and DELETE api/account/preferences/{key} set and remove one, as any JSON of up to 64 kB. They're removed with the user or API
client. The admin UI keeps pins, saved filters and each person's
own changes of its presentation there, eg the columns
they added to a list; those changes are made through api/account/presentation, which checks them against the model.
Without user management, Vox has no authentication boundary of its own and every principal is allowed. That mode is
useful inside a trusted application boundary, but exposing the API requires the host application to establish an
equivalent boundary. The preferences then belong to whoever the host says is signed in, or to one shared anonymous
principal when the host has no authentication, so pins, saved filters and personal changes of the admin UI are shared
by everyone who uses it.
Perspectives
A perspective is a particular interest that someone looks at entities with, eg Content, Buying, Pricing or Warehouse.
Every perspective sees the same entities and values, but the admin UI hides the fields and entity types that don't
matter to it. Developers mark fields and entity types with topics in code, with [VoxRelevantTo], and an
administrator makes perspectives out of them at runtime; see
topics and perspectives for the topics and what a
perspective hides.
Perspectives exist only with Vox's user management (UseUsers), since they're for the admin UI and its signed-in
users. Without it there are no perspectives and no switcher, and topics in code have no effect. A perspective isn't an
entity and the user has no perspective field, so an application's own user type doesn't need to know about them:
perspectives and the users' defaults are kept in a store of their own, in the Entity Framework database.
- Making perspectives. The Perspectives screen in the admin UI's Administration menu creates, renames and
deletes them, and picks their topics from every topic used on a field or entity type of the application. A topic
that no field or entity type has any more, eg after it was renamed in code, is highlighted there; it doesn't break
anything, it simply matches nothing. Changing perspectives needs
vox:Perspectives. - A default per user. An administrator with
vox:Perspectivesgives a user a default perspective in the "Default perspective" section of the user's page, next to their roles, so onboarding a new buyer happens in one place. It isn't part of the user, so it isn't in their history, and an administrator who may edit users but not perspectives sees it but can't change it. - Switching. Anyone signed in can switch to any perspective, or to All fields, which shows everything, from the account menu. The browser remembers the choice in its local storage, so it survives a reload and a new tab; a browser that remembers nothing starts in the user's default, or in All fields. Someone looks from one perspective at a time; for both Buying and Content, make a perspective with both lists of topics.
- Deleting. Deleting a perspective removes the defaults that point at it, and those users start in All fields. Deleting a user removes their default.
The API serves them at api/perspectives: every signed-in user can list them, with every topic of the application,
and creating, changing and deleting them, and setting a user's default at api/perspectives/users/{userId}, need
vox:Perspectives. GET api/account/me includes the signed-in user's default perspective. API clients have no
perspective, and the entity API never reads from one; the MCP server reads from the user's default, see
Connect AI agents with MCP.
A perspective is not a permission. Permissions decide what someone may see and change; a perspective decides what they're interested in, on top of their permissions. A field someone isn't permitted to read stays hidden in every perspective, and a field hidden by a perspective isn't protected: it's still in the API's responses. To keep a field from someone, use permissions and sensitive fields.
Grants limited to contexts
A grant without limits applies in every context: an administrator role is { "permission": "*" }, and a new market
or brand needs no role change. A grant can be limited to fixed contexts, eg
{ "permission": "Product:Edit:Content", "contexts": { "Language": ["sv"] } }, or to the principal's own contexts:
{ "permission": "Product:Read", "ownContexts": ["Brand"] }
The principal's own contexts are those its user or API client is a member of, declared like any other membership, see Context membership:
[VoxMemberOf(typeof(Brand), Through = ["brands"])]
public class ApplicationUser : IVoxUser
{
// ...
[VoxRelation(Name = "brands")]
public List<VoxReference<Brand>> Brands { get; set; } = [];
}
One "Brand manager" role then serves every brand: a user who refers to Acme reads and edits Acme's products, and
assigning a brand is done on the user. An API client gets memberships the same way, through an application subclass of
VoxApiClient. Only memberships declared with [VoxMemberOf] count, so a "favourite brands" relation grants nothing
unless the model names it in Through; memberships that only come from a user's own varying values, eg a profile text
per language, don't make a context type usable as the user's own.
- Every limit must hold.
contextsandownContextscombine like other limits: withLanguage: ["sv"]andownContexts: ["Brand"], the grant changes the Swedish texts of the person's brands' products. Fixed ids and the person's own of the same context type intersect:contexts: { "Brand": ["acme"] }withownContexts: ["Brand"]applies to Acme only for those who are members of it. A grant that's also:Myneeds both: "my products, in my brands". - No own contexts, no grant. A principal that is a member of none of its own contexts gets nothing from the grant, never every context.
- Changes follow the memberships. Vox resolves the own contexts when it reads a principal's grants, which it caches per principal. Changing a user's brands takes effect once the processing has stored the user's new memberships, which publishes a change of the user and clears the cache on every instance; until then, eg a moment after the save, the old brands apply.
- A limit to a context type an entity type isn't in applies nowhere, for reads as for changes:
Customer:Readlimited to brands reads no customers when customers aren't members of Brand. A role that should read customers grantsCustomer:Readwithout a limit. A context type the entity type only varies on is different: the limit is about the values, and every entity is read. - An empty list is refused. A role with
"contexts": { "Brand": [] }isn't saved; removeBrandto grant in every brand.
Users are gated by a selected context like any member type: with a brand selected in the admin UI's context picker, the users list only shows the users in that brand. Signing in and permission checks read the user without the selection, so selecting a context never takes rights away.
A brand manager may only create products in their brands, so a new product without a brand is refused. An
IVoxCreateDefaults<Product> can start the admin UI's create form in the person's brand, with
GetOwnContextIdsAsync<Brand>(), see
Values a new entity starts with.
My permissions
Append :My to an entity permission to limit it to entities owned by the current principal. For example,
Order:Read:My reads only the current customer's orders, and Order:Action:Cancel:My can cancel only their orders.
Vox requires both the old and new state of an update to be in scope, so an update cannot transfer an entity out of the
principal's scope.
Applications connect a principal to its entity with IVoxPrincipalEntityResolver<TEntity>. A relation annotated with
[VoxMyRelation] extends that ownership by one direct hop:
public class Order : IVoxEntity
{
[VoxMyRelation]
public required VoxReference<Customer> Customer { get; set; }
}
On a transient entity type, eg a cart, a [VoxMyRelation] must
also be declared InverseIndexed = true, since the carts a client may read are found through the inverse index of the
relation, and a query with a restricted read scope can't have other conditions or sorts.
There is no recursive or general row-policy language. The limited shape keeps authorization understandable and lets
storage providers apply it before counting and paging. IVoxEntityAccess exposes the same read scopes and checks to
custom endpoints.
When an application has no :My grants, principal entity resolvers are not called. Entity types without
[VoxMyRelation] do not add ownership relation fields to search documents or mappings.
Sensitive fields
A sensitive field is a field with a read permission of its own. Use it for any field that some readers must not see:
personal data, payment data, or commercial secrets such as purchase prices, margins and supplier terms. It's the
counterpart of permission scopes, which only decide who
may edit a field and are open by default. A sensitive field is closed by default: Product:Read doesn't include it.
Mark a field with one or more data classifications. The built-in ones are personal, payment and authentication,
as constants in VoxDataClassifications; register your own in VoxOptions.DataClassifications:
builder.AddVox(options => options.DataClassifications.Add(new VoxDataClassification("cost")));
public class Product : IVoxEntity
{
// IVoxEntity properties omitted.
public required string Name { get; set; }
[VoxSensitive("cost")]
public decimal PurchasePrice { get; set; }
[VoxSensitive(VoxDataClassifications.Personal)]
public string? ProductManagerEmail { get; set; }
}
A role with Product:Read reads the name, while the purchase price and the email are left out and listed in
_redacted. A role with Product:Read and Product:Sensitive:cost reads the purchase price too. Reading a value needs
{EntityType}:Sensitive:{classification} for every classification on the field, and that permission may itself end in
:My. The same policy applies to ordinary reads, action responses, drafts and variations, history, projections,
entity-log payloads, and subscription snapshots. Filtering, sorting, or full-text searching a sensitive field requires
an unrestricted classification permission so query results cannot be used as a masking side channel. Custom endpoints
can call IVoxEntityAccess.EnsureQueryAllowedAsync.
Scopes and sensitivity combine on the same field: a purchase price can be in the Purchasing edit scope and sensitive
under cost, so only purchasers change it and only those with the cost classification read it.
Writing sensitive fields
You can't change what you can't read. A default action that sets a sensitive field needs its classifications besides
its edit permission: an editor with Product:Edit but without Product:Sensitive:cost who calls SetPurchasePrice
gets "You don't have the permission Product:Sensitive:cost". The check works like the one for edit scopes, so a
classification grant limited to contexts or ending in :My limits the writes the same way. A default create action
only needs the classification when it gives the field a value, and a cell that sets a sensitive field
needs it too.
So that an editor can still save what they can read, an object with a sensitive field gets a default action per field
instead of one for the whole object. With a Sourcing object of Supplier, LeadTimeDays and a sensitive
PurchasePrice, the actions are SetSourcingSupplier, SetSourcingLeadTimeDays and SetSourcingPurchasePrice, not
SetSourcing. The editor saves the lead time with SetSourcingLeadTimeDays, the hidden purchase price is never part of
the command and is kept, and the admin UI shows the purchase price as read-only, since the editor's actions don't
include SetSourcingPurchasePrice. An object whose class is marked [VoxSensitive] as a whole has the same
classification in every field, so it keeps one action.
A list is one value: Vox can't tell which stored item an incoming item is, so a list whose items have a sensitive field, eg suppliers with a cost each, can only be set by someone who may read every classification in it, and is read-only in the admin UI for everyone else.
Custom actions, restores, imports and calculations only need their own permissions. A custom action's code decides
what it changes, so a warehouse worker can run ReceiveDelivery, which updates the purchase price, without being able
to read it; the response leaves the price out.
Values derived from sensitive fields
Sensitivity comes only from a field's own declaration, the object it's in or its type. It's never inferred from what a
calculation reads. A Margin calculated from the purchase price and the price lets anyone who reads it work out the
purchase price, so mark it [VoxSensitive("cost")] too. The same goes for projections: their values are redacted by
[VoxSensitive] on the projection class itself, so a projection that copies the purchase price into an unmarked
property exposes it to everyone who reads the projection.
Lists, dictionaries and varying values
A classification on a class applies to every property that holds it, as a value, in a list or as the values of a
dictionary, and classifies that property as a whole. Fields of objects in a list can be classified one by one, eg
cards.number. Fields of objects that are dictionary values can't, since the dictionary's keys are part of their
paths, and neither can fields of the values of a varying property: a property-level [VoxSensitive] there fails at
startup, so classify the value class itself, or use a list instead of a dictionary:
[VoxSensitive(VoxDataClassifications.Payment)]
public class PaymentCard
{
public string Number { get; set; } = "";
}
// Redacted as a whole without the payment classification
public Dictionary<string, PaymentCard> Cards { get; set; } = [];
Classification metadata is validated while the model is built. Unknown names fail startup instead of silently creating a new security category. Types without sensitive fields keep the ordinary serialization and query paths.
Permissions stay close to the model
Permissions are checked before counts and paging, when an action is selected, when a version is published and when a subscription payload is created. They are not only Admin UI visibility hints. A custom UI may omit controls the user cannot use, but Vox remains the enforcement point.
Custom endpoints can use IVoxEntityAccess to apply the same read scopes, entity checks and sensitive-query rules.
This keeps specialized workflows from accidentally becoming a less protected path to the same data.
Because permissions stay with the shared model, every purpose-built or AI-generated application starts from the same security semantics. The interface can be specialized without becoming another place where authorization and data classification rules have to be reimplemented and kept in sync.
See Actions, validation and workflows, Querying and search and Events and subscriptions.