vendor/CMF/1.6.3/CMFCore

view permissions.py @ 2:4c712d7bd1d7

Added tag 1.6.3 for changeset 1babb9d61518
author Georges Racinet on purity.racinet.fr <georges@racinet.fr>
date Fri, 09 Sep 2011 12:44:00 +0200
parents
children
line source
1 ##############################################################################
2 #
3 # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
4 #
5 # This software is subject to the provisions of the Zope Public License,
6 # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
7 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
10 # FOR A PARTICULAR PURPOSE.
11 #
12 ##############################################################################
13 """ CMFCore product permissions.
15 $Id$
16 """
18 import Products
19 from AccessControl import ModuleSecurityInfo
20 from AccessControl import Permissions
21 from AccessControl.Permission import _registeredPermissions
22 from AccessControl.Permission import pname
23 from Globals import ApplicationDefaultPermissions
26 security = ModuleSecurityInfo('Products.CMFCore.permissions')
28 #
29 # General Zope permissions
30 #
32 security.declarePublic('AccessContentsInformation')
33 AccessContentsInformation = Permissions.access_contents_information
35 security.declarePublic('ChangePermissions')
36 ChangePermissions = Permissions.change_permissions
38 security.declarePublic('DeleteObjects')
39 DeleteObjects = Permissions.delete_objects
41 security.declarePublic('FTPAccess')
42 FTPAccess = Permissions.ftp_access
44 security.declarePublic('ManageProperties')
45 ManageProperties = Permissions.manage_properties
47 security.declarePublic('ManageUsers')
48 ManageUsers = Permissions.manage_users
50 security.declarePublic('UndoChanges')
51 UndoChanges = Permissions.undo_changes
53 security.declarePublic('View')
54 View = Permissions.view
56 security.declarePublic('ViewManagementScreens')
57 ViewManagementScreens = Permissions.view_management_screens
59 security.declarePrivate('setDefaultRoles')
60 def setDefaultRoles(permission, roles):
61 '''
62 Sets the defaults roles for a permission.
63 '''
64 # XXX This ought to be in AccessControl.SecurityInfo.
65 registered = _registeredPermissions
66 if not registered.has_key(permission):
67 registered[permission] = 1
68 Products.__ac_permissions__=(
69 Products.__ac_permissions__+((permission,(),roles),))
70 mangled = pname(permission)
71 setattr(ApplicationDefaultPermissions, mangled, roles)
73 # Note that we can only use the default Zope roles in calls to
74 # setDefaultRoles(). The default Zope roles are:
75 # Anonymous, Manager, and Owner.
77 #
78 # CMF Base Permissions
79 #
81 security.declarePublic('ListFolderContents')
82 ListFolderContents = 'List folder contents'
83 setDefaultRoles( ListFolderContents, ( 'Manager', 'Owner' ) )
85 security.declarePublic('ListUndoableChanges')
86 ListUndoableChanges = 'List undoable changes'
87 setDefaultRoles( ListUndoableChanges, ('Manager',) ) # + Member
89 security.declarePublic('AccessInactivePortalContent')
90 AccessInactivePortalContent = 'Access inactive portal content'
91 setDefaultRoles(AccessInactivePortalContent, ('Manager',))
93 security.declarePublic('ModifyCookieCrumblers')
94 ModifyCookieCrumblers = 'Modify Cookie Crumblers'
95 setDefaultRoles(ModifyCookieCrumblers, ('Manager',))
97 security.declarePublic('ReplyToItem')
98 ReplyToItem = 'Reply to item'
99 setDefaultRoles(ReplyToItem, ('Manager',)) # + Member
101 security.declarePublic('ManagePortal')
102 ManagePortal = 'Manage portal'
103 setDefaultRoles(ManagePortal, ('Manager',))
105 security.declarePublic('ModifyPortalContent')
106 ModifyPortalContent = 'Modify portal content'
107 setDefaultRoles(ModifyPortalContent, ('Manager',))
109 security.declarePublic('ListPortalMembers')
110 ListPortalMembers = 'List portal members'
111 setDefaultRoles( ListPortalMembers, ('Manager',) ) # + Member
113 security.declarePublic('AddPortalFolders')
114 AddPortalFolders = 'Add portal folders'
115 setDefaultRoles(AddPortalFolders, ('Owner','Manager')) # + Member
117 security.declarePublic('AddPortalContent')
118 AddPortalContent = 'Add portal content'
119 setDefaultRoles(AddPortalContent, ('Owner','Manager',)) # + Member
121 security.declarePublic('AddPortalMember')
122 AddPortalMember = 'Add portal member'
123 setDefaultRoles(AddPortalMember, ('Anonymous', 'Manager',))
125 security.declarePublic('SetOwnPassword')
126 SetOwnPassword = 'Set own password'
127 setDefaultRoles(SetOwnPassword, ('Manager',)) # + Member
129 security.declarePublic('SetOwnProperties')
130 SetOwnProperties = 'Set own properties'
131 setDefaultRoles(SetOwnProperties, ('Manager',)) # + Member
133 security.declarePublic('ChangeLocalRoles')
134 ChangeLocalRoles = 'Change local roles'
135 setDefaultRoles(ChangeLocalRoles, ('Owner', 'Manager'))
137 security.declarePublic('MailForgottenPassword')
138 MailForgottenPassword = 'Mail forgotten password'
139 setDefaultRoles(MailForgottenPassword, ('Anonymous', 'Manager',))
142 #
143 # Workflow Permissions
144 #
146 security.declarePublic('RequestReview')
147 RequestReview = 'Request review'
148 setDefaultRoles(RequestReview, ('Owner', 'Manager',))
150 security.declarePublic('ReviewPortalContent')
151 ReviewPortalContent = 'Review portal content'
152 setDefaultRoles(ReviewPortalContent, ('Manager',)) # + Reviewer
154 security.declarePublic('AccessFuturePortalContent')
155 AccessFuturePortalContent = 'Access future portal content'
156 setDefaultRoles(AccessFuturePortalContent, ('Manager',)) # + Reviewer