Executive Summary

Admin Organization Settings APIs provide self-service configuration for organization administrators. Unlike SuperAdmin APIs that manage multiple organizations, these endpoints are scoped to the Admin's own organization only.

βœ… Self-Service
Admins manage own org settings
βœ… Plan-Aware
Settings validated against subscription limits
⚠️ Read-Only Plans
Cannot upgrade/downgrade without SuperAdmin
🎯 Scoped Access
JWT orgId claim enforced

πŸ“Š API Inventory

ControllerRouteEndpointsAdmin AccessNotes
AdminOrganizationController /api/adminorganization 12 Own Org Only Read own org, limited update
OrganizationSettingsController /api/organizationsettings 6 Full CRUD Key-value settings store

βš™οΈ Organization Settings

Settings Management

GET /api/adminorganization/{id}

Get organization details. Admin can only access their own organization.

Own Org Only Existing

PUT /api/adminorganization/{id}

Update organization name, description, branding. Cannot change plan or status.

Own Org Only Existing

GET /api/organizationsettings

Get all organization-specific settings (key-value pairs).

Own Org Full Existing

POST /api/organizationsettings

Create or update a setting. Validated against plan feature flags.

Own Org Full Existing

Available Settings

Setting KeyTypeDescriptionPlan Limit
max_usersIntegerMaximum users allowedDefined by plan
max_devicesIntegerMaximum devices per userDefined by plan
session_retention_daysIntegerHow long to keep session history30-365 days by plan
enable_exportsBooleanAllow data exportsPro+ plans only
enable_analyticsBooleanAdvanced analytics featuresPro+ plans only
enable_api_accessBooleanOrganization API key accessEnterprise only
branding_logo_urlStringCustom logo URLEnterprise only
sso_providerStringSAML/OIDC provider configEnterprise only

πŸ“Š Plan Limits & Enforcement

Plan Limits Enforcement Flow ═══════════════════════════════════════════════════════════════════════════════ Admin Request: POST /api/organizationsettings Body: { "key": "max_users", "value": "150" } β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ OrganizationSettingsController β”‚ β”‚ β”‚ β”‚ 1. Extract OrganizationId from JWT claims β”‚ β”‚ 2. Validate setting key is allowed β”‚ β”‚ 3. Check plan limits β”‚ β”‚ β”‚ β”‚ β”‚ β–Ό β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ IPlanFeatureService.ValidateLimit() β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ Current Plan: "Professional" ($99/mo) β”‚ β”‚ β”‚ β”‚ Plan Features: { maxUsers: 100, enableExports: true } β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ Requested: max_users = 150 β”‚ β”‚ β”‚ β”‚ Allowed: max_users <= 100 β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ Result: ❌ VALIDATION FAILED β”‚ β”‚ β”‚ β”‚ Return 400 Bad Request β”‚ β”‚ β”‚ β”‚ "Value exceeds plan limit (100)" β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ ───────────────────────────────────────────────────────── β”‚ β”‚ β”‚ β”‚ Requested: max_users = 50 β”‚ β”‚ β”‚ β”‚ Allowed: max_users <= 100 βœ“ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ Result: βœ… VALIDATION PASSED β”‚ β”‚ β”‚ β”‚ Continue to save... β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό Save to DB β”‚ β–Ό Return 200 OK

πŸ”„ Settings Change Workflow

Organization Settings Change Flow ═══════════════════════════════════════════════════════════════════════════════ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Admin │────►│ Angular │────►│ Settings API │────►│ Plan β”‚ β”‚ User β”‚ β”‚ Settings β”‚ β”‚ (Validation) β”‚ β”‚ Service β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ Component β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ β–Ό β–Ό β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ ❌ Rej β”‚ β”‚ ⚠️ Warn β”‚ β”‚ βœ… Save β”‚ β”‚ ected β”‚ β”‚ Limit β”‚ β”‚ Setting β”‚ β”‚ (400) β”‚ β”‚ Close β”‚ β”‚ (200) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β–Ό β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Show upgrade β”‚ β”‚ Refresh cacheβ”‚ β”‚ prompt β”‚ β”‚ Notify users β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ Frontend Integration: β€’ Settings form dynamically shows/hides fields based on plan features β€’ "Upgrade required" badges on premium settings β€’ Real-time validation before submission

πŸ—„οΈ Database Dependencies

TablePurposeKey ColumnsIndexes
Organizations Org metadata Id, Name, PlanId, Status PK Id
OrganizationSettings Key-value store OrgId, Key, Value, ModifiedAt PK (OrgId, Key)
Plans Subscription tiers Id, Name, Features (JSON), Limits (JSON) PK Id
Subscriptions Active subscriptions Id, OrgId, PlanId, Status IX OrgId (unique)

⚠️ Security Considerations

βœ“
JWT OrgId Enforcement
Admin can only modify settings for organization in their JWT claims.
βœ“
Plan Validation
Cannot bypass plan limits by directly calling API. Server-side validation enforced.
⚠
No Approval Workflow
Settings changes apply immediately. No review/approval process for sensitive changes.