/// <summary> /// Sets the execution context for any queries or commands /// chained of this instance. Typically used to impersonate /// a user, elevate permissions or maintain context in nested /// query or command execution. /// </summary> /// <param name="executionContext"> /// The execution context instance to use. /// </param> public static IContentRepository WithExecutionContext(this IContentRepository contentRepository, IExecutionContext executionContext) { if (executionContext == null) { throw new ArgumentNullException(nameof(executionContext)); } var extendedContentRepositry = contentRepository.AsExtendableContentRepository(); var newRepository = extendedContentRepositry.ServiceProvider.GetRequiredService <IContentRepositoryWithCustomExecutionContext>(); newRepository.SetExecutionContext(executionContext); return(newRepository); }
/// <summary> /// Queries and commands relating to document assets. /// </summary> public static IContentRepositoryDocumentAssetRepository DocumentAssets(this IContentRepository contentRepository) { return(new ContentRepositoryDocumentAssetRepository(contentRepository.AsExtendableContentRepository())); }
/// <summary> /// PageDirectories represent a folder in the dynamic web page hierarchy. /// </summary> public static IContentRepositoryPageDirectoryRepository PageDirectories(this IContentRepository contentRepository) { return(new ContentRepositoryPageDirectoryRepository(contentRepository.AsExtendableContentRepository())); }
/// <summary> /// Queries and commands relating to users from the Cofoundry identity /// system. This includes users from both the Cofoundry admin user area /// and any custom user areas. /// </summary> public static IContentRepositoryUserRepository Users(this IContentRepository contentRepository) { return(new ContentRepositoryUserRepository(contentRepository.AsExtendableContentRepository())); }
/// <summary> /// Runs any queries or commands chained off this instance under /// the system user account which has no permission restrictions. /// This is useful when you need to perform an action that the currently /// logged in user does not have permission for, e.g. signing up a new /// user prior to login. /// </summary> public static IContentRepository WithElevatedPermissions(this IContentRepository contentRepository) { var extendedApi = contentRepository.AsExtendableContentRepository(); return(extendedApi.ServiceProvider.GetRequiredService <IContentRepositoryWithElevatedPermissions>()); }
/// <summary> /// Used to manage transactions for multiple domain commands. /// This abstraction is an enhanced version of /// System.Transaction.TransactionScope and works in the same way. /// </summary> public static IContentRepositoryTransactionManager Transactions(this IContentRepository contentRepository) { var extendedContentRepositry = contentRepository.AsExtendableContentRepository(); return(extendedContentRepositry.ServiceProvider.GetRequiredService <IContentRepositoryTransactionManager>()); }
/// <summary> /// Custom entities are a flexible system for developer defined /// data structures which can be fully managed in the admin panel /// with minimal configuration. /// </summary> public static IContentRepositoryCustomEntityRepository CustomEntities(this IContentRepository contentRepository) { return(new ContentRepositoryCustomEntityRepository(contentRepository.AsExtendableContentRepository())); }