SEC-04A · Section 4: User Roles and Permissions✓ Fully Implemented
Platform Management & Mosque Management Roles (Including Non-Existent Role Clarifications)
Authoritative reference for Global roles (Super Admin, Portal Admin) and Mosque tenant roles (Mosque Admin, Mosque Editor, Mosque Member), plus clarifications on non-existent separate sub-roles.
Purpose of FunctionDocument every verified platform and mosque role, login workflow, accessible modules, allowed/restricted actions, and data access boundaries.
PrerequisitesAn active user account with role assignments in `user_roles` or `mosque_users`.
Required User PermissionsRole Reference Guide (All Users)
A. Kariahku.com Platform Management Roles (Global Scope: user_roles)
1. Super Administrator (Role Code: super_admin)
Role Description: Highest administrative authority across Kariahku.com. Holds all 15 global permissions and is immutable in the permission editor.
Login & Dashboard Access: Sign in at /login → routed to /admin/dashboard.
Available Modules: All /admin/* modules (Dashboard, Users, Permissions, Mosques, CMS, Activity Categories, Featured Activities, Prayer Times, Subscriptions, Payments, Institutions, Reports, and User Manual).
Allowed Actions: Manage user accounts and global roles, edit non-Super-Admin role permissions, review/approve/suspend mosques, manage CMS pages, configure subscription plans/fees/discounts, verify manual bank transfers, manage MAIN/JAKIM institutions, and administer the User Manual.
Restricted Actions: Protected by last-Super-Admin safeguard (cannot suspend or remove the final active super_admin).
Report Access & Data Boundaries: Full access to /admin/reports and platform billing revenue reports at /admin/payments.
Role Description: Operational administrator for portal content, mosque registration reviews, featured activities, and help center content.
Login & Dashboard Access: Sign in at /login → accesses /admin/mosques, /admin/cms, /admin/featured-activities, /admin/reports, and /admin/manual.
Allowed Actions: Review/approve/reject mosque registrations (mosques.review), edit trilingual CMS content (portal.content.manage), curate featured activities (portal.activities.feature), view content reports (reports.content.view), and manage User Manual content (manual.manage).
Restricted Actions (Default): Cannot manage users (users.manage), edit permissions (permissions.manage), alter subscription plans (subscriptions.manage), verify payments (payments.manage), or manage institutions (institutions.manage) unless explicitly granted in /admin/permissions.
3. Clarification: Subscription/Billing Administrator & Support Administrator
Verified Codebase Reality: Separate role rows for Subscription/Billing Administrator or Support Administratordo not exist in the roles table. Billing and support administration are governed via granular permissions (subscriptions.manage, payments.manage, institutions.manage) held by super_admin and configurable in /admin/permissions.
B. Mosque Management Roles (Mosque Tenant Scope: mosque_users)
1. Mosque Administrator (Role Code: mosque_admin)
Role Description: Primary administrator for an individual mosque tenant. Holds mosque.access, mosque.manage, mosque.publish, subscriptions.view, and kariah.members.export.
Login & Dashboard Access: Sign in at /login → routed to /mosque-admin/dashboard.
Available Modules: All /mosque-admin/* modules (Dashboard, Mosque Profile, Microsite Website, Announcements, Committee, Editorial Content, Activities, Prayer Times, Mosque Users, Kariah Residential Areas, Kariah Members, and Subscription/Billing).
Restricted Actions & Data Boundaries: Strictly isolated to the assigned mosque_id. Cannot view or modify any other mosque tenant or access /admin/*.
2. Mosque Editor (Role Code: mosque_editor)
Role Description: Secondary mosque tenant role holding mosque.access and mosque.publish.
Allowed & Restricted Actions: Can select the assigned mosque in /mosque-admin, whereas administrative configuration screens requiring mosque.manage or kariah.members.export are restricted to mosque_admin.
3. Mosque Member (Role Code: mosque_member)
Role Description: Read-only tenant workspace role holding mosque.access. Cannot modify mosque settings or export member directories.
Verified Codebase Reality: Separate login role codes for Mosque Committee / AJK, Mosque Treasurer, or Mosque Secretarydo not exist in the roles table. Mosque committee positions (Chairman, Imam, Secretary, Treasurer, Committee Members) are published as public organisational directory records in mosque_committees via /mosque-admin/committee, while system login access uses mosque_admin, mosque_editor, or mosque_member.
Platform Administrator (/admin/dashboard) and Mosque Administrator (/mosque-admin/dashboard) workspaces.
Input Fields & Options Reference
Role Code
Scope Table
Default Permissions
Primary Entry Route
super_admin
Global (user_roles)
All 15 global permissions (including manual.manage)
Expected Results: Administrators and auditors have an exact reference of every platform and mosque role and its boundaries.
Important Notes & Data Boundaries: A single user account can be assigned to multiple mosques in `mosque_users` and switch between them at `/mosque-admin`.
Common Errors & Troubleshooting
If a mosque_admin user receives 403 Forbidden, verify that both their mosque_users.status and the mosque’s mosques.status are set to active.
SEC-04C · Section 4: User Roles and Permissions✓ Fully Implemented
Government / Religious Authority Roles (MAIN & JAKIM) and Community Users
Complete documentation for State Islamic Religious Council (MAIN) and JAKIM institutional roles (administrator and report_viewer), registered kariah members, and general public users.
Purpose of FunctionExplain how MAIN and JAKIM officers access jurisdiction-scoped aggregate dashboards and clarify the role of registered kariah members and public visitors.
PrerequisitesAn active institution record in `institutions` with verified state grants in `institution_state_access`.
Required User PermissionsRole Reference / Global institutions.manage for Provisioning
C. Community Users
1. Registered Kariah Members
Role Description: Muslim residents who submitted a kariah membership application via /kariah-register and were approved by a Mosque Administrator into kariah_people and kariah_members.
Login & Access Process: Registered kariah members do not require or receive a system login account (users). Kariah membership is a mosque-level community registry record.
Allowed Actions: Browse all public portal pages, mosque microsites (/masjid/{slug}), prayer times, activity calendars, and submit kariah membership applications.
Privacy Protection: National IC numbers are never collected. Residential addresses and phone numbers are visible only to authorized Mosque Administrators of that specific mosque and are never exposed publicly or to MAIN/JAKIM dashboards.
2. General Public Users
Role Description: Unauthenticated visitors browsing the platform.
Available Modules: Homepage (/), Mosque Directory (/mosques), Mosque Microsites (/masjid/{slug}), Activities (/activities), Prayer Times (/prayer-times), Mosque Registration (/register-mosque), Kariah Registration (/kariah-register), and the User Manual (/manual).
D. Government / Religious Authorities (institution_users Table)
Authority users are bound to an active institution record in institutions (main or jakim) via institution_users with one of two institutional roles:
1. Majlis Agama Islam Negeri (MAIN) Authorized Users — institution_type = 'main'
Routes:/{lang}/main/dashboard, /{lang}/main/reports, and /{lang}/main/subscription.
Institutional Sub-Roles:
administrator: Holds all 5 institutional permissions (dashboard.view, reports.view, reports.export, subscription.view, subscription.renew). Can generate renewal invoices and initiate checkout.
report_viewer: Holds dashboard.view, reports.view, reports.export, and subscription.view (read/export reports and view billing only).
Data Access Boundaries: Strictly restricted to states with a verified grant (verified_by IS NOT NULL) in institution_state_access. MAIN institutions cannot be granted nationwide mode.
2. JAKIM Authorized Users — institution_type = 'jakim'
Routes:/{lang}/jakim/dashboard, /{lang}/jakim/reports, and /{lang}/jakim/subscription.
Institutional Sub-Roles: Supports administrator and report_viewer.
Data Access Boundaries: Requires jurisdiction_mode = 'nationwide' and verified grants across all 16 Malaysian states and federal territories. Access is strictly limited to aggregate registered-mosque metrics; individual kariah member PII and sensitive financial modules are excluded.
MAIN & JAKIM institution governance (/admin/institutions) and community user roles.
Can view/export aggregate reports and view billing status (cannot renew subscription).
Expected Results: Users understand community access rules and the exact distinction between MAIN and JAKIM institutional roles.
Important Notes & Data Boundaries: Institutional dashboard and report access requires an active (`active`, `trialing`, or `grace_period`) institutional subscription.
Common Errors & Troubleshooting
If a MAIN or JAKIM user encounters "Institutional reporting requires an active subscription", an institutional administrator can still access /main/subscription or /jakim/subscription to renew and pay.
SEC-04E · Section 4: User Roles and Permissions✓ Fully Implemented
Role-Permission Matrix & Managing Permissions at /admin/permissions
Step-by-step guide to inspecting and updating the role-permission matrix at /admin/permissions, with a complete reference table of all global and mosque permissions.
Purpose of FunctionAllow Super Administrators to audit and configure role permissions safely while preserving Super Admin immutability.
PrerequisitesSigned in as `super_admin` (`permissions.manage`). Anyone can view the live read-only matrix at `/{lang}/manual/roles`.
Required User PermissionsGlobal permissions.manage (Super Admin)
1. Viewing the Live Role-Permission Matrix
Open the dedicated Role & Permission Matrix page at /{lang}/manual/roles in this Help Center to inspect the live matrix queried directly from the database.
To modify role permissions, sign in as a Super Admin and click Permissions in the admin sidebar (/{lang}/admin/permissions).
2. Updating Role Permissions at /admin/permissions
In the matrix table on /admin/permissions, each row represents a permission code and each column represents a role (super_admin, portal_admin, mosque_admin, mosque_editor, mosque_member).
Notice that checkboxes under the Super Admin column are checked and locked (disabled) because super_admin permanently holds all permissions.
Check or uncheck permissions for the remaining roles as required by your governance policy.
Click Save at the bottom of the form.
The system updates role_permissions inside a database transaction and writes a permissions.updated record to audit_logs.
Role Permission Matrix administration screen (/admin/permissions) and live matrix view.
Input Fields & Options Reference
Permission Code
Scope
Controlled Capability
portal.access
Global
Baseline access to portal administration views.
users.manage
Global
Manage user account status and global roles at /admin/users.
mosques.review
Global
Review, approve, or reject mosque registration applications at /admin/mosques.
mosques.manage
Global
Edit mosque records and suspend/reactivate mosques at /admin/mosques.
portal.content.manage
Global
Manage trilingual CMS pages and announcements at /admin/cms.
platform.dashboard.view
Global
View platform-wide metrics at /admin/dashboard.
reports.platform.view
Global
View platform summary reports at /admin/reports.
reports.content.view
Global
View content and activity metrics at /admin/reports.
audit.view
Global
Inspect security audit logs at /admin/dashboard and /admin/reports.
permissions.manage
Global
Modify role permissions at /admin/permissions.
portal.activities.feature
Global
Manage activity categories and featured portal activities.
subscriptions.manage
Global
Manage subscription plans, prices, discounts, and lifecycle overrides at /admin/subscriptions.
payments.manage
Global
Manage payment gateways, verify manual transfers, and view revenue reports at /admin/payments.
institutions.manage
Global
Create and verify MAIN and JAKIM institutions at /admin/institutions.
manual.manage
Global
Manage User Manual categories, trilingual articles, screenshots, and FAQs at /admin/manual.
mosque.access
Mosque
Access the mosque tenant workspace at /mosque-admin.
View and pay mosque subscription invoices at /mosque-admin/subscription.
kariah.members.export
Mosque
Export the mosque kariah member directory to CSV at /mosque-admin/kariah-members?export=csv.
Expected Results: Permission updates take effect immediately on the next request and are recorded in `audit_logs`.
Important Notes & Data Boundaries: The `super_admin` role is hard-protected so administrators can never accidentally lock themselves out of permission management.
Common Errors & Troubleshooting
If a user does not see newly granted links right away, ask them to refresh their browser page.