Skip to content

Commit

Permalink
Merged from trunk:
Browse files Browse the repository at this point in the history
  r26363 | jim | 2004-07-09 15:28:16 -0400 (Fri, 09 Jul 2004) | 5 lines

Added TrustedAdapterFactory

This is for adapters that are trusted and need unfettered access to
the objects they adapt. If asked to adapt security-proxied objects,
the return security-proxied adapters of unproxied objects.
  • Loading branch information
Jim Fulton committed Jul 9, 2004
1 parent dda7958 commit 9adb59f
Show file tree
Hide file tree
Showing 3 changed files with 151 additions and 87 deletions.
7 changes: 6 additions & 1 deletion metaconfigure.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from zope.app import zapi
from zope.app.component.interface import queryInterface
from zope.app.servicenames import Adapters, Presentation
from zope.app.security.adapter import TrustedAdapterFactory

PublicPermission = 'zope.Public'

Expand Down Expand Up @@ -120,7 +121,8 @@ def factory(ob):
args = ('', iface)
)

def adapter(_context, factory, provides, for_, permission=None, name=''):
def adapter(_context, factory, provides, for_, permission=None, name='',
trusted=False):
if permission is not None:
if permission == PublicPermission:
permission = CheckerPublic
Expand All @@ -145,6 +147,9 @@ def factory(ob):
# Store the original factory for documentation
factory.factory = factories[0]

if trusted:
factory = TrustedAdapterFactory(factory)

_context.action(
discriminator = ('adapter', for_, provides, name),
callable = handler,
Expand Down
Loading

0 comments on commit 9adb59f

Please sign in to comment.