Commit 4a5ba50d authored by 's avatar

Changes for UserFolder support:

  o Added support for role registration to Application.py
    Products may define a __.role_names in their __init__.py
    which may be a tuple of role names which will be added to
    the global list of role names which appears in the role
    assignment select box when defining/editing a user.

  o Application.Application now has a default __allow_groups__
    attribute which is a UserFolder with no members defined.
    This default top-level UF is not visible in the UI, and
    the user can create a new UF at the top level (in the
    Application object) at a later time which will simply
    override the default and be visible in the UI. Since the
    default UF has no users, an out-of-the-box application's
    management interfaces will effectively be available to the
    superuser alone.

  o Removed the __init__ in Folder which created a default ACL.
    This is no longer needed.

  o Made some minor (but controversial!) style consistency fixes
    to some of the OFS templates.
parent 8a4a3cf2
...@@ -11,18 +11,19 @@ ...@@ -11,18 +11,19 @@
__doc__='''Application support __doc__='''Application support
$Id: Application.py,v 1.5 1997/08/15 22:24:12 jim Exp $''' $Id: Application.py,v 1.6 1997/08/27 13:30:19 brian Exp $'''
__version__='$Revision: 1.5 $'[11:-2] __version__='$Revision: 1.6 $'[11:-2]
import Folder, regex import Folder, regex
import Globals import Globals
from string import lower, find from string import lower, find
from AccessControl.User import UserFolder
class Application(Folder.Folder): class Application(Folder.Folder):
id='Your Place' title='DC Web Environment'
id =title
__roles__=None __roles__=None
title=''
web__form__method='GET' web__form__method='GET'
manage_options=Folder.Folder.manage_options+( manage_options=Folder.Folder.manage_options+(
{'icon':'App/arrow.jpg', 'label':'Application Management', {'icon':'App/arrow.jpg', 'label':'Application Management',
...@@ -37,6 +38,9 @@ class Application(Folder.Folder): ...@@ -37,6 +38,9 @@ class Application(Folder.Folder):
if find(destination,'//') >= 0: raise 'Redirect', destination if find(destination,'//') >= 0: raise 'Redirect', destination
raise 'Redirect', ("%s/%s" % (PARENT_URL, destination)) raise 'Redirect', ("%s/%s" % (PARENT_URL, destination))
__allow_groups__=UserFolder()
def open_bobobase(): def open_bobobase():
# Open the application database # Open the application database
Bobobase=Globals.Bobobase=Globals.PickleDictionary(Globals.BobobaseName) Bobobase=Globals.Bobobase=Globals.PickleDictionary(Globals.BobobaseName)
...@@ -45,7 +49,11 @@ def open_bobobase(): ...@@ -45,7 +49,11 @@ def open_bobobase():
import initial_products import initial_products
initial_products.install(Bobobase) initial_products.install(Bobobase)
get_transaction().commit() get_transaction().commit()
if not Bobobase.has_key('roles'):
Bobobase['roles']=('manage',)
get_transaction().commit()
products=Bobobase['products'] products=Bobobase['products']
install_products(products) install_products(products)
...@@ -57,6 +65,7 @@ def install_products(products): ...@@ -57,6 +65,7 @@ def install_products(products):
# that all folders know about top-level objects, aka products # that all folders know about top-level objects, aka products
meta_types=list(Folder.Folder.dynamic_meta_types) meta_types=list(Folder.Folder.dynamic_meta_types)
role_names=list(Globals.Bobobase['roles'])
for product in products: for product in products:
product=__import__(product) product=__import__(product)
...@@ -101,8 +110,16 @@ def install_products(products): ...@@ -101,8 +110,16 @@ def install_products(products):
for name,method in product.methods.items(): for name,method in product.methods.items():
setattr(Folder.Folder, name, method) setattr(Folder.Folder, name, method)
# Try to install role names
try:
for n in product.role_names:
if n not in role_names: role_names.append(n)
except: pass
Folder.Folder.dynamic_meta_types=tuple(meta_types) Folder.Folder.dynamic_meta_types=tuple(meta_types)
Globals.Bobobase['roles']=tuple(role_names)
############################################################################## ##############################################################################
# Test functions: # Test functions:
...@@ -119,6 +136,30 @@ if __name__ == "__main__": main() ...@@ -119,6 +136,30 @@ if __name__ == "__main__": main()
############################################################################## ##############################################################################
# #
# $Log: Application.py,v $ # $Log: Application.py,v $
# Revision 1.6 1997/08/27 13:30:19 brian
# Changes for UserFolder support:
# o Added support for role registration to Application.py
# Products may define a __.role_names in their __init__.py
# which may be a tuple of role names which will be added to
# the global list of role names which appears in the role
# assignment select box when defining/editing a user.
#
# o Application.Application now has a default __allow_groups__
# attribute which is a UserFolder with no members defined.
# This default top-level UF is not visible in the UI, and
# the user can create a new UF at the top level (in the
# Application object) at a later time which will simply
# override the default and be visible in the UI. Since the
# default UF has no users, an out-of-the-box application's
# management interfaces will effectively be available to the
# superuser alone.
#
# o Removed the __init__ in Folder which created a default ACL.
# This is no longer needed.
#
# o Made some minor (but controversial!) style consistency fixes
# to some of the OFS templates.
#
# Revision 1.5 1997/08/15 22:24:12 jim # Revision 1.5 1997/08/15 22:24:12 jim
# Added Redirect # Added Redirect
# #
......
"""Folder object """Folder object
$Id: Folder.py,v 1.6 1997/08/18 15:14:53 brian Exp $""" $Id: Folder.py,v 1.7 1997/08/27 13:30:20 brian Exp $"""
__version__='$Revision: 1.6 $'[11:-2] __version__='$Revision: 1.7 $'[11:-2]
from Globals import HTMLFile from Globals import HTMLFile
from ObjectManager import ObjectManager from ObjectManager import ObjectManager
from Image import Image, ImageHandler from Image import ImageHandler
from Document import Document, DocumentHandler from Document import DocumentHandler
from AccessControl.ACL import ACL from AccessControl.User import UserFolderHandler
class FolderHandler: class FolderHandler:
...@@ -20,9 +20,6 @@ class FolderHandler: ...@@ -20,9 +20,6 @@ class FolderHandler:
manage_addFolderForm=HTMLFile('OFS/folderAdd') manage_addFolderForm=HTMLFile('OFS/folderAdd')
def __init__(self):
self.__allow_groups__=self.AccessControlLists=ACL()
def folderClass(self): def folderClass(self):
return Folder return Folder
return self.__class__ return self.__class__
...@@ -56,28 +53,27 @@ class FolderHandler: ...@@ -56,28 +53,27 @@ class FolderHandler:
return t return t
class Folder(ObjectManager,DocumentHandler,ImageHandler,FolderHandler): class Folder(ObjectManager,DocumentHandler,ImageHandler,
FolderHandler,UserFolderHandler):
"""Folder object""" """Folder object"""
meta_type ='Folder' meta_type='Folder'
id ='folder' id ='folder'
title='Folder object' title ='Folder object'
icon ='OFS/Folder_icon.gif' icon ='OFS/Folder_icon.gif'
_properties=({'id':'title', 'type': 'string'},) _properties=({'id':'title', 'type': 'string'},)
meta_types=( meta_types=(DocumentHandler.meta_types+
DocumentHandler.meta_types+ ImageHandler.meta_types+
ImageHandler.meta_types+ FolderHandler.meta_types+
FolderHandler.meta_types UserFolderHandler.meta_types
) )
manage_options=( manage_options=(
{'icon':icon, 'label':'Contents', {'icon':icon, 'label':'Contents',
'action':'manage_main', 'target':'manage_main'}, 'action':'manage_main', 'target':'manage_main'},
{'icon':'OFS/Properties_icon.gif', 'label':'Properties', {'icon':'OFS/Properties_icon.gif', 'label':'Properties',
'action':'manage_propertiesForm', 'target':'manage_main'}, 'action':'manage_propertiesForm', 'target':'manage_main'},
{'icon':'AccessControl/AccessControl_icon.gif', 'label':'Access Control',
'action':'AccessControlLists/manage_main', 'target':'manage_main'},
{'icon':'OFS/Help_icon.gif', 'label':'Help', {'icon':'OFS/Help_icon.gif', 'label':'Help',
'action':'manage_help', 'target':'_new'}, 'action':'manage_help', 'target':'_new'},
) )
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<TITLE>New HTML Document</TITLE> <TITLE>New HTML Document</TITLE>
</HEAD> </HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555" ALINK="#77003B"> <BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555" ALINK="#77003B">
<FONT SIZE="+2" COLOR="#77003B">New HTML Document</FONT> <FONT SIZE="+2">New HTML Document</FONT>
<P> <P>
You can create a new image in the system using the form below. You can create a new image in the system using the form below.
Select an image from your local computer by clicking the <I>Browse</I> Select an image from your local computer by clicking the <I>Browse</I>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<TITLE>New Folder</TITLE> <TITLE>New Folder</TITLE>
</HEAD> </HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555" ALINK="#77003B"> <BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555" ALINK="#77003B">
<FONT SIZE="+2" COLOR="#77003B">New Folder</FONT> <FONT SIZE="+2">New Folder</FONT>
<FORM ACTION="<!--#var PARENT_URL-->/manage_addFolder" METHOD="POST"> <FORM ACTION="<!--#var PARENT_URL-->/manage_addFolder" METHOD="POST">
<TABLE CELLSPACING="2"> <TABLE CELLSPACING="2">
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<TITLE>New Image</TITLE> <TITLE>New Image</TITLE>
</HEAD> </HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555" ALINK="#77003B"> <BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555" ALINK="#77003B">
<FONT SIZE="+2" COLOR="#77003B">New Image</FONT> <FONT SIZE="+2">New Image</FONT>
<P> <P>
You can create a new image in the system using the form below. You can create a new image in the system using the form below.
Select an image from your local computer by clicking the <I>Browse</I> Select an image from your local computer by clicking the <I>Browse</I>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<TITLE>Edit Image</TITLE> <TITLE>Edit Image</TITLE>
</HEAD> </HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555" ALINK="#77003B"> <BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555" ALINK="#77003B">
<FONT SIZE="+2" COLOR="#77003B">New Image</FONT> <FONT SIZE="+2">New Image</FONT>
<P> <P>
You can update image in the system using the form below. You can update image in the system using the form below.
Select an image from your local computer by clicking the <I>Browse</I> Select an image from your local computer by clicking the <I>Browse</I>
......
<HTML> <HTML>
<HEAD> <HEAD>
<TITLE><!--#if title--> <TITLE>
<!--#var title--><!--#else title--> <!--#if title-->
<!--#var id--><!--#/if title--></TITLE> <!--#var title-->
<!--#else title-->
<!--#var id-->
<!--#/if title-->
</TITLE>
</HEAD> </HEAD>
<BODY> <BODY>
<FONT SIZE="+2" COLOR="#77003B"> <FONT SIZE="+2">
<!--#if title--> <!--#if title-->
<!--#var title--><!--#else title--> <!--#var title-->
<!--#var id--><!--#/if title--> <!--#else title-->
<!--#var id-->
<!--#/if title-->
</FONT> </FONT>
<BR> <P>
<!--#if parentObject--> <!--#if parentObject-->
<!--#in parentObject--> <!--#in parentObject-->
<A HREF="<!--#var URL2-->/manage" target="_top"> <A HREF="<!--#var URL2-->/manage" target="_top">
<IMG SRC="<!--#var SOFTWARE_URL-->/OFS/UpFolder_icon.gif" BORDER=0> <IMG SRC="<!--#var SOFTWARE_URL-->/OFS/UpFolder_icon.gif" BORDER=0>
</A> </A>
Go up to <!--#if title--> Return to <!--#if title-->
<!--#var title--><!--#else title--> <!--#var title-->
<!--#var id--><!--#/if title--> <!--#else title-->
<!--#var id-->
<!--#/if title-->
<BR> <BR>
<!--#/in parentObject--> <!--#/in parentObject-->
<!--#/if parentObject--> <!--#/if parentObject-->
...@@ -43,9 +51,8 @@ ...@@ -43,9 +51,8 @@
<!--#var title--> (<!--#var id-->)<!--#else title--> <!--#var title--> (<!--#var id-->)<!--#else title-->
<!--#var id--><!--#/if title--></A><BR> <!--#var id--><!--#/if title--></A><BR>
<!--#/in objectValues--> <!--#/in objectValues-->
<P>
<!--#/if objectValues--> <!--#/if objectValues-->
<P>
<TABLE> <TABLE>
<TR> <TR>
<TD VALIGN="TOP"> <TD VALIGN="TOP">
...@@ -62,7 +69,6 @@ ...@@ -62,7 +69,6 @@
</FORM> </FORM>
</TD> </TD>
</TR> </TR>
<!--#if objectValues--> <!--#if objectValues-->
<TR> <TR>
<TD VALIGN="TOP"> <TD 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