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 @@
__doc__='''Application support
$Id: Application.py,v 1.5 1997/08/15 22:24:12 jim Exp $'''
__version__='$Revision: 1.5 $'[11:-2]
$Id: Application.py,v 1.6 1997/08/27 13:30:19 brian Exp $'''
__version__='$Revision: 1.6 $'[11:-2]
import Folder, regex
import Globals
from string import lower, find
from AccessControl.User import UserFolder
class Application(Folder.Folder):
id='Your Place'
title='DC Web Environment'
id =title
__roles__=None
title=''
web__form__method='GET'
manage_options=Folder.Folder.manage_options+(
{'icon':'App/arrow.jpg', 'label':'Application Management',
......@@ -37,6 +38,9 @@ class Application(Folder.Folder):
if find(destination,'//') >= 0: raise 'Redirect', destination
raise 'Redirect', ("%s/%s" % (PARENT_URL, destination))
__allow_groups__=UserFolder()
def open_bobobase():
# Open the application database
Bobobase=Globals.Bobobase=Globals.PickleDictionary(Globals.BobobaseName)
......@@ -45,7 +49,11 @@ def open_bobobase():
import initial_products
initial_products.install(Bobobase)
get_transaction().commit()
if not Bobobase.has_key('roles'):
Bobobase['roles']=('manage',)
get_transaction().commit()
products=Bobobase['products']
install_products(products)
......@@ -57,6 +65,7 @@ def install_products(products):
# that all folders know about top-level objects, aka products
meta_types=list(Folder.Folder.dynamic_meta_types)
role_names=list(Globals.Bobobase['roles'])
for product in products:
product=__import__(product)
......@@ -101,8 +110,16 @@ def install_products(products):
for name,method in product.methods.items():
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)
Globals.Bobobase['roles']=tuple(role_names)
##############################################################################
# Test functions:
......@@ -119,6 +136,30 @@ if __name__ == "__main__": main()
##############################################################################
#
# $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
# Added Redirect
#
......
"""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 ObjectManager import ObjectManager
from Image import Image, ImageHandler
from Document import Document, DocumentHandler
from AccessControl.ACL import ACL
from Image import ImageHandler
from Document import DocumentHandler
from AccessControl.User import UserFolderHandler
class FolderHandler:
......@@ -20,9 +20,6 @@ class FolderHandler:
manage_addFolderForm=HTMLFile('OFS/folderAdd')
def __init__(self):
self.__allow_groups__=self.AccessControlLists=ACL()
def folderClass(self):
return Folder
return self.__class__
......@@ -56,28 +53,27 @@ class FolderHandler:
return t
class Folder(ObjectManager,DocumentHandler,ImageHandler,FolderHandler):
class Folder(ObjectManager,DocumentHandler,ImageHandler,
FolderHandler,UserFolderHandler):
"""Folder object"""
meta_type ='Folder'
meta_type='Folder'
id ='folder'
title='Folder object'
icon ='OFS/Folder_icon.gif'
title ='Folder object'
icon ='OFS/Folder_icon.gif'
_properties=({'id':'title', 'type': 'string'},)
meta_types=(
DocumentHandler.meta_types+
ImageHandler.meta_types+
FolderHandler.meta_types
)
meta_types=(DocumentHandler.meta_types+
ImageHandler.meta_types+
FolderHandler.meta_types+
UserFolderHandler.meta_types
)
manage_options=(
{'icon':icon, 'label':'Contents',
'action':'manage_main', 'target':'manage_main'},
{'icon':'OFS/Properties_icon.gif', 'label':'Properties',
'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',
'action':'manage_help', 'target':'_new'},
)
......
......@@ -3,7 +3,7 @@
<TITLE>New HTML Document</TITLE>
</HEAD>
<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>
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>
......
......@@ -3,7 +3,7 @@
<TITLE>New Folder</TITLE>
</HEAD>
<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">
<TABLE CELLSPACING="2">
......
......@@ -3,7 +3,7 @@
<TITLE>New Image</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555" ALINK="#77003B">
<FONT SIZE="+2" COLOR="#77003B">New Image</FONT>
<FONT SIZE="+2">New Image</FONT>
<P>
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>
......
......@@ -3,7 +3,7 @@
<TITLE>Edit Image</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555" ALINK="#77003B">
<FONT SIZE="+2" COLOR="#77003B">New Image</FONT>
<FONT SIZE="+2">New Image</FONT>
<P>
You can update image in the system using the form below.
Select an image from your local computer by clicking the <I>Browse</I>
......
<HTML>
<HEAD>
<TITLE><!--#if title-->
<!--#var title--><!--#else title-->
<!--#var id--><!--#/if title--></TITLE>
<TITLE>
<!--#if title-->
<!--#var title-->
<!--#else title-->
<!--#var id-->
<!--#/if title-->
</TITLE>
</HEAD>
<BODY>
<FONT SIZE="+2" COLOR="#77003B">
<FONT SIZE="+2">
<!--#if title-->
<!--#var title--><!--#else title-->
<!--#var id--><!--#/if title-->
<!--#var title-->
<!--#else title-->
<!--#var id-->
<!--#/if title-->
</FONT>
<BR>
<P>
<!--#if parentObject-->
<!--#in parentObject-->
<A HREF="<!--#var URL2-->/manage" target="_top">
<IMG SRC="<!--#var SOFTWARE_URL-->/OFS/UpFolder_icon.gif" BORDER=0>
</A>
Go up to <!--#if title-->
<!--#var title--><!--#else title-->
<!--#var id--><!--#/if title-->
Return to <!--#if title-->
<!--#var title-->
<!--#else title-->
<!--#var id-->
<!--#/if title-->
<BR>
<!--#/in parentObject-->
<!--#/if parentObject-->
......@@ -43,9 +51,8 @@
<!--#var title--> (<!--#var id-->)<!--#else title-->
<!--#var id--><!--#/if title--></A><BR>
<!--#/in objectValues-->
<P>
<!--#/if objectValues-->
<P>
<TABLE>
<TR>
<TD VALIGN="TOP">
......@@ -62,7 +69,6 @@
</FORM>
</TD>
</TR>
<!--#if objectValues-->
<TR>
<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