ios-rbac/SKILL.md
Role-Based Access Control for iOS apps integrating with a multi-tenant SaaS backend. Covers permission fetching, Keychain caching, SwiftUI permission gates (PermissionGate, ModuleGate), module-gated TabView, navigation guards, offline-capable...
npx skillsauth add peterbamuhigire/skills-web-dev ios-rbacInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
ios-rbac or would be better handled by a more specific companion skill.SKILL.md first, then load only the referenced deep-dive files that are necessary for the task.Mobile RBAC uses a hybrid client+server approach:
Backend Environments: Dev (Windows/MySQL 8.4.7), Staging (Ubuntu/MySQL 8.x), Production (Debian/MySQL 8.x). Permission APIs must behave identically across all environments. Use Xcode build configurations and schemes for environment-specific base URLs.
Login → Fetch Permissions → Cache in Keychain → UI Gates
↕ (refresh) ↕ (403 fallback)
Backend always enforces ←────────────────────┘
| Layer | What It Controls | When Hidden/Disabled | | ------------------- | ---------------- | ------------------------------------- | | Module Gate | TabView tabs | Franchise hasn't subscribed to module | | Permission Gate | Views, buttons | User's role lacks the permission |
Rule: Modules HIDE tabs entirely. Permissions DISABLE or HIDE individual actions.
Backend resolves permissions using 5-tier priority: User Denial → User Grant → Franchise Override → Role Permission → Super Admin/Owner. The iOS client never resolves permissions locally. It receives the resolved set from GET /user/permissions and uses it as-is.
Permissions are a flat set of ~20-50 string codes. Stored securely in the Keychain.
"user_permissions" → Set<String> {"POS_CREATE_SALE", "DASHBOARD_VIEW", ...}
"user_modules" → Set<String> {"POS", "INVENTORY", ...}
"user_roles" → Set<String> {"CASHIER", ...}
"user_type" → String "staff"
"permissions_updated" → TimeInterval (epoch seconds)
Never use UserDefaults for permissions. Keychain data survives app reinstalls and is encrypted at rest by the OS.
| Trigger | Action | | -------------------- | ----------------------------- | | After login | Fetch immediately | | App startup (cold) | Fetch if > 15 min stale | | App foreground (warm) | Fetch if > 15 min stale | | 403 from backend | Fetch immediately, then retry | | Pull-to-refresh | Fetch immediately |
Use ScenePhase to detect app foreground transitions for staleness checks.
Extended guidance for ios-rbac was moved to references/skill-deep-dive.md to keep this entrypoint compact and fast to load.
Use that deep dive for:
PermissionManager (@Observable)UI PatternsApp Lifecycle Integration403 Auto-RefreshKeychain HelperUX GuidelinesSecurity RulesIntegration with Other SkillsAnti-PatternsImplementation Checklistdata-ai
Use when adding AI-powered analytics to a SaaS platform — semantic search over business data, natural language queries, trend detection, anomaly alerts, and AI-generated insights for dashboards. Covers embeddings, NL2SQL, and per-tenant analytics...
data-ai
Design AI-powered analytics dashboards — what metrics to show, how to display AI predictions and confidence, drill-down patterns, KPI cards, trend visualisation, AI Insights panels, export design, and role-based dashboard variants. Invoke when...
development
Use when designing, building, reviewing, or upgrading production software systems that must be secure, performant, maintainable, scalable, and user-centered. Apply before writing specs, code, architecture, APIs, databases, mobile apps, SaaS platforms, or ERP systems.
development
Professional web app UI using commercial templates (Tabler/Bootstrap 5) with strong frontend design direction when needed. Use for CRUD interfaces, dashboards, admin panels with SweetAlert2, DataTables, Flatpickr. Clone seeder-page.php, use...