エンタープライズ境界
EnterpriseScope、RBAC、監査、セキュアな相互運用、ブートストラップモードについて説明します。
EnterpriseScopeこのセクションへのリンク: EnterpriseScope
組織スコープのエンタープライズポートには EnterpriseScope が必須です。organizationId が欠けていると例外がスローされ、全テナントのデータを返すことはありません。
/// 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;
}
}ソース supercore/packages/after_enterprise/lib/src/scope/enterprise_scope.dart (新しいタブで開きます)
RBAC と監査このセクションへのリンク: RBAC と監査
バーティカル機能は、変更を伴う呼び出しの前に PermissionSet.allows(...) をチェックします。権限文字列は各プロダクトが独自に宣言します。
変更を伴うエンタープライズ操作はすべて、追記専用の AuditLogRepository に AuditLogEntry を追加する必要があります。
セキュアな相互運用このセクションへのリンク: セキュアな相互運用
プロダクト間の呼び出しは AfterSecureInteropBridge を経由します。After ID のオーディエンス、スコープ、RBAC、組織メンバーシップを確認した後、監査エントリを必ず記録します。
- After ID のオーディエンスチェック
- 組織が存在する場合は、スコープ、RBAC、組織メンバーシップ
- 監査エントリの必須記録
- エンドポイントスキーマによる任意のデータ最小化
ブートストラップモードこのセクションへのリンク: ブートストラップモード
本番モードではアダプターが欠けていると起動時に例外がスローされるため、モックプロバイダーが気付かないうちに本番環境へ入り込むことはありません。
/// 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,
}ソース supercore/packages/after_core/lib/src/bootstrap/after_bootstrap_mode.dart (新しいタブで開きます)
エンタープライズポートこのセクションへのリンク: エンタープライズポート
実際のバックエンドは、コンポジションルートで MockEnterpriseRepository を置き換えます。OS レイヤーがベンダー名を知ることはありません。
- EnterpriseScope
- OrganizationRepository
- RbacRepository
- PermissionSet
- WorkflowEngine
- TaskRepository
- CalendarRepository
- DocumentRepository
- EnterpriseAiAssistant
- AuditLogRepository
- OfflineSyncQueue
- EnterpriseApiClient
- MockEnterpriseRepository
- EnterpriseProductRuntime
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(),
),
];
}ソース supercore/templates/super_app_enterprise/after_framework.dart (新しいタブで開きます)
これらは supercore リポジトリに記載されたアーキテクチャ上の制御です。After Framework は、認証取得や規制への準拠を主張するものではありません。