Leonardo Andrade
Leonardo Andrade

Reputation: 2618

How to forbid a user to change default view and default layout of the root of a plone site?

Is there a programmatically way to forbid some certain users to change the default layout and the default view of the root of a Plone site? Some of these users are site administrators and I want to avoid accidental changes.

Upvotes: 0

Views: 64

Answers (1)

Mathias
Mathias

Reputation: 6839

The best way is to use the already implemented permission Modify view template. Check Only site administrators should be able to set default display view of folders on Plone 4.3 for details.

You should separate users which can change the view template from other users. For example you could add a new Role on the plone root and allow only this role to modify the view template (Since you don't manage this role in your workflow it only affects the plone root).

The other solution is a monkeypatch, but it's the worst solution, since you have other options. The code your looking for is in Products.CMFDynamicViewFTI

Basically you could patch the Plone item itself --> https://github.com/plone/Products.CMFPlone/blob/master/Products/CMFPlone/Portal.py#L27

Upvotes: 3

Related Questions