This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ServiceConfiguration(typeof(IContentQuery)), ServiceConfiguration(typeof(IContentSlice))] | |
public class PagesSlice : ContentSliceBase<StandardPage> | |
{ | |
public override string Name | |
{ | |
get { return "Pages"; } | |
} | |
} | |
[ServiceConfiguration(typeof(IContentQuery)), ServiceConfiguration(typeof(IContentSlice))] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Auth0SynchronizingUserService : SynchronizingUserService | |
{ | |
public override Task SynchronizeAsync(ClaimsIdentity identity) | |
{ | |
//Transform the passed http:/schemas.auth0.com/roles claims to System.Security.Claims | |
foreach (var claim in identity.Claims) | |
{ | |
if (claim.Type == "http://schemas.auth0.com/roles") | |
{ | |
identity.AddClaim(new Claim(ClaimTypes.Role, claim.Value)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function (user, context, callback) { | |
user.roles = []; | |
if (user.name.indexOf('Jones') > -1) | |
{ | |
user.roles.push('WebAdmins'); | |
user.roles.push('WebEditors'); | |
} | |
// all users are member of public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@model ListAllClaimsModel | |
<div> | |
<h3>@Model.BlockTitle</h3> | |
<table class="table table-striped table-condensed"> | |
@*<thead> | |
<tr> | |
<th>Claims</th> | |
</tr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[InitializableModule] | |
[ModuleDependency( typeof(EPiServer.Web. InitializationModule))] | |
public class PriceEventListenerInit : IInitializableModule | |
{ | |
public void Initialize( InitializationEngine context) | |
{ | |
var priceEvents = ServiceLocator.Current.GetInstance<IPriceEvents>(); | |
priceEvents.PriceChanged += contentEvents_PriceChanged; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DebugAwareContentOutputCacheAttribute : ContentOutputCacheAttribute | |
{ | |
public override bool Disable | |
{ | |
get | |
{ | |
if (System.Diagnostics.Debugger.IsAttached) | |
{ | |
return true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CustomIDatabaseFactory : SqlDatabaseFactory, IDatabaseFactory | |
{ | |
public new IDatabaseHandler CreateDefaultHandler() | |
{ | |
SiteDataSettingsElement currentSiteSettings = this.GetCurrentSiteSettings(); | |
ConnectionStringSettings connectionStringSettings = EPiServerDataStoreSection.ConfigurationInstance.ConnectionStrings.ConnectionStrings[currentSiteSettings.ConnectionStringName]; | |
if (connectionStringSettings == null) | |
{ | |
throw new ConfigurationErrorsException(string.Format(CultureInfo.InvariantCulture, "No connection string found with the configured name '{0}'.", new object[] { currentSiteSettings.ConnectionStringName })); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[InitializableModule] | |
[ModuleDependency(typeof(ServiceContainerInitialization))] | |
public class OverrideIDatabaseFactoryImpl : IConfigurableModule | |
{ | |
public void ConfigureContainer(ServiceConfigurationContext context) | |
{ | |
context.Container.Configure(x => { x.For<IDatabaseFactory>().Use<CustomIDatabaseFactory>(); }); | |
} | |
public void Initialize(InitializationEngine context) { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Create a project programmatically | |
/// </summary> | |
/// <param name="projectName">The name of the project, e.g. "Weekly article updates"</param> | |
/// <param name="userName">The username of the person creating the project</param> | |
/// <returns>The newly created project, null if a project with that name already exists</returns> | |
public Project CreateNewProject(string projectName, string userName) | |
{ | |
var repo = ServiceLocator.Current.GetInstance<ProjectRepository>(); | |
var newProject = new Project(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Add items to a project | |
/// </summary> | |
/// <param name="repo">The ProjectRepository instance</param> | |
/// <param name="project">The project to save the items against</param> | |
/// <param name="contentReferences">A list of ContentReferences to add to the project. *Note!* the item to add should be the draft version number, not the current published version number</param> | |
/// <returns>A list of the saved project items</returns> | |
public IList<ProjectItem> AddItemsToProject(ProjectRepository repo, Project project, | |
IList<ContentReference> contentReferences) | |
{ |
OlderNewer