zope.security.adapter

Support for taking security into account in adaptation

zope.security.adapter.assertLocation(adapter, parent)[source]

Assert locatable adapters.

This function asserts that the adapter get location-proxied if it doesn’t provide ILocation itself. Further more the returned locatable adapter get its parent set if its __parent__ attribute is currently None.

class zope.security.adapter.LocatingTrustedAdapterFactory(factory)[source]

Bases: object

Adapt an adapter factory to provide trusted and (locatable) adapters.

Trusted adapters always adapt unproxied objects. If asked to adapt any proxied objects, it will unproxy them and then security-proxy the resulting adapter (S) unless the objects where not security-proxied before (N).

Further locating trusted adapters provide a location for protected adapters only (S). If such a protected adapter itself does not provide ILocation it is wrapped within a location proxy and it parent will be set. If the adapter does provide ILocation and it’s __parent__ is None, we set the __parent__ to the adapter’s context:

class zope.security.adapter.TrustedAdapterFactory(factory)[source]

Bases: zope.security.adapter.LocatingTrustedAdapterFactory

Adapt an adapter factory to provide trusted adapters.

Trusted adapters always adapt unproxied objects. If asked to adapt any proxied objects, it will unproxy them and then security-proxy the resulting adapter unless the objects where not security-proxied before.

If the adapter does provide ILocation and it’s __parent__ is None, we set the __parent__ to the adapter’s context.

class zope.security.adapter.LocatingUntrustedAdapterFactory(factory)[source]

Bases: object

Adapt an adapter factory to provide locatable untrusted adapters

Untrusted adapters always adapt proxied objects. If any permission other than zope.Public is required, untrusted adapters need a location in order that the local authentication mechanism can be inovked correctly.

If the adapter does not provide ILocation, we location proxy it and set the parent. If the adapter does provide ILocation and it’s __parent__ is None, we set the __parent__ to the adapter’s context only: