capdux.org CP REGISTRY

@web/rbac

v1.0.0 MIT .cap ✓ Verified by capdux.org AI-First .d.cp

Official declarative Role-Based Access Control (RBAC) with wildcard permissions & route guards for cap:web

Install with Cap
$ cap add @web/rbac

AI Interface Stub .d.cp

// Type definitions for CP

import { App, AppMethod, Context, Response, Plugin, PluginScope } from "../../../../lib/web/app.cp";
export class RbacConfig {
    role_header: string,
    default_role: string,
}

export class RbacGrant {
    role: string,
    perm: string,
}

export class RbacPathRule {
    method: AppMethod,
    path_prefix: string,
    required_perm: string,
}

export fn rbacStrEql(a: string, b: string): bool;
export fn rbacStartsWith(s: string, prefix: string): bool;
export fn rbacPermMatches(granted: string, needed: string): bool;
export fn rbacReset();
export fn rbacGrant(role: string, perm: string): bool;
export fn rbacProtect(method: AppMethod, path_prefix: string, required_perm: string): bool;
export fn rbacCan(role: string, needed_perm: string): bool;
export fn rbacGuardHook(ctx: &mut Context): bool;
export fn createRbacPlugin(cfg: RbacConfig): Plugin;
export fn registerRbac(app: &mut App, cfg: RbacConfig): &mut App;

README

Markdown

No README provided for this package version.

Version History

1 release
Version Format / Size Integrity (SHA-256) Downloads Published Status
v1.0.0 .cap · 2.2 KB sha256-a3484b47d0b1d819… 0 2026-11-26 latest