equal
deleted
inserted
replaced
10 # FOR A PARTICULAR PURPOSE. |
10 # FOR A PARTICULAR PURPOSE. |
11 # |
11 # |
12 |
12 |
13 __docformat__ = 'restructuredtext' |
13 __docformat__ = 'restructuredtext' |
14 |
14 |
15 |
|
16 # import standard library |
|
17 import re |
15 import re |
|
16 |
18 from ldap3 import BASE, LEVEL, SUBTREE |
17 from ldap3 import BASE, LEVEL, SUBTREE |
19 |
18 from zope.interface import Attribute, Interface |
20 # import interfaces |
19 from zope.schema import Bool, Choice, TextLine |
|
20 from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary |
|
21 |
21 from pyams_security.interfaces import IAuthenticationPlugin, IDirectorySearchPlugin |
22 from pyams_security.interfaces import IAuthenticationPlugin, IDirectorySearchPlugin |
22 |
|
23 # import packages |
|
24 from zope.interface import Interface, Attribute |
|
25 from zope.schema import TextLine, Bool, Int, Choice, Dict, List |
|
26 from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm |
|
27 |
23 |
28 from pyams_ldap import _ |
24 from pyams_ldap import _ |
29 |
25 |
30 |
26 |
31 # |
27 # |
36 LEVEL: _("Single level"), |
32 LEVEL: _("Single level"), |
37 SUBTREE: _("Whole subtree")} |
33 SUBTREE: _("Whole subtree")} |
38 |
34 |
39 SEARCH_SCOPES_VOCABULARY = SimpleVocabulary([SimpleTerm(v, title=t) for v, t in SEARCH_SCOPES.items()]) |
35 SEARCH_SCOPES_VOCABULARY = SimpleVocabulary([SimpleTerm(v, title=t) for v, t in SEARCH_SCOPES.items()]) |
40 |
36 |
41 |
|
42 # |
37 # |
43 # Group members query mode |
38 # Group members query mode |
44 # |
39 # |
45 |
40 |
46 GROUP_MEMBERS_QUERY_MODE = {'group': _("Use group attribute to get members list"), |
41 GROUP_MEMBERS_QUERY_MODE = {'group': _("Use group attribute to get members list"), |
47 'member': _("Use member attribute to get groups list")} |
42 'member': _("Use member attribute to get groups list")} |
48 |
43 |
49 GROUP_MEMBERS_QUERY_MODE_VOCABULARY = SimpleVocabulary([SimpleTerm(v, title=t) |
44 GROUP_MEMBERS_QUERY_MODE_VOCABULARY = SimpleVocabulary([SimpleTerm(v, title=t) |
50 for v, t in GROUP_MEMBERS_QUERY_MODE.items()]) |
45 for v, t in GROUP_MEMBERS_QUERY_MODE.items()]) |
51 |
|
52 |
46 |
53 # |
47 # |
54 # Group mail mode |
48 # Group mail mode |
55 # |
49 # |
56 |
50 |
86 |
80 |
87 server_uri = TextLine(title=_("LDAP server URI"), |
81 server_uri = TextLine(title=_("LDAP server URI"), |
88 description=_("Full URI (including protocol) of LDAP server"), |
82 description=_("Full URI (including protocol) of LDAP server"), |
89 default="ldap://localhost:389", |
83 default="ldap://localhost:389", |
90 required=True) |
84 required=True) |
91 |
|
92 use_tls = Bool(title=_("Use TLS?"), |
|
93 required=True, |
|
94 default=False) |
|
95 |
85 |
96 bind_dn = TextLine(title=_("Bind DN"), |
86 bind_dn = TextLine(title=_("Bind DN"), |
97 description=_("DN used for LDAP bind; keep empty for anonymous"), |
87 description=_("DN used for LDAP bind; keep empty for anonymous"), |
98 required=False) |
88 required=False) |
99 |
89 |