Commit 1a3dbdc0 authored by Hanno Schlichting's avatar Hanno Schlichting

Removed special code to create user folders and page templates while creating...

Removed special code to create user folders and page templates while creating new `OFS.Folder` instances.
parent 2cca6f4c
...@@ -41,6 +41,9 @@ Features Added ...@@ -41,6 +41,9 @@ Features Added
Restructuring Restructuring
+++++++++++++ +++++++++++++
- Removed special code to create user folders and page templates while creating
new `OFS.Folder` instances.
- Removed persistent default code like the `error_log` and `temp_folder`. - Removed persistent default code like the `error_log` and `temp_folder`.
- Removed persistent default content, including the `standard_error_message` - Removed persistent default content, including the `standard_error_message`
......
...@@ -16,10 +16,6 @@ Folders are the basic container objects and are analogous to directories. ...@@ -16,10 +16,6 @@ Folders are the basic container objects and are analogous to directories.
""" """
from AccessControl.class_init import InitializeClass from AccessControl.class_init import InitializeClass
from AccessControl.Permissions import add_page_templates
from AccessControl.Permissions import add_user_folders
from AccessControl.SecurityManagement import getSecurityManager
from AccessControl.unauthorized import Unauthorized
from App.special_dtml import DTMLFile from App.special_dtml import DTMLFile
from webdav.Collection import Collection from webdav.Collection import Collection
from zope.interface import implements from zope.interface import implements
...@@ -39,33 +35,11 @@ def manage_addFolder(self, id, title='', ...@@ -39,33 +35,11 @@ def manage_addFolder(self, id, title='',
createUserF=0, createUserF=0,
REQUEST=None): REQUEST=None):
"""Add a new Folder object with id *id*. """Add a new Folder object with id *id*.
If the 'createPublic' and 'createUserF' parameters are set to any true
value, an 'index_html' and a 'UserFolder' objects are created respectively
in the new folder.
""" """
ob = Folder(id) ob = Folder(id)
ob.title = title ob.title = title
self._setObject(id, ob) self._setObject(id, ob)
ob = self._getOb(id) ob = self._getOb(id)
checkPermission=getSecurityManager().checkPermission
if createUserF:
if not checkPermission(add_user_folders, ob):
raise Unauthorized, (
'You are not authorized to add User Folders.'
)
ob.manage_addUserFolder()
if createPublic:
if not checkPermission(add_page_templates, ob):
raise Unauthorized, (
'You are not authorized to add Page Templates.'
)
ob.manage_addProduct['PageTemplates'].manage_addPageTemplate(
id='index_html', title='')
if REQUEST is not None: if REQUEST is not None:
return self.manage_main(self, REQUEST, update_menu=1) return self.manage_main(self, REQUEST, update_menu=1)
......
...@@ -13,10 +13,6 @@ ...@@ -13,10 +13,6 @@
""" 'Folder' with order support. """ 'Folder' with order support.
""" """
from AccessControl.SecurityManagement import getSecurityManager
from AccessControl.unauthorized import Unauthorized
from AccessControl.Permissions import add_page_templates
from AccessControl.Permissions import add_user_folders
from App.special_dtml import DTMLFile from App.special_dtml import DTMLFile
from zope.interface import implements from zope.interface import implements
...@@ -29,33 +25,11 @@ manage_addOrderedFolderForm = DTMLFile('dtml/addOrderedFolder', globals()) ...@@ -29,33 +25,11 @@ manage_addOrderedFolderForm = DTMLFile('dtml/addOrderedFolder', globals())
def manage_addOrderedFolder(self, id, title='', createPublic=0, createUserF=0, def manage_addOrderedFolder(self, id, title='', createPublic=0, createUserF=0,
REQUEST=None): REQUEST=None):
"""Add a new ordered Folder object with id *id*. """Add a new ordered Folder object with id *id*.
If the 'createPublic' and 'createUserF' parameters are set to any true
value, an 'index_html' and a 'UserFolder' objects are created respectively
in the new folder.
""" """
ob = OrderedFolder(id) ob = OrderedFolder(id)
ob.title = title ob.title = title
self._setObject(id, ob) self._setObject(id, ob)
ob = self._getOb(id) ob = self._getOb(id)
checkPermission = getSecurityManager().checkPermission
if createUserF:
if not checkPermission(add_user_folders, ob):
raise Unauthorized, (
'You are not authorized to add User Folders.'
)
ob.manage_addUserFolder()
if createPublic:
if not checkPermission(add_page_templates, ob):
raise Unauthorized, (
'You are not authorized to add Page Templates.'
)
ob.manage_addProduct['PageTemplates'].manage_addPageTemplate(
id='index_html', title='')
if REQUEST: if REQUEST:
return self.manage_main(self, REQUEST, update_menu=1) return self.manage_main(self, REQUEST, update_menu=1)
......
...@@ -36,35 +36,6 @@ information for the Folder. ...@@ -36,35 +36,6 @@ information for the Folder.
<input type="text" name="title" size="40" /> <input type="text" name="title" size="40" />
</td> </td>
</tr> </tr>
<dtml-if
"_.SecurityCheckPermission('Add Documents, Images, and Files',this())">
<tr>
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<div class="form-text">
<input type="checkbox" name="createPublic:int" value="1"
id="cbCreatePublic">
<label for="cbCreatePublic">Create public interface</label>
</div>
</td>
</tr>
</dtml-if>
<dtml-if
"_.SecurityCheckPermission('Add User Folders',this())">
<tr>
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<div class="form-text">
<input type="checkbox" name="createUserF:int" value="1"
id="cbCreateUserF">
<label for="cbCreateUserF">Create user folder</label>
</div>
</td>
</tr>
</dtml-if>
<tr> <tr>
<td align="left" valign="top"> <td align="left" valign="top">
......
...@@ -36,35 +36,6 @@ information for the Folder. ...@@ -36,35 +36,6 @@ information for the Folder.
<input type="text" name="title" size="40" /> <input type="text" name="title" size="40" />
</td> </td>
</tr> </tr>
<dtml-if
"_.SecurityCheckPermission('Add Documents, Images, and Files',this())">
<tr>
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<div class="form-text">
<input type="checkbox" name="createPublic:int" value="1"
id="cbCreatePublic">
<label for="cbCreatePublic">Create public interface</label>
</div>
</td>
</tr>
</dtml-if>
<dtml-if
"_.SecurityCheckPermission('Add User Folders',this())">
<tr>
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<div class="form-text">
<input type="checkbox" name="createUserF:int" value="1"
id="cbCreateUserF">
<label for="cbCreateUserF">Create user folder</label>
</div>
</td>
</tr>
</dtml-if>
<tr> <tr>
<td align="left" valign="top"> <td align="left" valign="top">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment