[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Security/Grants - AnnotationPrincipalRoleManager.py:1.2 configure.zcml:1.3
Florent Guillaume
fg@nuxeo.com
Tue, 25 Jun 2002 11:28:23 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/Security/Grants
In directory cvs.zope.org:/tmp/cvs-serv422/lib/python/Zope/App/Security/Grants
Modified Files:
AnnotationPrincipalRoleManager.py configure.zcml
Log Message:
Finish implementing existing Principal Role management views.
Filtering is not really useable now, it should ask for a
prefix to use before displaying the filtered matrix.
Use a Persistent LocalSecurityMap to store the annotations.
Fix the tests.
Add 'Principal Roles' to the Folder menu (XXX should add it
to other (all?) content objects too).
Did the name="foo.bar.baz:records" syntax ever work in publisher ?
=== Zope3/lib/python/Zope/App/Security/Grants/AnnotationPrincipalRoleManager.py 1.1 => 1.2 ===
from Zope.App.Security.IPrincipalRoleManager \
import IPrincipalRoleManager
-from Zope.App.Security.Grants.LocalSecurityMap import LocalSecurityMap
+from Zope.App.Security.Grants.PersistentLocalSecurityMap import \
+ PersistentLocalSecurityMap
from Zope.App.Security.Settings import Assign, Remove, Unset
annotation_key = 'Zope.App.Security.AnnotationPrincipalRoleManager'
@@ -34,13 +35,11 @@
''' See the interface IPrincipalRoleManager '''
pp = self._getPrincipalRoles(create=1)
pp.addCell(role_id, principal_id, Assign)
- self._context._p_changed = 1
def removeRoleFromPrincipal(self, role_id, principal_id):
''' See the interface IPrincipalRoleManager '''
pp = self._getPrincipalRoles(create=1)
pp.addCell(role_id, principal_id, Remove)
- self._context._p_changed = 1
def unsetRoleForPrincipal(self, role_id, principal_id):
''' See the interface IPrincipalRoleManager '''
@@ -48,7 +47,6 @@
# Only unset if there is a security map, otherwise, we're done
if pp:
pp.delCell(role_id, principal_id)
- self._context._p_changed = 1
def getPrincipalsForRole(self, role_id):
''' See the interface IPrincipalRoleManager '''
@@ -88,6 +86,6 @@
return annotations[annotation_key]
except KeyError:
if create:
- rp = annotations[annotation_key] = LocalSecurityMap()
+ rp = annotations[annotation_key] = PersistentLocalSecurityMap()
return rp
return None
=== Zope3/lib/python/Zope/App/Security/Grants/configure.zcml 1.2 => 1.3 ===
<content class=".Grants.PermissionRoles.">
- <require
+ <require
permission="Zope.Security"
attributes="roles rolesInfo"
interface="Zope.App.Security.IRegisteredObject." />
</content>
<content class=".Grants.RolePermissions.">
- <require
+ <require
permission="Zope.Security"
attributes="permissions permissionsInfo"
interface="Zope.App.Security.IRegisteredObject." />
@@ -24,10 +24,13 @@
provides=".IRolePermissionManager."
for="Zope.App.OFS.Annotation.IAnnotatable." />
+ <adapter factory=".Grants.AnnotationPrincipalRoleManager."
+ provides=".IPrincipalRoleManager."
+ for="Zope.App.OFS.Annotation.IAnnotatable." />
<adapter factory=".Grants.AnnotationPrincipalPermissionManager."
provides=".IPrincipalPermissionManager."
for="Zope.App.OFS.Annotation.IAnnotatable." />
-
+
</zopeConfigure>