RBAC Architecture & Role Definitions (L0βL4)
Dokumentasi lengkap Role-Based Access Control (RBAC) multi-level untuk sistem MStore yang dapat scale dari Micro business hingga Multi-National Corporation (MNC) dengan 57 roles terstruktur.π― Prinsip Desain
Arsitektur ini dibangun berdasarkan 4 pilar utama:Security
Principle of Least Privilege & Segregation of Duties
Efficiency
Role dapat dirangkap aman untuk tim kecil (kurang dari 50 staff)
Auditability
Semua transaksi critical ada trail & approval log
Scalability
Mudah upgrade dari L1 ke L4 tanpa breaking change
π Level Overview
| Level | Nama | Target Bisnis | Kompleksitas | Jumlah Role |
|---|---|---|---|---|
| L0 | Micro / Solo | Warung, freelancer | πΉ Minimal | 3 roles |
| L1 | SME | Toko retail, cafe | πΉ Low | 6-8 roles |
| L2 | Enterprise | Manufaktur, distribusi | πΈ Medium | 24 roles |
| L3 | Holding | Grup multi-entity | πΈ High | 9 roles |
| L4 | MNC / Corporate | Multi-country | πΈ Very High | 15 roles |
π§© L0 β Micro / Solo
π― Fokus: Sistem sederhana untuk 1β3 user tanpa approval flow πΌ Contoh Bisnis: Warung, freelancer, jasa kecilRoles
| Code | Name | Deskripsi | Access |
|---|---|---|---|
| L0_OWNER | Owner | Pemilik dengan akses penuh | ALL |
| L0_CASHIER | Cashier | Kasir input transaksi | POS, Invoice |
| L0_VIEWER | Viewer | Read-only laporan | Reports |
Karakteristik
- β Simple & Fast: Setup < 5 menit
- β No SoD: Tidak ada aturan rangkap jabatan
- β Single Device: Ideal untuk POS mini
- β οΈ No Approval: Tidak ada workflow approval
π§© L1 β SME (SmallβMedium Enterprise)
π― Fokus: ERP dasar β Finance, HR, Inventory πΌ Contoh Bisnis: Toko retail, bengkel, cafe, grosir kecilRoles
| Code | Name | Deskripsi | Available Levels |
|---|---|---|---|
| L1_OWN-MGR | Owner & Manager | Pemilik usaha semua modul | L1,L2,L3,L4 |
| L1_FIN-MGR | Finance Manager | Keuangan, laporan, kas | L1,L2,L3,L4 |
| L1_INV-MGR | Inventory Manager | Stok dan gudang | L1,L2,L3,L4 |
| L1_HR-MGR | HR Manager | HR dan payroll | L1,L2,L3,L4 |
| L1_CSH | Cashier | Transaksi harian | L0,L1,L2,L3,L4 |
| L1_AUD | Auditor | Read-only audit | L1,L2,L3,L4 |
Karakteristik
- β Efisien: Cukup 6 role untuk 5-20 staff
- β Tanpa konflik: Belum ada SoD strict
- β Rangkap aman: 1 orang boleh > 1 role
- β οΈ Basic approval: Approval sederhana saja
π§© L2 β Enterprise
π― Fokus: Multi-department, approval flow, RBAC penuh πΌ Contoh Bisnis: Manufaktur, e-commerce besar, distribusiCore Roles (24 total)
- Management (3)
- Finance (4)
- Operations (6)
- Marketing & CRM (4)
- Customer Service (2)
- R&D (2)
- Support (3)
- Approvers (2)
- L2_OWN-MGR: Akses penuh & approval tertinggi
- L2_ADM-BIZ: Konfigurasi bisnis (COA, tax, workflow)
- L2_ADM-SYS: Infrastruktur teknis (deployment, backup)
Segregation of Duties (SoD)
Karakteristik
- β SoD Aktif: Segregation of Duties enforcement
- β Approval Flow: Multi-level approval (L1, L2)
- β Department-based: Role per departemen
- β Audit Trail: Lengkap untuk semua transaksi
π§© L3 β Holding
π― Fokus: Multi-entitas, multi-currency, intercompany πΌ Contoh Bisnis: Grup usaha dengan beberapa anak perusahaanHolding-Level Roles (9 total)
| Code | Name | Scope | Deskripsi |
|---|---|---|---|
| L3_OWN-MGR-HLD | Owner & Manager (Holding) | HOLDING | Kontrol semua entitas |
| L3_ADM-SYS-HLD | System Admin (Holding) | HOLDING | Infrastruktur global |
| L3_CONS-MGR | Consolidation Manager | HOLDING | Konsolidasi laporan grup |
| L3_AUD-GRP | Group Auditor | HOLDING | Audit seluruh entitas |
| L3_APV-L3 | Approver Level 3 | HOLDING | Approval lintas entitas |
| L3_LEG-ADVISOR | Legal Advisor | HOLDING | Kontrak, lisensi, regulasi grup |
| L3_COMP-OFFICER | Compliance Officer | HOLDING | Audit compliance & reporting |
| L3_BI-MGR | BI Manager | HOLDING | Dashboard global, KPI design |
| L3_DATA-ANL | Data Analyst | HOLDING | Report data, KPI analysis |
Domain Architecture
Karakteristik
- β Domain Isolation: Role terisolasi per entitas
- β Intercompany: Support transaksi antar entitas
- β Consolidation: Laporan konsolidasi grup
- β Multi-Currency: Support mata uang berbeda
π§© L4 β Corporate / MNC
π― Fokus: Multi-country, regulatory compliance, SSO, OPA πΌ Contoh Bisnis: Grup lintas negara, public companyGlobal Roles (15 total)
| Code | Name | Scope | Deskripsi |
|---|---|---|---|
| L4_BOARD-CXO | Board & C-Level | GLOBAL | Akses strategis global |
| L4_GOV-COMP | Governance & Compliance | GLOBAL | Audit eksternal (SOX, ISO) |
| L4_FIN-GLB | Global Finance | GLOBAL | Transfer pricing, consolidation |
| L4_IT-SYS-GLB | Global IT System | GLOBAL | IAM, SSO, OPA, encryption |
| L4_ADM-REG | Regional Admin | REGION | Konfigurasi regional |
| L4_APV-EXEC | Executive Approver | GLOBAL | Approval global |
| L4_AUD-EXT | External Auditor | GLOBAL | Auditor independen |
| L4_MKT-GLB | Global Marketing | GLOBAL | Brand governance, global campaign |
| L4_CMO-GLB | CMO (Global) | GLOBAL | Strategic marketing leadership |
| L4_PROD-DEV | Product Development | GLOBAL | Innovation, prototyping |
| L4_DATA-STW | Data Steward | GLOBAL | Data governance, master data |
| L4_ESG-MGR | ESG Manager | GLOBAL | Sustainability, ESG reporting |
| L4_CSR-OFFICER | CSR Officer | GLOBAL | CSR programs |
| L4_SEC-OFFR | Security Officer | GLOBAL | SIEM, incident response |
| L4_ROLE-AUDIT | Role Auditor (IGA) | GLOBAL | Role review, SoD validation |
Integration Stack
Identity & Access
- SSO (SAML, OAuth2)
- LDAP/Active Directory
- MFA enforcement
Policy Engine
- OPA (Open Policy Agent)
- Casbin multi-domain
- Redis Watcher (real-time sync)
Compliance
- SOX compliance
- ISO 27001
- GDPR ready
Monitoring
- Audit log central
- SIEM integration
- Anomaly detection
Karakteristik
- β Global Compliance: SOX, ISO, GDPR
- β SSO Integration: Single sign-on
- β Zero-Trust: OPA policy enforcement
- β Real-time Sync: Redis watcher untuk policy
- β Multi-Region: Support deployment global
π Upgrade Path
Evolusi Natural
Migration Strategy
1
L0 β L1
Trigger: Staff bertambah > 3 orangAction:
- Tambah role FIN-MGR, INV-MGR, HR-MGR
- Pisahkan owner dari operator
- Setup basic audit (role AUD)
2
L1 β L2
Trigger: Multi-department atau staff > 20 orangAction:
- Aktifkan SoD rules
- Split admin (ADM-BIZ vs ADM-SYS)
- Implementasi approval flow (APV-L1, APV-L2)
- Pisah finance (FIN-AP, FIN-AR, FIN-CASH)
3
L2 β L3
Trigger: Multi-entity atau holding structureAction:
- Aktifkan domain isolation
- Setup consolidation (CONS-MGR)
- Tambah entity-level roles (@ENT-xx)
- Implementasi intercompany transactions
4
L3 β L4
Trigger: Multi-country atau go publicAction:
- Integrasikan SSO (SAML/OAuth2)
- Deploy OPA untuk global policy
- Setup compliance (GOV-COMP)
- Aktifkan Redis watcher
π οΈ Implementasi Teknis
Database Schema
Backend (Go/Fiber)
Casbin Policy
π Best Practices
1. Role Assignment
2. Segregation of Duties
3. Upgrade Timing
π§ͺ Testing & Validation
Role Validation Script
Casbin Policy Test
π Related Documentation
Bruno API Collections
API V2 collections organized by role
UI/UX by Level
UI/UX specifications for each business level
Approval Flow
Multi-level approval workflow
Audit Logs
Tracking aktivitas user per role
User Management
Cara assign role ke user
Security Best Practices
Panduan keamanan sistem
π Example Scenarios
Scenario 1: Toko Retail (L1)
Setup:- 1 Owner (L1_OWN-MGR)
- 1 Kasir (L1_CSH)
- 1 Admin Stok (L1_INV-MGR)
- 1 Keuangan part-time (L1_FIN-MGR)
- Owner merangkap HR-MGR (aman karena L1 belum strict SoD)
- Kasir merangkap VWR untuk lihat laporan (aman)
Scenario 2: Manufaktur (L2)
Setup:- 1 Owner (L2_OWN-MGR)
- 2 Admin (L2_ADM-BIZ, L2_ADM-SYS) β harus pisah!
- Finance team: L2_FIN-AP, L2_FIN-AR, L2_ACC-MGR β tidak boleh rangkap!
- Operations: L2_INV-MGR, L2_PRC-MGR, L2_SL-MGR
- Approvers: L2_APV-L1, L2_APV-L2
- L2_FIN-AP β L2_ACC-MGR (tidak boleh self-approve)
- L2_ADM-SYS β L2_FIN.* (system admin tidak boleh edit keuangan)
Scenario 3: Holding Group (L3)
Setup:- HOLDING: L3_CONS-MGR, L3_AUD-GRP, L3_APV-L3
- ENT-01 (Trading): L3_FIN-MGR@ENT-01, L3_INV-MGR@ENT-01
- ENT-02 (Manufacturing): L3_FIN-MGR@ENT-02, L3_INV-MGR@ENT-02
- L3_FIN-MGR@ENT-01 hanya akses data ENT-01
- L3_CONS-MGR@HOLDING bisa akses semua entity
π Support
Jika ada pertanyaan tentang multi-level RBAC atau butuh konsultasi untuk upgrade level, hubungi tim development. Tags:rbac, multi-level, security, scalability, casbin, enterprise, architecture, roles