equal
deleted
inserted
replaced
16 # import standard packages |
16 # import standard packages |
17 from persistent.list import PersistentList |
17 from persistent.list import PersistentList |
18 from persistent.dict import PersistentDict |
18 from persistent.dict import PersistentDict |
19 |
19 |
20 # import Zope3 interfaces |
20 # import Zope3 interfaces |
|
21 from zope.app.authentication.interfaces import IPrincipalInfo |
21 |
22 |
22 # import local interfaces |
23 # import local interfaces |
23 |
24 |
24 # import Zope3 packages |
25 # import Zope3 packages |
25 from zc.set import Set |
26 from zc.set import Set |
|
27 from zope.app import zapi |
|
28 from zope.interface import implements |
26 from zope.security.proxy import removeSecurityProxy |
29 from zope.security.proxy import removeSecurityProxy |
27 |
30 |
28 # import local packages |
31 # import local packages |
29 |
32 |
30 |
33 |
43 for v in value: |
46 for v in value: |
44 result.append(unproxied(v)) |
47 result.append(unproxied(v)) |
45 else: |
48 else: |
46 result = removeSecurityProxy(value) |
49 result = removeSecurityProxy(value) |
47 return result |
50 return result |
|
51 |
|
52 |
|
53 class MissingPrincipal(object): |
|
54 |
|
55 implements(IPrincipalInfo) |
|
56 |
|
57 def __init__(self, id): |
|
58 self.id = id |
|
59 |
|
60 @property |
|
61 def title(self): |
|
62 return _("< missing principal %s>") % self.id |
|
63 |
|
64 @property |
|
65 def description(self): |
|
66 return _("This principal can't be found in any authentication utility...") |
|
67 |
|
68 |
|
69 def getPrincipal(uid): |
|
70 principals = zapi.principals() |
|
71 try: |
|
72 return principals.getPrincipal(uid) |
|
73 except: |
|
74 return MissingPrincipal(uid) |