In this post I would like to share an example of implementing a custom SqlAuthorizationProvider
for a Sitecore solution. First things first, you have to really consider using it for a large solution, it’s a customization for accessing items for users and roles and it’s a core functionality of Sitecore XM – this provider is called every time (if no cache hit), when anyone tries to get access to an item – with Experience Editor, Content Editor, Sitecore Item API, etc.).
Tag: customization
Custom layout resolver
Sitecore provides you the possibility to implement your own layout resolver if the default one is not enough for you. Basically you can change the layout of a page based on a business logic without changing the item in the database.
Continue reading “Custom layout resolver”Template dependent field validator WITHOUT Sitecore rules engine
A year ago I have posted about how to create template dependent field validator with rules engine. But it requires too many modifications, so I have decided to write this post about how to do the similar functionality without rules engine.
So at first I have implemented a base class which should be used by all validators which want to be dependent on a template or a base template. This class does the following steps:
- Checks the template ID and base template ID of the current item
- If it is true then the main part is called, this is the following line:
return evaluate();
This is the injected specific validation method which is passed as a parameter.
Continue reading “Template dependent field validator WITHOUT Sitecore rules engine”
WebEdit.AffectWorkflowForDatasourceItems – collect datasource children items
This feature appeared in Sitecore 8.2, which is changing the workflow state value for datasource items together with the context page item (only in Experience Editor). Here is a great summary article related to these improvements.
I was not fully satisfied with this because by default this only collects the datasource items and does not the children items of a datasource. This is an issue when you have something like a list component which shows the children items. What I have found is:
<command name="webedit:workflowwithdatasourceitems" type="Sitecore.ExperienceEditor.WebEdit.Commands.WorkflowWithDatasourceItems, Sitecore.ExperienceEditor" />
Continue reading “WebEdit.AffectWorkflowForDatasourceItems – collect datasource children items”
Editor Extensions – Copy a page with its components
What Sitecore standard copy functionality does:
- Copies the whole item tree under the selected item
- Copies all item versions (if you have more)
- All references (included the datasources in your components) remain the same
So in some cases it is good but especially when you have pages with local component datasources the standard copy function does not really for you.
Continue reading “Editor Extensions – Copy a page with its components”
How to add profile key value programmatically
During my investigation of Sitecore xDB I tried several things and I found out that I want to increase a the value of a profile key programmatically. This question was helpful but it did not provide the whole solution. In some cases maybe you need this. It has been tested on Sitecore 8.2 update 3.
Continue reading “How to add profile key value programmatically”
Sitecore iframe field type basics
A few days ago I implemented a custom field which should have 2 dropdowns which are depending on each other (here you can find the whole implementation, in this example I will just show you a simple text field).
So I checked all possible solutions and I decided to use the IFrame
type for that. This is a default field provided by Sitecore. So in the source input on the template you need to provide the url for your iframe. In my case it will be a Controller:

Template dependent field validator with Sitecore Rules Engine
I got a requirement that I need to create more data templates with the same fields but the fields should have different validations based on the template. So I decided to create a base template and inherit the other templates from this. Now, how can I assign different validators for the fields based on the template?
Continue reading “Template dependent field validator with Sitecore Rules Engine”
Glass Mapper – Edit Frame for all fields dynamically
Today I created a rendering component which has around 10 fields but the whole component is not editable in Experience Editor. I decided to use Edit Frame from Glass Mapper. The BeginEditFrame
wants all the editable fields as a parameter. But for around 10 fields not that comfortable.
The following code snippet creates an Edit Frame only with 1 field.
@using Glass.Mapper.Sc.Web.Mvc | |
@model IYourModel | |
@using (@Html.Glass().BeginEditFrame(Model, "Edit The Component", x => x.Image)) | |
{ | |
// your code | |
} |
Sitecore Name Value List field with special characters
The question came up and wrote it to Sitecore StackExchange. Thank you @jammykam for your answer.
The default Sitecore Name Value List field has an annoying issue. It does not allow to use special characters like ‘-‘ for the key. I just digged into the Sitecore.Kernel library and I found a regular expression validation which is hardcoded.
Let’s overwrite this class make it more flexible. The main issue with the implementation that they don’t encode/decode the URI.
Continue reading “Sitecore Name Value List field with special characters”