~sidnei/zope3/ztk-1.0a1

« back to all changes in this revision

Viewing changes to src/zope/app/security/metadirectives.py

  • Committer: Sidnei da Silva
  • Date: 2010-03-03 03:29:50 UTC
  • mfrom: (12.1.16 trunk)
  • Revision ID: sidnei.da.silva@canonical.com-20100303032950-duivfaoqsxaf9dgg
Merged newer-from-ztk [r=jkakar,bigkevmcd,free][qa=andreas][f=522474].

Update our monolithic Zope 3 tree to a kgs-based, generated,
monolithic Zope 3 tree built from eggs using the
collective.buildout.omelette recipe.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
# FOR A PARTICULAR PURPOSE.
12
12
#
13
13
##############################################################################
14
 
"""securityPolicy Directive Schema
 
14
"""Backward-compatibility imports for the global principal registry directives
15
15
 
16
 
$Id: metadirectives.py 73630 2007-03-26 14:31:31Z dobe $
 
16
$Id: metadirectives.py 106799 2009-12-20 04:50:49Z fafhrd $
17
17
"""
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
23
 
 
24
 
##############################################################################
25
 
# BBB 2006/04/03 -- to be removed after 12 months
26
 
 
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'
 
18
 
 
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,
32
27
    )
33
 
 
34
 
##############################################################################
35
 
 
36
 
class IModule(Interface):
37
 
    """Group security declarations about a module"""
38
 
 
39
 
    module = GlobalObject(
40
 
        title=u"Module",
41
 
        description=u"Pointer to the module object.",
42
 
        required=True)
43
 
 
44
 
 
45
 
class IAllow(Interface):
46
 
    """Allow access to selected module attributes
47
 
 
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.
51
 
    """
52
 
 
53
 
    attributes = Tokens(
54
 
        title=u"Attributes",
55
 
        description=u"The attributes to provide access to.",
56
 
        value_type = PythonIdentifier(),
57
 
        required=False)
58
 
 
59
 
    interface = Tokens(
60
 
        title=u"Interface",
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(),
65
 
        required=False)
66
 
 
67
 
 
68
 
class IRequire(Interface):
69
 
    """Require a permission to access selected module attributes
70
 
 
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.  
74
 
    """
75
 
 
76
 
    attributes = Tokens(
77
 
        title=u"Attributes",
78
 
        description=u"The attributes to require permission for.",
79
 
        value_type = PythonIdentifier(),
80
 
        required=False)
81
 
 
82
 
    permission = Permission(
83
 
        title=u"Permission ID",
84
 
        description=u"The id of the permission to require.")
85
 
 
86
 
class IBasePrincipalDirective(Interface):
87
 
    """Base interface for principal definition directives."""
88
 
 
89
 
    id = Id(
90
 
        title=u"Id",
91
 
        description=u"Id as which this object will be known and used.",
92
 
        required=True)
93
 
 
94
 
    title = TextLine(
95
 
        title=u"Title",
96
 
        description=u"Provides a title for the object.",
97
 
        required=True)
98
 
 
99
 
    description = TextLine(
100
 
        title=u"Title",
101
 
        description=u"Provides a description for the object.",
102
 
        required=False)
103
 
 
104
 
class IDefinePrincipalDirective(IBasePrincipalDirective):
105
 
    """Define a new principal."""
106
 
 
107
 
    login = TextLine(
108
 
        title=u"Username/Login",
109
 
        description=u"Specifies the Principal's Username/Login.",
110
 
        required=True)
111
 
 
112
 
    password = TextLine(
113
 
        title=u"Password",
114
 
        description=u"Specifies the Principal's Password.",
115
 
        required=True)
116
 
 
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"
122
 
        )
123
 
 
124
 
class IDefineUnauthenticatedPrincipalDirective(IBasePrincipalDirective):
125
 
    """Define a new unauthenticated principal."""
126
 
 
127
 
class IDefineUnauthenticatedGroupDirective(IBasePrincipalDirective):
128
 
    """Define the unauthenticated group."""
129
 
 
130
 
class IDefineAuthenticatedGroupDirective(IBasePrincipalDirective):
131
 
    """Define the authenticated group."""
132
 
 
133
 
class IDefineEverybodyGroupDirective(IBasePrincipalDirective):
134
 
    """Define the everybody group."""