Changeset 50969
- Timestamp:
- 02/02/07 17:01:26 (3 years ago)
- Files:
-
- CPS3/products/CPSDirectory/trunk/BaseDirectory.py (modified) (4 diffs)
- CPS3/products/CPSDirectory/trunk/CHANGES (modified) (1 diff)
- CPS3/products/CPSDirectory/trunk/ZODBDirectory.py (modified) (2 diffs)
- CPS3/products/CPSDirectory/trunk/tests/testLDAPBackingDirectory.py (modified) (1 diff)
- CPS3/products/CPSDirectory/trunk/tests/testZODBDirectory.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
CPS3/products/CPSDirectory/trunk/BaseDirectory.py
r48857 r50969 20 20 """ 21 21 22 from zLOG import LOG, DEBUG 22 from zLOG import LOG, DEBUG, INFO 23 23 24 24 from urllib import urlencode … … 103 103 {'id': 'layout', 'type': 'string', 'mode': 'w', 104 104 'label': "Layout"}, 105 {'id': 'readonly', 'type': 'boolean', 'mode': 'w', 106 'label': "Is the directory read-only?",}, 105 107 {'id': 'layout_search', 'type': 'string', 'mode': 'w', 106 108 'label': "Layout for search"}, … … 131 133 layout = '' 132 134 layout_search = '' 135 readonly = False 133 136 acl_directory_view_roles = 'Manager' 134 137 acl_entry_create_roles = 'Manager' … … 501 504 """Edit an entry in the directory, unrestricted. 502 505 """ 506 if self.readonly: 507 LOG('BaseDirectory._editEntry', INFO, 508 'directory %s is readonly' % self.getId()) 509 return 503 510 id = entry[self.id_field] 504 511 dm = self._getDataModel(id, check_acls=check_acls) CPS3/products/CPSDirectory/trunk/CHANGES
r50947 r50969 17 17 but not to modify them. 18 18 - #1809: Cannot authenticate against very restricted LDAP server 19 - #1810: Directories can be globally set to read-only 19 20 New internal features 20 21 ~~~~~~~~~~~~~~~~~~~~~ CPS3/products/CPSDirectory/trunk/ZODBDirectory.py
r34472 r50969 20 20 """ 21 21 22 from zLOG import LOG, DEBUG, TRACE 22 from zLOG import LOG, DEBUG, TRACE, INFO 23 23 24 24 from cgi import escape … … 196 196 def _editEntry(self, entry, check_acls=False): 197 197 """ unrestricted method to edit an entry and invalidate the cache. """ 198 if self.readonly: 199 LOG('ZODBDirectory._editEntry', INFO, 200 'directory %s is readonly' % self.getId()) 201 return 198 202 BaseDirectory._editEntry(self, entry, check_acls) 199 203 self.ZCacheable_invalidate() CPS3/products/CPSDirectory/trunk/tests/testLDAPBackingDirectory.py
r46647 r50969 1029 1029 self.assertEquals(entry, entry_def) 1030 1030 1031 1031 # readonly behavior 1032 self.dir.readonly = True 1033 self.dir.editEntry({'yetanotherfield': "Some junk"}) 1034 self.assertEquals(entry, entry_def) 1032 1035 1033 1036 def test_suite(): CPS3/products/CPSDirectory/trunk/tests/testZODBDirectory.py
r50847 r50969 517 517 self.assert_(meth(id='peterpan')) 518 518 self.assert_(meth(entry={'name': 'Peterpan'})) 519 # readonly behavior 520 self.dir.readonly = True 521 self.dir._editEntry({'name': 'Peterspoon', 'id': 'peterpan'}) 522 self.assertEquals(self.dir._getEntry('peterpan')['name'], 523 'Peterpan') 519 524 520 525 def testBasicSecurity(self):
