Zone and widget permissions

Tom Troughton asked on March 31, 2015 18:41

I recently learned that Kentico has no way to restrict widgets to specific zones, so an editor with permission to use a widget can use it on any zone on any site.

I found this really surprising because obviously when you design a website with a modular approach you intend certain components to appear in very specific places. The idea that an editor can be allowed such freedom worries me enormously in terms of content governance.

Has anyone implemented, or if not can anyone recommend, a means to implement the necessary restrictions? For instance, is there an event I can handle when a widget is added where I might check some custom permission logic?

Thanks in advance.

Recent Answers


Brenden Kehren answered on March 31, 2015 20:00

Set roles and assign them to users. Roles will allow/disallow permissions to specific widgets and such. Widgets can be limited by site as well. You can also specify which widgets can be used in which zones by defining that zone to be a widget zone. This way not all your zones are widget zones and can be coded as such.

0 votesVote for this answer Mark as a Correct answer

Tom Troughton answered on April 1, 2015 11:07

Thanks Brenden, are you able to elaborate on your comment "You can also specify which widgets can be used in which zones by defining that zone to be a widget zone"? I can't see any way to restrict widgets to specific widget zones. I realise widgets can be restricted by site and role, but as far as I can tell once a site editor does have access to a widget they can place it in any widget zone on that site.

Of course for many zones this wouldn't make sense. If I'm right it is essential I find a way to restrict widgets to zones or as far as I'm concerned Kentico is not fit for purpose. I've worked with enough large corporate clients to know that they'll see this as a significant problem. They'll have to rely on trust to ensure their editors use the correct widgets. So I'm hoping someone can suggest a potential customisation to work around this limitation.

To give a simple example, I might define a widget zone on a products landing page where I want to allow users to add spotlights to showcase specific products. This zone has a very clear purpose. Not only is it impossible to enforce this purpose, but it's also confusing for editors to be given so many unrelated widgets to choose from.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on April 1, 2015 16:19

You are correct, you cannot specifically restrict a specific widget to a widget zone. This feature does not exist from what I have seen. You can however setup security roles and restrict widgets to those roles users are assigned to which would make their selection list smaller.

I'm not certain there are global events you can capture for adding widgets to zones but that might be a place to start. I'm not 100% sure this will all work but hypothetically:

  • Create a link between webpart zones and widgets (maybe a simple 2 column table)
  • On the add to zone event (if it can be captured) perform a check to see if that link/restriction exists

Another option might be limiting the list of widgets based on the page template you're currently on. So when I click the "Add Widget" button, you could still have that simple 2 column table but then filter that list based on a template and the webpart zones in the template. You'd have to modify the base control(s) for selecting/displaying the widget selector, but it sounds as if it would be worth the efforts. Either way I think you'll have to setup that link or permissions type table and manage it on your own.

2 votesVote for this answer Mark as a Correct answer

Tom Troughton answered on April 1, 2015 16:34

Thanks for the confirmation Brenden. I will report back if I manage to implement something like this. I'm due a call with Kentico consultants next week so I'll ask if there might be any appropriate events.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on April 1, 2015 17:11

@Nat please share back what you discover or they suggest, I'd be interested in hearing about it.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.