示例#1
0
        /// <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 IAdvancedContentRepository WithExecutionContext(this IAdvancedContentRepository 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);
        }
示例#2
0
 /// <summary>
 /// Queries and commands relating to document assets.
 /// </summary>
 public static IAdvancedContentRepositoryDocumentAssetRepository DocumentAssets(this IAdvancedContentRepository contentRepository)
 {
     return(new AdvancedContentRepositoryDocumentAssetRepository(contentRepository.AsExtendableContentRepository()));
 }
 /// <summary>
 /// PageDirectories represent a folder in the dynamic web page hierarchy.
 /// </summary>
 public static IAdvancedContentRepositoryPageDirectoryRepository PageDirectories(this IAdvancedContentRepository contentRepository)
 {
     return(new AdvancedContentRepositoryPageDirectoryRepository(contentRepository.AsExtendableContentRepository()));
 }
示例#4
0
 /// <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 IAdvancedContentRepositoryUserRepository Users(this IAdvancedContentRepository contentRepository)
 {
     return(new ContentRepositoryUserRepository(contentRepository.AsExtendableContentRepository()));
 }
 /// <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 IAdvancedContentRepositoryCustomEntityRepository CustomEntities(this IAdvancedContentRepository contentRepository)
 {
     return(new AdvancedContentRepositoryCustomEntityRepository(contentRepository.AsExtendableContentRepository()));
 }
 /// <summary>
 /// <para>
 /// Authorized tasks represent a single user-based operation that can be executed without
 /// being logged in. Task authorization is validated by a crytographically random
 /// generated token, often communicated via an out-of-band communication mechanism
 /// such as an email. Examples include password reset or email address validation flows.
 /// </para>
 /// <para>
 /// Tasks tend to be single-use and can be marked when completed, and can also be
 /// invalidated explicitly. They can also be rate-limited by IPAddress and time-limited
 /// by validating against the <see cref="CreateDate"/>.
 /// </para>
 /// </summary>
 public static IAdvancedContentRepositoryAuthorizedTaskRepository AuthorizedTasks(this IAdvancedContentRepository contentRepository)
 {
     return(new ContentRepositoryAuthorizedTaskRepository(contentRepository.AsExtendableContentRepository()));
 }
示例#7
0
 /// <summary>
 /// Rewrite rules can be used to redirect users from one url to another.
 /// This functionality is incomplete and subject to change.
 /// </summary>
 public static IAdvancedContentRepositoryRewriteRuleRepository RewriteRules(this IAdvancedContentRepository contentRepository)
 {
     return(new ContentRepositoryRewriteRuleRepository(contentRepository.AsExtendableContentRepository()));
 }
示例#8
0
        /// <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 IAdvancedContentRepository WithElevatedPermissions(this IAdvancedContentRepository contentRepository)
        {
            var extendedApi = contentRepository.AsExtendableContentRepository();

            return(extendedApi.ServiceProvider.GetRequiredService <IContentRepositoryWithElevatedPermissions>());
        }
 /// <summary>
 /// Page block types represent a type of content that can be inserted into a content
 /// region of a page which could be simple content like 'RawHtml', 'Image' or
 /// 'PlainText'. Custom and more complex block types can be defined by a
 /// developer. Block types are typically created when the application
 /// starts up in the auto-update process.
 /// </summary>
 public static IAdvancedContentRepositoryPageBlockTypeRepository PageBlockTypes(this IAdvancedContentRepository contentRepository)
 {
     return(new ContentRepositoryPageBlockTypeRepository(contentRepository.AsExtendableContentRepository()));
 }
        /// <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 IAdvancedContentRepository contentRepository)
        {
            var extendedContentRepositry = contentRepository.AsExtendableContentRepository();

            return(extendedContentRepositry.ServiceProvider.GetRequiredService <IContentRepositoryTransactionManager>());
        }