After Framework

Enterprise boundaries

EnterpriseScope, RBAC, audit, secure interop and bootstrap mode.

Docs version: supercore main · packages 1.0.0

EnterpriseScopeLink to this section: EnterpriseScope

Org-scoped enterprise ports require an EnterpriseScope. A missing organizationId throws — they never return all tenants.

dart
/// Fail-closed tenant + actor context for enterprise ports (ADR-002).
class EnterpriseScope {
  final String organizationId;
  final String actorId;
  final PermissionSet permissions;

  /// Throws if [organizationId] is missing/blank — never allow all-tenant lists.
  static String requireOrganizationId(String? organizationId) {
    final id = organizationId?.trim() ?? '';
    if (id.isEmpty) {
      throw StateError(
        'EnterpriseScope: organizationId is required (fail-closed tenancy).',
      );
    }
    return id;
  }
}

Source supercore/packages/after_enterprise/lib/src/scope/enterprise_scope.dart (opens in a new tab)

ADR-002 (opens in a new tab)

RBAC and auditLink to this section: RBAC and audit

Vertical features check PermissionSet.allows(...) before any mutating call. Products declare their own permission strings.

Every mutating enterprise action must append an AuditLogEntry to the append-only AuditLogRepository.

Secure interopLink to this section: Secure interop

Cross-product calls go through AfterSecureInteropBridge: After ID audience, scopes, RBAC and org membership, then a mandatory audit entry.

  1. After ID audience check
  2. Scopes, RBAC and organization membership when an organization is present
  3. Mandatory audit entry
  4. Optional data minimization by endpoint schema

ADR-006 (opens in a new tab)

Bootstrap modeLink to this section: Bootstrap mode

In production mode a missing adapter throws at startup, so mock providers cannot silently reach production.

dart
/// Composition safety mode (ADR-007).
///
/// - [scaffold]: in-memory / mock adapters are allowed (templates, tests).
/// - [production]: missing real adapters must throw at startup.
enum AfterBootstrapMode {
  scaffold,
  production,
}

Source supercore/packages/after_core/lib/src/bootstrap/after_bootstrap_mode.dart (opens in a new tab)

ADR-007 (opens in a new tab)

Enterprise portsLink to this section: Enterprise ports

Real backends replace MockEnterpriseRepository at the composition root. The OS layer never learns the vendor's name.

  • EnterpriseScope
  • OrganizationRepository
  • RbacRepository
  • PermissionSet
  • WorkflowEngine
  • TaskRepository
  • CalendarRepository
  • DocumentRepository
  • EnterpriseAiAssistant
  • AuditLogRepository
  • OfflineSyncQueue
  • EnterpriseApiClient
  • MockEnterpriseRepository
  • EnterpriseProductRuntime
dart
static Future<List<Override>> ensureConfigured({
  EnterpriseRepository? enterpriseRepository,
}) async {
  PlatformConfig.current = superAppEnterpriseManifest;
  final prefs = await SharedPreferences.getInstance();
  return [
    ...AfterStandardOverrides.create(
      preferences: prefs,
      userAgent: '${superAppEnterpriseManifest.appName}/'
          '${superAppEnterpriseManifest.appId}',
    ),
    enterpriseRepositoryProvider.overrideWithValue(
      enterpriseRepository ?? MockEnterpriseRepository(),
    ),
  ];
}

Source supercore/templates/super_app_enterprise/after_framework.dart (opens in a new tab)

These are architectural controls documented in the supercore repository. After Framework makes no claims of certification or regulatory compliance.