Module & Quota Settings per Organization (Platform Admin)
Overview
This module is the platform admin (onemoby) console for governing each customer organization. It does two things:
- Enable or disable modules for an organization by writing to
organization_module, which overrides the baseline permissions inherited from the role. - Set plan limits for an organization by writing to the
organization.plan_limitsJSONB column.
Disabling a module does more than hide a menu in cms-web: the server-side ModuleGate also
returns 403 for direct API calls to that module, so the governance decision is genuinely
enforced. Every endpoint here requires SuperAdminGuard.
Business Flow
GET /api/org-module-setting/organizationslists all organizations for the platform admin to choose from.GET /api/org-module-setting/:orgIdshows which modules the organization currently has enabled. The service merges two layers: the baseline fromsystem_role_moduleand the overrides fromorganization_module.PUT /api/org-module-setting/:orgIdaccepts a{moduleIds, reset?}payload.- Sending
moduleIdsas the list of modules to enable overwritesorganization_module. - Sending
reset: trueclears all overrides and reverts to the role baseline.
- Sending
- From that point on, every request from a
customeruser in that organization is re-filtered:GET /api/user/:id/permissionreturns the overridden set instead of the baseline, so the cms-web menu changes accordingly.ModuleGateon a disabled module's routes responds with 403ModuleDisabled.
GET /api/org-module-setting/:orgId/limitsandPUT /api/org-module-setting/:orgId/limitsread and write quotas. Any value left unspecified falls back toDefaultPlanLimits.- An unknown
:orgIdproduces an organization-not-found error.
Key Files & Functions
The code lives in internal/modules/orgmodulesetting/, consisting of controller.go,
service.go, and js.go.
| Method | Route | Handler |
|---|---|---|
| GET | /api/org-module-setting/organizations | listOrganizations |
| GET | /api/org-module-setting/:orgId | getOrgModules |
| PUT | /api/org-module-setting/:orgId | setOrgModules |
| GET | /api/org-module-setting/:orgId/limits | getOrgLimits |
| PUT | /api/org-module-setting/:orgId/limits | setOrgLimits |
All routes are registered on authed.Group("/org-module-setting", auth.SuperAdmin()).
Notable service functions:
ListOrganizations,GetOrgModules,SetOrgModules,GetOrgLimits,SetOrgLimitsIsModuleEnabledForOrg(ctx, orgID, moduleName)atservice.go:291is the shared resolver used by bothmodulegate.ModuleGateanduser.FindPermissionByUserID, which guarantees the menu the user sees and the access the API enforces never diverge.
Connections to Other Services
- Permissions —
auth.SuperAdmin()(roleId == 1) on every route - Tables —
organization,organization_module,system_module,system_role_module - Cross-module — uses
planlimits.Serviceto compute effective limits - Consumers of this resolver — the permission and module gate mechanism, and CMS user management
- Original design spec —
docs/superpowers/specs/2026-07-26-platform-admin-design.md