# Unified RBAC + ABAC + FSM State Authorization Matrix Template (UP-AI v1.8) # Canonical Path: project_sdlc/04_architecture_design/security/auth_matrix.yaml # Governed by: up-srs-derive (Stage 8), up-wireframe-spec (Stage 11), up-test-model-generate (Stage 12), up-code-generate (Stage 13) # Validated by: Gate 9.1 and Gate 14.1 (G14-015, G14-016) version: "1.0" description: "Authoritative Single-Source Authorization & State Guard Contract" last_updated: "YYYY-MM-DD" roles: - id: "ROLE_BUYER" name: "Mandi Buyer" description: "Mandi-level purchasing and spot sauda procurement" - id: "ROLE_YARD_SUPERVISOR" name: "Yard Supervisor" description: "Physical yard operations, inward/outward gate monitoring, and lot stacking" - id: "ROLE_GATE_OPERATOR" name: "Gate Operator" description: "Inward/outward gate registration, physical slip creation, and initial vehicle check-in" - id: "ROLE_WEIGHBRIDGE_OPERATOR" name: "Weighbridge Operator" description: "Gross and tare weighment capture from digital indicators" - id: "ROLE_QUALITY_INSPECTOR" name: "Quality Inspector" description: "Sampling, assaying, lab parameter recording, and deduction calculation" - id: "ROLE_ACCOUNTS_EXECUTIVE" name: "Accounts Executive" description: "Voucher generation, AP/AR ledger entries, and payment processing" - id: "ROLE_SALES_EXECUTIVE" name: "Sales Executive" description: "Customer sales orders, dispatches, and commercial invoicing" - id: "ROLE_PARTNER_MD" name: "Partner / Managing Director" description: "Executive oversight, policy configuration, and final commercial approvals" matrices: - entity: "ProcurementSauda" module: "procurement" owning_fr: "FR-PROC-001" fsm_states: - DRAFT - PENDING_APPROVAL - CONFIRMED - CLOSED - CANCELLED actions: - action_id: "sauda.create" description: "Book / create initial procurement contract" allowed_roles: - "Mandi Buyer" - "Purchase Manager" - "Partner / Managing Director" forbidden_roles: - "Yard Supervisor" - "Gate Operator" - "Weighbridge Operator" - "Quality Inspector" - "Accounts Executive" - "Sales Executive" allowed_fsm_states: - "DRAFT" abac_predicates: - rule: "tenant_match" expression: "resource.tenant_id == user.tenant_id" - rule: "financial_limit" expression: "resource.booked_quantity_mt * resource.agreed_rate_per_qtl * 10 <= user.single_transaction_limit_inr" enforcement: api_endpoint: "POST /api/v1/procurement/saudas" backend_scope: "procurement:sauda:create" ui_route: "/procurement/saudas/new" ui_element_guard: "button#btn-create-sauda" - action_id: "sauda.gate_inward_view" description: "Query sauda balance for inward gate entry" allowed_roles: - "Yard Supervisor" - "Gate Operator" - "Weighbridge Operator" - "Quality Inspector" - "Partner / Managing Director" forbidden_roles: - "Mandi Buyer" - "Sales Executive" - "Accounts Executive" allowed_fsm_states: - "CONFIRMED" abac_predicates: - rule: "yard_match" expression: "resource.destination_yard_id in user.assigned_yard_ids" enforcement: api_endpoint: "GET /api/v1/procurement/saudas" backend_scope: "procurement:sauda:read" ui_route: "/receiving/gate-entry" ui_element_guard: "select#sauda-dropdown"