docs.rs failed to build stateset-authz-0.7.4
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
StateSet Authorization
IO-free, framework-agnostic authorization engine for the StateSet iCommerce
platform. This crate is a Rust port of the permission model in
cli/src/permissions.js, designed to be reusable across runtimes (CLI,
server, WASM, NAPI bindings).
Features
- Permission levels —
None<Read<Preview<Write<Delete<Admin - Role-based access control — built-in roles (
admin,operator,viewer,none) plus a [RoleBuilder] for custom roles - Window-based rate limiting — per-actor, per-resource request tracking
- Audit logging — in-memory ring buffer with filtering by actor, resource, time
- Sensitive field redaction — recursive JSON traversal + partial string masking
- Access decisions —
Allowed,Denied,RequiresApprovalwith reasons - Zero IO — no filesystem, network, or database access; bring your own persistence
Quick Start
use ;
use Duration;
let mut engine = new
.add_role
.add_role
.assign_role
.assign_role
.rate_limit_rule
.build;
// Alice (admin) can create orders
let decision = engine.authorize;
assert!;
// Bob (viewer) cannot create orders
let decision = engine.authorize;
assert!;
// Every decision is recorded in the audit log
assert_eq!;
Custom Roles
use ;
let order_manager = new
.default_level
.allow
.allow
.build;
assert!;
assert!;
assert!;
Redaction
use ;
use json;
let config = default;
let mut data = json!;
redact_value;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;