Commit 6ee52c75 authored by Jim Fulton's avatar Jim Fulton

Added access control support

parent 2a497d58
......@@ -11,8 +11,8 @@
__doc__='''Application support
$Id: Application.py,v 1.3 1997/08/06 18:26:12 jim Exp $'''
__version__='$Revision: 1.3 $'[11:-2]
$Id: Application.py,v 1.4 1997/08/08 15:51:27 jim Exp $'''
__version__='$Revision: 1.4 $'[11:-2]
import Folder, regex, string
import Globals
......@@ -20,6 +20,7 @@ import Globals
class Application(Folder.Folder):
id='Your Place'
__roles__=None
title=''
web__form__method='GET'
manage_options=Folder.Folder.manage_options+(
......@@ -112,6 +113,9 @@ if __name__ == "__main__": main()
##############################################################################
#
# $Log: Application.py,v $
# Revision 1.4 1997/08/08 15:51:27 jim
# Added access control support
#
# Revision 1.3 1997/08/06 18:26:12 jim
# Renamed description->title and name->id and other changes
#
......
"""Document object"""
__version__='$Revision: 1.3 $'[11:-2]
__version__='$Revision: 1.4 $'[11:-2]
from STPDocumentTemplate import HTML
from Globals import shared_dt_globals,HTMLFile
from string import join, split, strip
import AccessControl.ACL
class Document(HTML):
"""A Document object"""
......@@ -11,18 +13,23 @@ class Document(HTML):
title=''
icon ='OFS/Document_icon.gif'
__state_names__=HTML.__state_names__+('title',)
__state_names__=HTML.__state_names__+('title','__roles__')
shared_globals =shared_dt_globals
manage_edit__allow_groups__ =None
manage_edit__allow_groups__ ={None:None}
def document_template_form_header(self):
try: roles=join(self.__roles__)
except: roles=''
return ("""<br>Title:
<input type=text name=title SIZE="50" value="%s">
<P>""" % self.title)
<br>Roles:
<input type=text name=roles SIZE="50" value="%s">
<P>""" % (self.title, roles))
def manage_edit(self,data,title,REQUEST=None):
def manage_edit(self,data,title,roles,REQUEST=None):
"""Edit method"""
self.title=title
AccessControl.ACL.parse_roles_string(self, roles)
return HTML.manage_edit(self,data,REQUEST)
......@@ -44,11 +51,12 @@ class DocumentHandler:
manage_addDocumentForm=HTMLFile('OFS/documentAdd')
def manage_addDocument(self,id,title,REQUEST,file=''):
def manage_addDocument(self,id,title,roles,REQUEST,file=''):
"""Add a new Document object"""
if not file: file=default_html
i=Document(file, __name__=id)
i.title=title
AccessControl.ACL.parse_roles_string(i, roles)
self._setObject(id,i)
return self.manage_main(self,REQUEST)
......
"""Folder object
$Id: Folder.py,v 1.3 1997/08/08 13:40:01 jim Exp $"""
$Id: Folder.py,v 1.4 1997/08/08 15:51:28 jim Exp $"""
__version__='$Revision: 1.3 $'[11:-2]
__version__='$Revision: 1.4 $'[11:-2]
from Globals import HTMLFile
......@@ -20,6 +20,9 @@ class FolderHandler:
manage_addFolderForm=HTMLFile('OFS/folderAdd')
def __init__(self):
self.__allow_groups__=self.AccessControlLists=ACL()
def folderClass(self):
return Folder
return self.__class__
......@@ -75,13 +78,11 @@ class Folder(ObjectManager,DocumentHandler,ImageHandler,FolderHandler):
{'icon':'OFS/properties.jpg', 'label':'Properties',
'action':'manage_propertiesForm', 'target':'manage_main'},
{'icon':'AccessControl/AccessControl_icon.gif', 'label':'Access Control',
'action':'ACL/manage_main', 'target':'manage_main'},
'action':'AccessControlLists/manage_main', 'target':'manage_main'},
{'icon':'App/help.jpg', 'label':'Help',
'action':'manage_help', 'target':'_new'},
)
ACL=ACL()
......
......@@ -22,6 +22,12 @@
<INPUT TYPE="TEXT" NAME="title" SIZE="50">
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP"><B>Roles of authorized users</B></TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<INPUT TYPE="TEXT" NAME="roles" SIZE="50">
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP"><B>File</B></TD>
<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