/// <summary> /// Constructor /// </summary> /// <param name="settings"></param> /// <param name="renderModelFactory"></param> public RenderViewEngine(RebelSettings settings, IRenderModelFactory renderModelFactory) { // TODO: Resolve TwoLevelViewCache problems in release builds, as it seems to cache views without taking parent folder into account ViewLocationCache = DefaultViewLocationCache.Null; //if (HttpContext.Current == null || HttpContext.Current.IsDebuggingEnabled) //{ // ViewLocationCache = DefaultViewLocationCache.Null; //} //else //{ // //override the view location cache with our 2 level view location cache // ViewLocationCache = new TwoLevelViewCache(ViewLocationCache); //} _settings = settings; var replaceWithRebelFolder = _supplementedViewLocations.ForEach(location => _settings.RebelFolders.TemplateFolder + location); var replacePartialWithRebelFolder = _supplementedPartialViewLocations.ForEach(location => _settings.RebelFolders.TemplateFolder + location); //The Render view engine doesn't support Area's so make those blank ViewLocationFormats = replaceWithRebelFolder.ToArray(); PartialViewLocationFormats = replacePartialWithRebelFolder.ToArray(); AreaPartialViewLocationFormats = new string[] {}; AreaViewLocationFormats = new string[] {}; }
public async Task LocalDocuments() { var local = _rebels.LocalDocuments; var docId = "传"; var settings = new RebelSettings { Id = docId, IsActive = true }; await local.CreateOrUpdateAsync(settings); settings = await local.GetAsync <RebelSettings>(docId); Assert.True(settings.IsActive); settings.IsActive = false; await local.CreateOrUpdateAsync(settings); settings = await local.GetAsync <RebelSettings>(docId); Assert.False(settings.IsActive); var searchOpt = new LocalDocumentsOptions { Descending = true, Limit = 10, Conflicts = true }; var docs = await local.GetAsync(searchOpt); var containsId = docs.Select(d => d.Id).Contains("_local/" + docId); Assert.True(containsId); }
/// <summary> /// Constructor /// </summary> /// <param name="settings"></param> /// <param name="mapPath">A delegate method used to perform a Server.MapPath operation</param> public DefaultPackageContext(RebelSettings settings, Func <string, string> mapPath) { _settings = settings; _pluginInstallFolderPath = mapPath(_settings.PluginConfig.PluginsPath + "/Packages"); _localPackageRepoFolderPath = mapPath(_settings.RebelFolders.LocalPackageRepositoryFolder); //create lazy instances of each _localPackageRepository = new Lazy <IPackageRepository>( () => { //create a new path resolver with false as 'useSideBySidePaths' so that it doesn't install with version numbers. var packageFileSys = new PhysicalFileSystem(_localPackageRepoFolderPath); var packagePathResolver = new DefaultPackagePathResolver(packageFileSys, false); return(new LocalPackageRepository(packagePathResolver, packageFileSys, true)); }); _localPackageManager = new Lazy <IPackageManager>( () => { //create a new path resolver with false as 'useSideBySidePaths' so that it doesn't install with version numbers. var packageFileSys = new PhysicalFileSystem(_pluginInstallFolderPath); var packagePathResolver = new DefaultPackagePathResolver(packageFileSys, false); return(new PackageManager(_localPackageRepository.Value, packagePathResolver, packageFileSys)); }); // Public packages _publicPackageRepository = new Lazy <IPackageRepository>( () => PackageRepositoryFactory.Default.CreateRepository(_settings.PublicPackageRepository.RepositoryAddress)); _publicPackageManager = new Lazy <IPackageManager>( () => new PackageManager(_publicPackageRepository.Value, mapPath(_settings.PluginConfig.PluginsPath + "/Packages"))); }
/// <summary> /// Constructor /// </summary> /// <param name="settings"></param> /// <param name="mapPath">A delegate method used to perform a Server.MapPath operation</param> public DefaultPackageContext(RebelSettings settings, Func<string, string> mapPath) { _settings = settings; _pluginInstallFolderPath = mapPath(_settings.PluginConfig.PluginsPath + "/Packages"); _localPackageRepoFolderPath = mapPath(_settings.RebelFolders.LocalPackageRepositoryFolder); //create lazy instances of each _localPackageRepository = new Lazy<IPackageRepository>( () => { //create a new path resolver with false as 'useSideBySidePaths' so that it doesn't install with version numbers. var packageFileSys = new PhysicalFileSystem(_localPackageRepoFolderPath); var packagePathResolver = new DefaultPackagePathResolver(packageFileSys, false); return new LocalPackageRepository(packagePathResolver, packageFileSys, true); }); _localPackageManager = new Lazy<IPackageManager>( () => { //create a new path resolver with false as 'useSideBySidePaths' so that it doesn't install with version numbers. var packageFileSys = new PhysicalFileSystem(_pluginInstallFolderPath); var packagePathResolver = new DefaultPackagePathResolver(packageFileSys, false); return new PackageManager(_localPackageRepository.Value, packagePathResolver, packageFileSys); }); // Public packages _publicPackageRepository = new Lazy<IPackageRepository>( () => PackageRepositoryFactory.Default.CreateRepository(_settings.PublicPackageRepository.RepositoryAddress)); _publicPackageManager = new Lazy<IPackageManager>( () => new PackageManager(_publicPackageRepository.Value, mapPath(_settings.PluginConfig.PluginsPath + "/Packages"))); }
/// <summary> /// /// </summary> /// <param name="hive"></param> /// <param name="settings"></param> /// <param name="frameworkContext"></param> public FakeRebelApplicationContext(IHiveManager hive, RebelSettings settings, IFrameworkContext frameworkContext) : this(hive) { Hive = hive; Settings = settings; FrameworkContext = frameworkContext; }
public CmsBootstrapper(RebelSettings settings, RebelAreaRegistration areaRegistration, InstallAreaRegistration installRegistration, IEnumerable<PackageAreaRegistration> componentAreas) { _areaRegistration = areaRegistration; _installRegistration = installRegistration; _componentAreas = componentAreas; _settings = settings; _attributeTypeRegistry = new DependencyResolverAttributeTypeRegistry(); }
public CmsBootstrapper(RebelSettings settings, RebelAreaRegistration areaRegistration, InstallAreaRegistration installRegistration, IEnumerable <PackageAreaRegistration> componentAreas) { _areaRegistration = areaRegistration; _installRegistration = installRegistration; _componentAreas = componentAreas; _settings = settings; _attributeTypeRegistry = new DependencyResolverAttributeTypeRegistry(); }
public CmsBootstrapper(RebelSettings settings, RebelAreaRegistration areaRegistration, InstallAreaRegistration installRegistration, IEnumerable<PackageAreaRegistration> componentAreas, IAttributeTypeRegistry attributeTypeRegistry) { _areaRegistration = areaRegistration; _installRegistration = installRegistration; _componentAreas = componentAreas; _attributeTypeRegistry = attributeTypeRegistry; _settings = settings; }
public CmsBootstrapper(RebelSettings settings, RebelAreaRegistration areaRegistration, InstallAreaRegistration installRegistration, IEnumerable <PackageAreaRegistration> componentAreas, IAttributeTypeRegistry attributeTypeRegistry) { _areaRegistration = areaRegistration; _installRegistration = installRegistration; _componentAreas = componentAreas; _attributeTypeRegistry = attributeTypeRegistry; _settings = settings; }
public static string ResolveLayoutPath(string path, File file) { if (path.StartsWith("~") || path.StartsWith("/")) { path = HttpContext.Current.Server.MapPath(path); } else if (file != null) { path = file.RootedPath.Substring(0, file.RootedPath.LastIndexOf("\\")) + "\\" + path; } else { path = HttpContext.Current.Server.MapPath(RebelSettings.GetSettings().RebelFolders.TemplateFolder) + "\\" + path; } return(path); }
/// <summary> /// Constructor /// </summary> /// <param name="settings"></param> /// <param name="packageContext"></param> public PluginViewEngine(RebelSettings settings, IPackageContext packageContext) { _settings = settings; _packageContext = packageContext; // TODO: Resolve TwoLevelViewCache problems in release builds, as it seems to cache views without taking parent folder into account ViewLocationCache = DefaultViewLocationCache.Null; //if (HttpContext.Current == null || HttpContext.Current.IsDebuggingEnabled) //{ // ViewLocationCache = DefaultViewLocationCache.Null; //} //else //{ // //override the view location cache with our 2 level view location cache // ViewLocationCache = new TwoLevelViewCache(ViewLocationCache); //} SetViewLocations(); }
/// <summary> /// Authenticates the request by reading the FormsAuthentication cookie and setting the /// context and thread principle object /// </summary> /// <param name="sender"></param> /// <param name="e"></param> static void AuthenticateRequest(object sender, EventArgs e) { var app = (HttpApplication)sender; var http = new HttpContextWrapper(app.Context); //we need to determine if the path being requested is an rebel path, if not don't do anything var settings = RebelSettings.GetSettings(); var backOfficeRoutePath = string.Concat(settings.RebelPaths.BackOfficePath, "/"); var installerRoutePath = string.Concat("Install", "/"); //Retreive Route Url var routeUrl = ""; var routeData = RouteTable.Routes.GetRouteData(http); if (routeData != null) { var route = routeData.Route as Route; if (route != null) { routeUrl = route.Url; } } if (routeUrl.StartsWith(installerRoutePath, StringComparison.CurrentCultureIgnoreCase) || routeUrl.StartsWith(backOfficeRoutePath, StringComparison.CurrentCultureIgnoreCase)) { var ticket = http.GetRebelAuthTicket(); if (ticket != null && !ticket.Expired && http.RenewRebelAuthTicket()) { //create the Rebel user identity var identity = new RebelBackOfficeIdentity(ticket); //set the principal object var principal = new GenericPrincipal(identity, identity.Roles); app.Context.User = principal; Thread.CurrentPrincipal = principal; } } }
public RebelApplicationContext( //ICmsHiveManager hive, //HiveManager hive, RebelSettings settings, IFrameworkContext frameworkContext, ISecurityService securityService) { //Hive = hive; Settings = settings; FrameworkContext = frameworkContext; Security = securityService; IsFirstRun = true; //Hive2 = hive2; //Hive2 = DependencyResolver.Current.GetService<HiveManager>(); //TODO: Use this cache mechanism! But in order to do so , we need triggers working from Hive providers, currently they are not setup //clear our status cache when any hive install status changes frameworkContext.TaskManager.AddDelegateTask( TaskTriggers.Hive.InstallStatusChanged, x => _installStatuses = null); }
public FakeRebelApplicationContext(IHiveManager hive, bool addSystemRooNode = true) { ApplicationId = Guid.NewGuid(); //_repo = new NHibernateInMemoryRepository(cmsManager.CoreManager.FrameworkContext); Hive = hive; FrameworkContext = Hive.FrameworkContext; //Security = MockRepository.GenerateMock<ISecurityService>(); Security = Substitute.For <ISecurityService>(); Security.Permissions.GetEffectivePermission(Arg.Any <Guid>(), Arg.Any <HiveId>(), Arg.Any <HiveId>()) .Returns(new PermissionResult(new BackOfficeAccessPermission(), HiveId.Empty, PermissionStatus.Allow)); Security.Permissions.GetEffectivePermissions(Arg.Any <HiveId>(), Arg.Any <HiveId>(), Arg.Any <Guid[]>()) .Returns(new PermissionResults(new PermissionResult(new BackOfficeAccessPermission(), HiveId.Empty, PermissionStatus.Allow))); if (addSystemRooNode) { //we need to add the root node // Create root node var root = new SystemRoot(); AddPersistenceData(root); } //get the bin folder var binFolder = Common.CurrentAssemblyDirectory; //get settings var settingsFile = new FileInfo(Path.Combine(binFolder, "web.config")); Settings = new RebelSettings(settingsFile); //FrameworkContext.Stub(x => x.CurrentLanguage).Return((LanguageInfo) Thread.CurrentThread.CurrentCulture); //FrameworkContext.Stub(x => x.TextManager).Return(MockRepository.GenerateMock<TextManager>()); }
public ApplicationIconFileResolver(HttpServerUtilityBase server, RebelSettings settings, UrlHelper url) : base(new DirectoryInfo(server.MapPath(settings.RebelFolders.ApplicationIconFolder)), url) { }
public IDictionary <string, string> GetData() { return(RebelSettings.GetSettings().Applications.ToDictionary(x => x.Alias, y => y.Name)); }
/// <summary> /// Returns the full unique url for an Editor /// </summary> /// <param name="url">The URL.</param> /// <param name="action">The action.</param> /// <param name="id">A HiveId object or null if no id is required</param> /// <param name="editorId">The editor id.</param> /// <param name="preResolvedComponentRegistrations">The pre resolved component registrations.</param> /// <param name="preResovledSettings"></param> /// <returns></returns> public static string GetEditorUrl(this UrlHelper url, string action, HiveId?id, Guid editorId, ComponentRegistrations preResolvedComponentRegistrations, RebelSettings preResovledSettings) { var idVal = GetIdVal(id); return(url.GetEditorUrl(action, editorId, new { id = idVal }, preResolvedComponentRegistrations, preResovledSettings)); }
public static string GetEditorUrl(this UrlHelper url, string action, Guid editorId, object actionParams, ComponentRegistrations preResolvedComponentRegistrations, RebelSettings preResovledSettings) { var editorMetaData = preResolvedComponentRegistrations .EditorControllers .Where(x => x.Metadata.Id == editorId) .SingleOrDefault(); if (editorMetaData == null) { throw new InvalidOperationException("Could not find the editor controller with id " + editorId); } var routeValDictionary = new RouteValueDictionary(actionParams); routeValDictionary["editorId"] = editorId.ToString("N"); var area = preResovledSettings.RebelPaths.BackOfficePath; //now, need to figure out what area this editor belongs too... var pluginDefinition = editorMetaData.Metadata.PluginDefinition; if (pluginDefinition.HasRoutablePackageArea()) { area = pluginDefinition.PackageName; } //add the plugin area to our collection routeValDictionary["area"] = area; var resolvedUrl = url.Action(action, editorMetaData.Metadata.ControllerName, routeValDictionary); return(resolvedUrl); }
public InstallAreaRegistration(RebelSettings rebelSettings) { _rebelSettings = rebelSettings; }
/// <summary> /// Returns the editor url using the default action /// </summary> /// <param name="url">The URL.</param> /// <param name="id">The id.</param> /// <param name="editorId">The editor id.</param> /// <param name="preResolvedComponentRegistrations">The pre resolved component registrations.</param> /// <param name="preResovledSettings"></param> /// <returns></returns> public static string GetEditorUrl(this UrlHelper url, HiveId id, Guid editorId, ComponentRegistrations preResolvedComponentRegistrations, RebelSettings preResovledSettings) { return(url.GetEditorUrl("Edit", id, editorId, preResolvedComponentRegistrations, preResovledSettings)); }
public static void Initialize() { using (new WriteLockDisposable(Locker)) { using (DisposableTimer.TraceDuration <PluginManager>("Start Initialise", "End Initialise")) { var settings = RebelSettings.GetSettings(); try { LogHelper.TraceIfEnabled <PluginManager>("Codegen dir is {0}", () => HttpRuntime.CodegenDir); } catch { LogHelper.TraceIfEnabled <PluginManager>("Was going to log Codegendir but couldn't get it from HttpRuntime"); } var pluginPath = HostingEnvironment.MapPath(settings.PluginConfig.PluginsPath); _pluginFolder = new DirectoryInfo(pluginPath); _shadowCopyType = settings.PluginConfig.ShadowCopyType; //default is bin _shadowCopyFolder = new DirectoryInfo(HostingEnvironment.MapPath("~/bin")); if (_shadowCopyType == PluginManagerShadowCopyType.OverrideDefaultFolder) { var shadowCopyPath = HostingEnvironment.MapPath(settings.PluginConfig.ShadowCopyPath); //if override is set, then use the one defined in config _shadowCopyFolder = new DirectoryInfo(shadowCopyPath); } else if (IsFullTrust() && _shadowCopyType == PluginManagerShadowCopyType.UseDynamicFolder) { //if in full trust and use dynamic folder, then set to CodeGen folder _shadowCopyFolder = new DirectoryInfo(AppDomain.CurrentDomain.DynamicDirectory); } var referencedPlugins = new List <PluginDefinition>(); var pluginFiles = Enumerable.Empty <FileInfo>(); try { //ensure folders are created Directory.CreateDirectory(_pluginFolder.FullName); if (_shadowCopyType != PluginManagerShadowCopyType.UseDynamicFolder) { Directory.CreateDirectory(_shadowCopyFolder.FullName); } Directory.CreateDirectory(Path.Combine(_pluginFolder.FullName, PackagesFolderName)); using (DisposableTimer.TraceDuration <PluginManager>("Finding plugin DLLs", "Finding plugin DLLs completed")) { //get list of all DLLs in plugins (not in bin!) //this will match the plugin folder pattern pluginFiles = _pluginFolder.GetFiles("*.dll", SearchOption.AllDirectories) .ToArray() // -> this magically reduces the time by about 100ms .Where(x => x.Directory.Parent != null && (IsPackageLibFolder(x.Directory))) .ToList(); } } catch (Exception ex) { var fail = new ApplicationException("Could not initialise plugin folder", ex); LogHelper.Error <PluginManager>(fail.Message, fail); //throw fail; } try { //Detect if there are any changes to plugins and perform any cleanup if in full trust using the dynamic folder if (DetectAndCleanStalePlugins(pluginFiles, _shadowCopyFolder)) { //if plugins changes have been detected, then shadow copy and re-save the cache files LogHelper.TraceIfEnabled <PluginManager>("Shadow copying assemblies"); //shadow copy files referencedPlugins .AddRange(pluginFiles.Select(plug => new PluginDefinition(plug, GetPackageFolderFromPluginDll(plug), PerformFileDeployAndRegistration(plug, true), plug.Directory.Parent.Name == "Core"))); //save our plugin hash value WriteCachePluginsHash(pluginFiles); //save our plugins list WriteCachePluginsList(pluginFiles); var codeBase = typeof(PluginManager).Assembly.CodeBase; var uri = new Uri(codeBase); var path = uri.LocalPath; var binFolder = Path.GetDirectoryName(path); if (_shadowCopyFolder.FullName.InvariantEquals(binFolder)) { LogHelper.Warn <PluginManager>("Performance: An app-pool recycle is likely to occur shortly because plugin changes were detected and shadow-copied to the bin folder"); } } else { LogHelper.TraceIfEnabled <PluginManager>("No plugin changes detected"); referencedPlugins .AddRange(pluginFiles.Select(plug => new PluginDefinition(plug, GetPackageFolderFromPluginDll(plug), PerformFileDeployAndRegistration(plug, false), plug.Directory.Parent.Name == "Core"))); } } catch (UnauthorizedAccessException) { //throw the exception if its UnauthorizedAccessException as this will //be because we cannot copy to the shadow copy folder, or update the rebel plugin hash/list files. throw; } catch (Exception ex) { var fail = new ApplicationException("Could not initialise plugin folder", ex); LogHelper.Error <PluginManager>(fail.Message, fail); //throw fail; } ReferencedPlugins = referencedPlugins; } } }
public DocumentTypeThumbnailFileResolver(HttpServerUtilityBase server, RebelSettings settings, UrlHelper url) : base(new DirectoryInfo(server.MapPath(settings.RebelFolders.DocTypeThumbnailFolder)), url) { }
public DocumentTypeIconFileResolver(HttpServerUtilityBase server, RebelSettings settings, UrlHelper url) : base(new DirectoryInfo(server.MapPath(settings.RebelFolders.DocTypeIconFolder)), url) { }
/// <summary> /// Custom constructor that can be used to assign a custom IComponentRegistrar /// </summary> /// <param name="httpApp"></param> /// <param name="componentRegistrar"></param> /// <param name="settings"></param> public RebelContainerBuilder(TWebApp httpApp, IComponentRegistrar componentRegistrar, RebelSettings settings) { _httpApp = httpApp; _componentRegistrar = componentRegistrar; _settings = settings; }
/// <summary> /// Default constructor that uses the standard RebelComponentRegistrar as the IComponentRegistrar /// </summary> /// <param name="httpApp"></param> public RebelContainerBuilder(TWebApp httpApp) { _httpApp = httpApp; _settings = RebelSettings.GetSettings(); _componentRegistrar = new RebelComponentRegistrar(); }
/// <summary>Builds the dependency demands required by this implementation. </summary> /// <param name="builder">The <see cref="IContainerBuilder"/> .</param> /// <param name="builderContext"></param> public void Build(IContainerBuilder builder, IBuilderContext builderContext) { //raise the building event OnContainerBuilding(new ContainerBuilderEventArgs(builder)); //register all of the abstract web types builder.AddDependencyDemandBuilder(new WebTypesDemandBuilder(_httpApp)); var typeFinder = new TypeFinder(); builder.ForInstanceOfType(typeFinder) .ScopedAs.Singleton(); //register the rebel settings builder.ForFactory(x => RebelSettings.GetSettings()) .KnownAsSelf() .ScopedAs.Singleton(); //only have one instance ever //register our MVC types builder.AddDependencyDemandBuilder(new MvcTypesDemandBuilder(typeFinder)); // Register the IRoutableRequestContext builder.For <HttpRequestScopedCache>().KnownAs <AbstractScopedCache>().ScopedAs.Singleton(); builder.For <HttpRuntimeApplicationCache>().KnownAs <AbstractApplicationCache>().ScopedAs.Singleton(); builder.For <HttpRequestScopedFinalizer>().KnownAs <AbstractFinalizer>().ScopedAs.Singleton(); //builder.For<DefaultFrameworkContext>().KnownAs<IFrameworkContext>().ScopedAs.Singleton(); builder.For <RebelApplicationContext>().KnownAs <IRebelApplicationContext>().ScopedAs.Singleton(); builder.For <RoutableRequestContext>().KnownAs <IRoutableRequestContext>().ScopedAs.HttpRequest(); builder.For <DefaultBackOfficeRequestContext>().KnownAs <IBackOfficeRequestContext>().ScopedAs.HttpRequest(); // TODO: Ensure this isn't created manually anywhere but tests, only via a factory: builder.ForType<IRebelRenderModel, RebelRenderContext>().Register().ScopedPerHttpRequest(); builder.For <DefaultRenderModelFactory>().KnownAs <IRenderModelFactory>(). ScopedAs.Singleton(); // Register Hive provider //builder.AddDependencyDemandBuilder(new HiveDemandBuilder()); builder.AddDependencyDemandBuilder(new Hive.DemandBuilders.HiveDemandBuilder()); // Register Persistence provider loader //builder.AddDependencyDemandBuilder(new Framework.Persistence.DependencyManagement.DemandBuilders.LoadFromPersistenceConfig()); builder.AddDependencyDemandBuilder(new Hive.DemandBuilders.LoadFromPersistenceConfig()); // Register Cms bootstrapper // TODO: Split RebelContainerBuilder between Cms and Frontend variants / needs builder.For <CmsBootstrapper>().KnownAsSelf(); // Register Frontend bootstrapper builder.ForFactory( x => new RenderBootstrapper( x.Resolve <IRebelApplicationContext>(), x.Resolve <IRouteHandler>(RenderRouteHandler.SingletonServiceName), x.Resolve <IRenderModelFactory>()) ) .KnownAsSelf(); //register all component areas, loop through all found package folders //TODO: All other places querying for packages use the NuGet IO FileManager stuff, not the standard .Net IO classes var pluginFolder = new DirectoryInfo(_httpApp.Server.MapPath(_settings.PluginConfig.PluginsPath)); foreach (var package in pluginFolder.GetDirectories(PluginManager.PackagesFolderName) .SelectMany(x => x.GetDirectories() .Where(PluginManager.IsPackagePluginFolder))) { //register an area for this package builder.For <PackageAreaRegistration>() .KnownAsSelf() .WithNamedParam("packageFolder", package); } //register the RoutingEngine builder .For <DefaultRoutingEngine>() .KnownAs <IRoutingEngine>() .ScopedAs.HttpRequest(); //register the package context builder .ForFactory(x => new DefaultPackageContext(x.Resolve <RebelSettings>(), HostingEnvironment.MapPath)) //.For<DefaultPackageContext>() .KnownAs <IPackageContext>() .ScopedAs.Singleton(); //register the PropertyEditorFactory builder.For <PropertyEditorFactory>() .KnownAs <IPropertyEditorFactory>() .ScopedAs.Singleton(); //register the ParameterEditorFactory builder.For <ParameterEditorFactory>() .KnownAs <IParameterEditorFactory>() .ScopedAs.Singleton(); //register the SecurityService builder.ForFactory( x => new SecurityService( x.Resolve <IMembershipService <User> >(), x.Resolve <IMembershipService <Member> >(), x.Resolve <IPermissionsService>(), x.Resolve <IPublicAccessService>())) .KnownAs <ISecurityService>(); //register the MembershipService builder.ForFactory( x => { var frameworkContext = x.Resolve <IFrameworkContext>(); var hiveManager = x.Resolve <IHiveManager>(); MembershipProvider membershipProvider = Membership.Providers["UsersMembershipProvider"]; return(new MembershipService <User, UserProfile>( frameworkContext, hiveManager, "security://user-profiles", "security://user-groups", FixedHiveIds.UserProfileVirtualRoot, membershipProvider, _settings.MembershipProviders)); }) .KnownAs <IMembershipService <User> >() .ScopedAs.Singleton(); builder.ForFactory( x => new MembershipService <Member, MemberProfile>( x.Resolve <IFrameworkContext>(), x.Resolve <IHiveManager>(), "security://member-profiles", "security://member-groups", FixedHiveIds.MemberProfileVirtualRoot, Membership.Providers["MembersMembershipProvider"], _settings.MembershipProviders) ) .KnownAs <IMembershipService <Member> >() .ScopedAs.Singleton(); builder.ForFactory( x => new PermissionsService( x.Resolve <IHiveManager>(), x.Resolve <IEnumerable <Lazy <Permission, PermissionMetadata> > >(), x.Resolve <IMembershipService <User> >())) .KnownAs <IPermissionsService>() .ScopedAs.Singleton(); builder.ForFactory( x => new PublicAccessService( x.Resolve <IHiveManager>(), x.Resolve <IMembershipService <Member> >(), x.Resolve <IFrameworkContext>())) .KnownAs <IPublicAccessService>() .ScopedAs.Singleton(); //register the CmsAttributeTypeRegistry builder.For <CmsAttributeTypeRegistry>() .KnownAs <IAttributeTypeRegistry>() .ScopedAs.Singleton(); //component registration _componentRegistrar.RegisterTasks(builder, typeFinder); _componentRegistrar.RegisterTreeControllers(builder, typeFinder); _componentRegistrar.RegisterPropertyEditors(builder, typeFinder); _componentRegistrar.RegisterParameterEditors(builder, typeFinder); _componentRegistrar.RegisterEditorControllers(builder, typeFinder); _componentRegistrar.RegisterMenuItems(builder, typeFinder); _componentRegistrar.RegisterSurfaceControllers(builder, typeFinder); _componentRegistrar.RegisterDashboardFilters(builder, typeFinder); _componentRegistrar.RegisterDashboardMatchRules(builder, typeFinder); _componentRegistrar.RegisterPermissions(builder, typeFinder); _componentRegistrar.RegisterMacroEngines(builder, typeFinder); //register the registrations builder.For <ComponentRegistrations>().KnownAsSelf(); //register task manager builder.For <ApplicationTaskManager>().KnownAsSelf().ScopedAs.Singleton(); //register our model mappings and resolvers builder.AddDependencyDemandBuilder(new ModelMappingsDemandBuilder()); //TODO: More stuff should happen with the TextManager here (e.g. db access and whatnot) //The user may later override settings, most importantly the LocalizationConfig.CurrentTextManager delegate to implement different environments //The text manager is assumed to be set up by the framework var textManager = LocalizationConfig.TextManager; LocalizationWebConfig.ApplyDefaults <TWebApp>(textManager, overridesPath: "~/App_Data/Rebel/LocalizationEntries.xml"); LocalizationWebConfig.SetupMvcDefaults(setupMetadata: false); //The name of the assembly that contains common texts textManager.FallbackNamespaces.Add("Rebel.Cms.Web"); OnContainerBuildingComplete(new ContainerBuilderEventArgs(builder)); }
static AuthenticationExtensions() { _settings = RebelSettings.GetSettings(); }