You are not allowed to access 'addPrincipalToGroup' in this context

Once a year, I'm updating a Plone 4.2 site dedicated to a meeting. One of the tasks is to move members from some groups to others. For this, I'm using in a Python Script (with Manager Proxy Roles):

context.portal_groups.addPrincipalToGroup(email_member,new_group)

IIRC, this used to work nicely previous years but, now, I'm facing a:

You are not allowed to access 'addPrincipalToGroup' in this context

error. Here is the complete traceback:

2017-05-27 17:14:44 ERROR Zope.SiteErrorLog 1495898084.460.0363915075371 http://localhost:8090/stage-latex/portal_skins/custom/actualiser_membres_groupe
Traceback (innermost last):
Module ZPublisher.Publish, line 126, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 46, in call_object
Module Shared.DC.Scripts.Bindings, line 322, in call
Module Products.PloneHotfix20121106.python_scripts, line 63, in _patched_bindAndExec
Module Shared.DC.Scripts.Bindings, line 359, in _bindAndExec
Module Products.PythonScripts.PythonScript, line 344, in _exec
Module script, line 22, in actualiser_membres_groupe

  • <PythonScript at /stage-latex/portal_skins/custom/actualiser_membres_groupe>
  • Line 22
    Unauthorized: You are not allowed to access 'addPrincipalToGroup' in this context

Do you know how to fix this error?

Maybe you could enable verbose security to see if it gives you more info: https://docs.plone.org/develop/plone/security/permissions.html#permissions

1 Like

Good advice: hence, I realized the owner of the script used to be a Manager but isn't anymore.

1 Like