zope.security.management

Default zope.security.interfaces.ISecurityManagement and zope.security.interfaces.IInteractionManagement implementation.

Note that this module itself provides those interfaces.

zope.security.management.getSecurityPolicy()[source]

Get the system default security policy.

zope.security.management.setSecurityPolicy(aSecurityPolicy)[source]

Set the system default security policy, and return the previous value.

This method should only be called by system startup code. It should never, for example, be called during a web request.

zope.security.management.queryInteraction()[source]

Return a current interaction, if there is one.

zope.security.management.getInteraction()[source]

Get the current interaction.

exception zope.security.management.ExistingInteraction[source]

Bases: exceptions.ValueError, exceptions.AssertionError

The exception that newInteraction() will raise if called during an existing interaction.

zope.security.management.newInteraction(*participations)[source]

Start a new interaction.

zope.security.management.endInteraction()[source]

End the current interaction.

zope.security.management.checkPermission(permission, object, interaction=None)[source]

Return whether security policy allows permission on object.

Parameters:
  • permission (str) – A permission name.
  • object – The object being accessed according to the permission.
  • interaction – An interaction, providing access to information such as authenticated principals. If it is None, the current interaction is used.
Returns:

A boolean value. checkPermission is guaranteed to return True if permission is zope.security.checker.CheckerPublic or None.

Raises:

NoInteraction – If there is no current interaction and no interaction argument was given.