[CMF-checkins] CVS: CMF - CMFWikiPage.py:1.5
Ken Manheimer
klm@digicool.com
Sat, 26 May 2001 13:57:47 -0400 (EDT)
Update of /cvs-repository/Packages/Products/CMFWiki
In directory korak.digicool.com:/tmp/cvs-serv26665
Modified Files:
CMFWikiPage.py
Log Message:
Two fixes:
1 Extended .__init__() to take some arguments for DTMLDocument
(actually, DT_string) __init__() that are passed in by
.create_page().
2 Slightly elaborated _roles_map to take multiple values, and
allotting both 'Anonymous' and 'Authenticated' to "everyone"
pseudorole.
#2 may only be necessary for Zope pre 2.4. In 2.3.2, setting
a page permission to allow 'everyone' (or 'anyone') *disallows* any
authenticated member from doing anything. The problem apparently is
that granting 'Anonymous' but nothing else does not work in this
version. This fix grants 'Anonymous' *and* 'Authenticated' the
permission. (This requires that the site institutes 'Authenticated'
being among the roles for all authenticated users.)
._roles_map: Changed to a tuple, where 'everyone' [and 'anyone', which
should go away!] translates to both 'Anonymous' and 'Authenticated'.
.__init__(): Added source_string and mapping arguments, so they can be
passed on to DTMLDocument.__init__().
.setOp(), .create_page(), makeCMFWikiPage(): Track changes to
._roles_map.
--- Updated File CMFWikiPage.py in package CMF --
--- CMFWikiPage.py 2001/05/26 01:41:21 1.4
+++ CMFWikiPage.py 2001/05/26 17:57:46 1.5
@@ -65,10 +65,10 @@
}
# mapping of mnemonic pseudorole name (used by forms) to actual role name
_roles_map = {
- 'everyone':'Anonymous',
- 'anyone':'Anonymous',
- 'nonanon':'Authenticated',
- 'owners':'Owner',
+ 'everyone': ('Anonymous', 'Authenticated'),
+ 'anyone': ('Anonymous', 'Authenticated'),
+ 'nonanon': ('Authenticated',),
+ 'owners':('Owner',),
}
# _roles_map backwards
_reverse_roles_map = {
@@ -103,8 +103,11 @@
set(CMFWikiPermissions.Comment, ('Owner', 'Manager', 'Authenticated'))
set = None
- def __init__(self, file, __name__):
- DTMLDocument.__init__(self, file, mapping=None, __name__=__name__)
+ def __init__(self, file=None, __name__='', source_string='', mapping=None):
+ DTMLDocument.__init__(self, file=file,
+ mapping=mapping,
+ __name__=__name__,
+ source_string=source_string)
DefaultDublinCoreImpl.__init__(self)
security.declarePublic('getId')
@@ -584,11 +587,11 @@
def setOp(self, op, usernames, category):
"""Set who can do a particular operation."""
if category is None:
- raise "Programmer error, emasculate programmer"
+ raise "Programmer error, eviscerate programmer"
this_perm = self._perms[op]
- this_role = self._roles_map[category]
+ these_roles = self._roles_map[category]
this_local_role = self._local_roles_map[op]
- self.manage_permission(this_perm, [this_role])
+ self.manage_permission(this_perm, these_roles)
for username in usernames:
username and \
self.manage_addLocalRoles(username,[this_local_role])
@@ -716,9 +719,9 @@
# also carry over permissions from parent page.
for op, permission in ob._perms.items():
pseudoperm = self.opCategory(op)
- this_role = self._roles_map[pseudoperm]
+ these_roles = self._roles_map[pseudoperm]
this_local_role = self._local_roles_map[op]
- roles = [this_local_role, this_role]
+ roles = (this_local_role,) + these_roles
ob.manage_permission(permission, roles=roles)
# propagate parent local Wiki roles settings
@@ -1821,7 +1824,7 @@
pseudoperm = default_perms[name]
local_roles_map = ob._local_roles_map
roles_map = ob._roles_map
- roles = [local_roles_map[name], roles_map[pseudoperm]]
+ roles = (local_roles_map[name],) + roles_map[pseudoperm]
ob.manage_permission(perm, roles=roles)
return ob