Skip to main content

RBAC Admin

A complete role-based access control administration panel. Covers roles, permissions, teams, principal assignments, and live access checks โ€” all in one drop-in component backed by the Primus RBAC backend module.

Backend required

PrimusRbacAdmin requires the RBAC module running in your Primus backend. See the RBAC integration guide for setup.

Preview ยท RBAC Admin

Codeโ€‹

import { PrimusRbacAdmin } from 'primus-react-ui';

// Basic setup
export function AccessControlPage() {
return (
<PrimusRbacAdmin
apiUrl="https://api.yourdomain.com"
authToken={() => localStorage.getItem('access_token')}
title="Access Control"
subtitle="Roles, permissions, teams, and access checks"
defaultScope={{
applicationId: 'app-core',
tenantId: 'tenant-001',
}}
/>
);
}

// With credential-based auth (BFF pattern โ€” no token in localStorage)
export function AccessControlPageBFF() {
return (
<PrimusRbacAdmin
apiUrl="https://api.yourdomain.com"
withCredentials // includes cookies + CSRF header automatically
defaultPrincipalType="user"
defaultGroupType="team"
showScopeFields={false} // hide scope fields if single-tenant
title="Access Control"
/>
);
}

Propsโ€‹

PropTypeDefaultDescription
apiUrlstringrequiredYour API base URL (origin only, e.g. https://api.yourdomain.com)
authToken() => string | nullโ€”Token resolver called per request
withCredentialsbooleanfalseInclude cookies + CSRF header (for BFF/proxy auth โ€” use instead of authToken)
headersRecord<string, string>โ€”Extra headers added to every request
defaultScope{ applicationId?: string; tenantId?: string }โ€”Pre-fills the scope selector fields
defaultPrincipalTypestring'user'Default principal type in assignment forms
defaultGroupTypestring'team'Default group type in team management
showScopeFieldsbooleantrueShow/hide the scope selector (hide for single-tenant apps)
titlestring'RBAC Admin'Panel heading
subtitlestringโ€”Supporting text below the heading
showHerobooleantrueShow the left hero/branding panel
heroBadgestringโ€”Badge label in the hero panel
heroTitlestringโ€”Headline text in the hero panel
heroSubtitlestringโ€”Supporting text in the hero panel
heroItemsstring[]โ€”Bullet list in the hero panel

Panelsโ€‹

The component includes five built-in panels accessible via the left navigation:

PanelDescription
RolesCreate, edit, and delete roles. Assign permissions to each role.
PermissionsDefine and manage granular permission strings.
TeamsGroup principals (users, services) into teams for bulk assignment.
AssignmentsAssign roles to principals (users, teams) scoped by application and tenant.
Access CheckLive query โ€” ask "does user X have permission Y in scope Z?"

Required backend endpointsโ€‹

The component talks to the Primus RBAC API. Ensure these are available:

GET    /api/rbac/roles
POST /api/rbac/roles
GET /api/rbac/permissions
POST /api/rbac/check
GET /api/rbac/assignments
POST /api/rbac/assignments
DELETE /api/rbac/assignments/:id

Full endpoint reference: RBAC Integration Guide

Version history

See the Changelog for version history and breaking changes.