Disable role aquisition - Plone 5

Guys,
I have created a content type and I want to disable_role_aquisition in default wherever I add the content type. Can I do it without going to sharing tab.

  1. Option: set __ac_local_roles_block__ = 1 as class variable in your code

  2. Option: https://docs.plone.org/develop/plone.api/docs/api/content.html

plone.api.content.disable_roles_acquisition(obj=None)¶

which could be set inside an event subscriber

https://docs.plone.org/develop/addons/components/events.html

for zope.lifecycleevent.IObjectCreatedEvent

1 Like

Thanks, but you are telling for the particular object but I want to disable for the content type

Again, take your time for reading and understand my answers.

Option 1 allows you to set the property on the class which is obviously what you are asking for and that is what I clearly mentioned. What is unclear here?

class VersionsView(DefaultView):
	__ac_local_roles_block__=1

Is this what you are recomending

Try it out and report back if it does not work.

Nothing happened

Nothing happened means what? Nobody can and will help you if you do not provide further details.

Both options are perfectly working (basically since almost 20 years, since the existence of Zope).

See the implementation

which is doing the same as suggested.

The only thing that might be needed for existing content objects is that you need to reindex them or call
obj.reindexObjectSecurity() for every affected content object after the particular change to the base class.