11
11
# FOR A PARTICULAR PURPOSE.
13
13
##############################################################################
14
"""securityPolicy Directive Schema
14
"""Backward-compatibility imports for the global principal registry directives
16
$Id: metadirectives.py 73630 2007-03-26 14:31:31Z dobe $
16
$Id: metadirectives.py 106799 2009-12-20 04:50:49Z fafhrd $
18
from zope.interface import Interface
19
from zope.configuration.fields import GlobalObject, GlobalInterface
20
from zope.configuration.fields import Tokens, PythonIdentifier
21
from zope.schema import Id, TextLine
22
from zope.security.zcml import Permission
24
##############################################################################
25
# BBB 2006/04/03 -- to be removed after 12 months
27
import zope.deferredimport
28
zope.deferredimport.deprecated(
29
"It has been renamed to zope.security.zcml.IPermissionDirective. "
30
"This reference will be gone in Zope 3.5",
31
IBaseDefineDirective = 'zope.security.zcml:IPermissionDirective'
19
# BBB: these were moved to zope.principalregistry
20
from zope.principalregistry.metadirectives import (
21
IBasePrincipalDirective,
22
IDefinePrincipalDirective,
23
IDefineUnauthenticatedPrincipalDirective,
24
IDefineUnauthenticatedGroupDirective,
25
IDefineAuthenticatedGroupDirective,
26
IDefineEverybodyGroupDirective,
34
##############################################################################
36
class IModule(Interface):
37
"""Group security declarations about a module"""
39
module = GlobalObject(
41
description=u"Pointer to the module object.",
45
class IAllow(Interface):
46
"""Allow access to selected module attributes
48
Access is unconditionally allowed to any names provided directly
49
in the attributes attribute or to any names defined by
50
interfaces listed in the interface attribute.
55
description=u"The attributes to provide access to.",
56
value_type = PythonIdentifier(),
61
description=u"Interfaces whos names to provide access to. Access "
62
u"will be provided to all of the names defined by the "
63
u"interface(s). Multiple interfaces can be supplied.",
64
value_type = GlobalInterface(),
68
class IRequire(Interface):
69
"""Require a permission to access selected module attributes
71
The given permission is required to access any names provided
72
directly in the attributes attribute or any names defined by
73
interfaces listed in the interface attribute.
78
description=u"The attributes to require permission for.",
79
value_type = PythonIdentifier(),
82
permission = Permission(
83
title=u"Permission ID",
84
description=u"The id of the permission to require.")
86
class IBasePrincipalDirective(Interface):
87
"""Base interface for principal definition directives."""
91
description=u"Id as which this object will be known and used.",
96
description=u"Provides a title for the object.",
99
description = TextLine(
101
description=u"Provides a description for the object.",
104
class IDefinePrincipalDirective(IBasePrincipalDirective):
105
"""Define a new principal."""
108
title=u"Username/Login",
109
description=u"Specifies the Principal's Username/Login.",
114
description=u"Specifies the Principal's Password.",
117
password_manager = TextLine(
118
title=u"Password Manager Name",
119
description=(u"Name of the password manager will be used"
120
" for encode/check the password"),
121
default=u"Plain Text"
124
class IDefineUnauthenticatedPrincipalDirective(IBasePrincipalDirective):
125
"""Define a new unauthenticated principal."""
127
class IDefineUnauthenticatedGroupDirective(IBasePrincipalDirective):
128
"""Define the unauthenticated group."""
130
class IDefineAuthenticatedGroupDirective(IBasePrincipalDirective):
131
"""Define the authenticated group."""
133
class IDefineEverybodyGroupDirective(IBasePrincipalDirective):
134
"""Define the everybody group."""