Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Marthin Freij
Feb 11, 2010
  6455
(0 votes)

Configuring page provider capabilities

Page providers requires some configuration. In addition to the obvious ones like name, type and entryPoint you should also define what capabilities your page provider supports, such as Create, Edit, Delete and Search. If you, for example, specify that your provider does not support delete, all delete related ui in edit mode will be disabled for your providers pages. More details on capabilities can be found in the Configuration section of the Page Provider Tech Note.

In almost all examples I have seen for page provider configuration, capabilities are specified in web.config. In my opinion, capabilities should not be defined in configuration. This could lead to, by accident, specifying more capabilities than what is actually implemented in code. I think the best place for this kind of configuration is code. Fortunately, the Capabilities property in PageProviderBase is virtual, which means you can override it and configure it there.

public override PageProviderCapabilities Capabilities
{
    get
    {
        return PageProviderCapabilities.Create | 
            PageProviderCapabilities.Edit | 
            PageProviderCapabilities.Search;
    }
}
Feb 11, 2010

Comments

Sep 21, 2010 10:33 AM

Good one Martin! I totally agree with you.
/ Tom Stenius

Sep 21, 2010 10:33 AM

This is not as good if you want to provide some reusable provider. When you override Capabilities property web.config settings have no effect at all. So someone else won't be able to suppress for example Delete or Create later. I think implementation should be like this:

Math.Min( base.Capabilities & (int)PageProviderCapabilities.Create,
(int)PageProviderCapabilities.Create ) |
Math.Min( base.Capabilities & (int)PageProviderCapabilities.Edit,
(int)PageProviderCapabilities.Edit ) ...
/ Vlad

Please login to comment.
Latest blogs
Solving the mystery of high memory usage

Sometimes, my work is easy, the problem could be resolved with one look (when I’m lucky enough to look at where it needs to be looked, just like th...

Quan Mai | Apr 22, 2024 | Syndicated blog

Search & Navigation reporting improvements

From version 16.1.0 there are some updates on the statistics pages: Add pagination to search phrase list Allows choosing a custom date range to get...

Phong | Apr 22, 2024

Optimizely and the never-ending story of the missing globe!

I've worked with Optimizely CMS for 14 years, and there are two things I'm obsessed with: Link validation and the globe that keeps disappearing on...

Tomas Hensrud Gulla | Apr 18, 2024 | Syndicated blog

Visitor Groups Usage Report For Optimizely CMS 12

This add-on offers detailed information on how visitor groups are used and how effective they are within Optimizely CMS. Editors can monitor and...

Adnan Zameer | Apr 18, 2024 | Syndicated blog