changeset 42 | 07229ac2497b |
parent 34 | b84b491ea8bd |
child 44 | b999bd4dd461 |
41:905e30f5467b | 42:07229ac2497b |
---|---|
31 from zope.schema import TextLine, Text, Int, Bool, List, Tuple, Set, Dict, Choice, Datetime |
31 from zope.schema import TextLine, Text, Int, Bool, List, Tuple, Set, Dict, Choice, Datetime |
32 |
32 |
33 from pyams_security import _ |
33 from pyams_security import _ |
34 |
34 |
35 |
35 |
36 FORBIDDEN_PERMISSION = 'system.forbidden' |
|
37 |
|
38 |
|
36 class IPermission(Interface): |
39 class IPermission(Interface): |
37 """Permission utility class""" |
40 """Permission utility class""" |
38 |
41 |
39 id = TextLine(title="Unique ID", |
42 id = TextLine(title="Unique ID", |
40 required=True) |
43 required=True) |
61 permissions = Set(title="Permissions", |
64 permissions = Set(title="Permissions", |
62 description="ID of role's permissions", |
65 description="ID of role's permissions", |
63 value_type=TextLine(), |
66 value_type=TextLine(), |
64 required=False) |
67 required=False) |
65 |
68 |
69 managers = Set(title="Managers", |
|
70 description="List of principal IDs allowed to manage this role. " |
|
71 "If it's a role, use 'role:role_id' syntax...", |
|
72 value_type=TextLine(), |
|
73 required=False) |
|
74 |
|
66 |
75 |
67 class IPrincipalInfo(Interface): |
76 class IPrincipalInfo(Interface): |
68 """Principal info class |
77 """Principal info class |
69 |
78 |
70 This is the generic interface of objects defined in request 'principal' attribute |
79 This is the generic interface of objects defined in request 'principal' attribute |
176 |
185 |
177 |
186 |
178 class IDirectoryInfo(Interface): |
187 class IDirectoryInfo(Interface): |
179 """Principal directory plug-in interface""" |
188 """Principal directory plug-in interface""" |
180 |
189 |
181 def get_principal(self, principal_id): |
190 def get_principal(self, principal_id, info=True): |
182 """Returns real principal matching given ID, or None""" |
191 """Returns real principal matching given ID, or None |
192 |
|
193 If info is True, returns a PrincipalINfo record instead |
|
194 of original principal object |
|
195 """ |
|
183 |
196 |
184 def get_all_principals(self, principal_id): |
197 def get_all_principals(self, principal_id): |
185 """Returns all principals matching given principal ID""" |
198 """Returns all principals matching given principal ID""" |
186 |
199 |
187 def find_principals(self, query): |
200 def find_principals(self, query): |