MineSync Docs
MineSync Docs
MineSync Documentation
API ReferenceRoles and Permissions
Reference

Roles and Permissions

User roles in MineSync and what each role can access and modify.

Overview

MineSync uses a role-based access control (RBAC) model. Each user is assigned a role within a tenant through their tenant membership. Roles determine what a user can view, create, edit, and delete.

Roles

MineSync defines four roles:

RoleDescription
ADMINFull access. Can manage users, configure the system, modify all data, and access admin-only features.
PLANNERCan manage lifecycle profiles, work orders, schedules, and parts. Cannot access admin-level configuration.
TECHNICIANCan view fleet data, update work orders assigned to them, and log meter readings. Limited write access.
VIEWERRead-only access to all fleet data, dashboards, and reports. Cannot create or modify records.

Permission Matrix

Fleet Management

ActionAdminPlannerTechnicianViewer
View vehiclesYesYesYesYes
Create/edit vehiclesYesYesNoNo
Delete vehiclesYesNoNoNo
Log meter readingsYesYesYesNo
View meter readingsYesYesYesYes

Work Orders

ActionAdminPlannerTechnicianViewer
View work ordersYesYesYesYes
Create work ordersYesYesNoNo
Edit work ordersYesYesAssigned onlyNo
Delete work ordersYesNoNoNo
Change work order statusYesYesAssigned onlyNo

Lifecycle Profiles and TCO

ActionAdminPlannerTechnicianViewer
View profilesYesYesYesYes
Create/edit profilesYesYesNoNo
Delete profilesYesNoNoNo
View TCO scenariosYesYesYesYes
Create/edit TCO scenariosYesYesNoNo

Parts and BOM

ActionAdminPlannerTechnicianViewer
View parts catalogYesYesYesYes
Manage partsYesYesNoNo
View BOMYesYesYesYes
Edit BOMYesYesNoNo
View standard jobsYesYesYesYes
Manage standard jobsYesYesNoNo

Benchmark

ActionAdminPlannerTechnicianViewer
View benchmark dataYesYesYesYes
Create/edit benchmark entriesYesNoNoNo
Delete benchmark entriesYesNoNoNo
Bulk import benchmark dataYesNoNoNo

Scheduler

ActionAdminPlannerTechnicianViewer
View schedulesYesYesYesYes
Create/edit scenariosYesYesNoNo
Manage resources (bays, crews)YesYesNoNo
Approve/reject tasksYesDepends on configNoNo

AI

ActionAdminPlannerTechnicianViewer
Use AI chatYesYesYesYes
View conversation historyOwn onlyOwn onlyOwn onlyOwn only
Configure AI settings (provider, keys)YesNoNoNo

Administration

ActionAdminPlannerTechnicianViewer
Manage tenant membersYesNoNoNo
Change member rolesYesNoNoNo
Configure tenant settingsYesNoNoNo
Master data management (OEMs, models, components)YesNoNoNo
View audit logYesNoNoNo
Database backup/restoreYesNoNoNo
SQL viewerYesNoNoNo

How Roles Are Assigned

  1. An admin navigates to Admin > Members.
  2. The admin invites a user or changes an existing member's role.
  3. The role is stored in the tenantMemberships table linking the user to the tenant.

A user can have different roles in different tenants if they belong to multiple organizations.

How Authorization Works

Server-Side

Every tRPC procedure that requires authentication uses tenantProcedure, which:

  1. Verifies the user has a valid session.
  2. Looks up the tenant from the x-tenant-slug header.
  3. Confirms the user has a membership in that tenant.
  4. Attaches ctx.tenantId and ctx.membership (including role) to the request context.

For role-restricted operations, the requireRole middleware checks the membership role:

tenantProcedure.use(requireRole(["ADMIN"]))

If the user's role is not in the allowed list, the server returns a FORBIDDEN error.

Client-Side

The global middleware in src/middleware.ts protects all routes except /login, authentication endpoints, and static assets. Unauthenticated users are redirected to the login page.

Common Questions

Can a user have multiple roles?

Not within the same tenant. Each tenant membership has exactly one role. However, a user can have different roles in different tenants.

Can I create custom roles?

Not currently. The four roles (Admin, Planner, Technician, Viewer) are defined in the application schema. Custom roles would require a schema change.

What happens if I downgrade someone from Admin to Viewer?

They immediately lose access to admin features on their next page load. In-flight operations that were authorized before the change will complete, but subsequent requests will be denied.

API Reference

Technical reference for MineSync's tRPC API routers and procedures.

Approvals

Configure and manage approval workflows for schedule changes and overrides.

On this page

OverviewRolesPermission MatrixFleet ManagementWork OrdersLifecycle Profiles and TCOParts and BOMBenchmarkSchedulerAIAdministrationHow Roles Are AssignedHow Authorization WorksServer-SideClient-SideCommon QuestionsCan a user have multiple roles?Can I create custom roles?What happens if I downgrade someone from Admin to Viewer?