Commit d2fb7a69 authored by Amos Latteier's avatar Amos Latteier

First cut at a filtered product add list. This will keep objects out of the...

First cut at a filtered product add list. This will keep objects out of the product add list for which the user does not have adequite permissions. This is implemented with a new method, 'filtered_meta_types' which returns all the meta_types for which a given user has permissions.
parent cebb7656
......@@ -84,9 +84,9 @@
##############################################################################
__doc__="""Object Manager
$Id: ObjectManager.py,v 1.74 1999/06/24 19:27:16 jim Exp $"""
$Id: ObjectManager.py,v 1.75 1999/06/30 15:56:46 amos Exp $"""
__version__='$Revision: 1.74 $'[11:-2]
__version__='$Revision: 1.75 $'[11:-2]
import App.Management, Acquisition, App.Undo, Globals, CopySupport
import os, App.FactoryDispatcher, ts_regex, Products
......@@ -168,6 +168,19 @@ class ObjectManager(
except: pass
return self.meta_types+Products.meta_types+pmt
def filtered_meta_types(self, user):
"Those meta types for which a user has adequite permissions."
meta_types=[]
all=callable(self.all_meta_types) and self.all_meta_types() or \
self.all_meta_types
for meta_type in all:
if meta_type.has_key('permission'):
if user.has_permission(meta_type['permission'],self):
meta_types.append(meta_type)
else:
meta_types.append(meta_type)
return meta_types
def _checkId(self, id, allow_dup=0):
# If allow_dup is false, an error will be raised if an object
# with the given id already exists. If allow_dup is true,
......
......@@ -69,9 +69,9 @@ There are currently no items in <EM><!--#var title_or_id--></EM>
<!--#/if-->
</FORM>
<!--#if all_meta_types-->
<!--#if "filtered_meta_types(AUTHENTICATED_USER)"-->
<!--#if "_.len(all_meta_types) > 1"-->
<!--#if "_.len(filtered_meta_types(AUTHENTICATED_USER)) > 1"-->
<TABLE ALIGN="LEFT">
<TR>
<TD VALIGN="MIDDLE">
......@@ -84,9 +84,9 @@ There are currently no items in <EM><!--#var title_or_id--></EM>
<FORM ACTION="<!--#var URL1-->/" METHOD="GET">
<SELECT NAME=":method" ONCHANGE="location.href=this.options[this.selectedIndex].value">
<OPTION value="manage_workspace" DISABLED>Available Objects
<!--#in all_meta_types mapping sort=name-->
<!--#in "filtered_meta_types(AUTHENTICATED_USER)" mapping sort=name-->
<OPTION value="<!--#var action-->"><!--#var name-->
<!--#/in all_meta_types-->
<!--#/in-->
</SELECT>
<NOSCRIPT><INPUT TYPE="SUBMIT" VALUE=" Add "></NOSCRIPT>
</FORM>
......@@ -96,10 +96,10 @@ There are currently no items in <EM><!--#var title_or_id--></EM>
<!--#else-->
<FORM ACTION="<!--#var URL1-->/" METHOD="GET">
To add a new item click &quot;Add&quot;.
<!--#in all_meta_types mapping sort=name-->
<!--#in "filtered_meta_types(AUTHENTICATED_USER)" mapping sort=name-->
<input type=hidden name=":method" value="<!--#var action-->">
<INPUT TYPE="SUBMIT" VALUE=" Add ">
<!--#/in all_meta_types-->
<!--#/in-->
</FORM>
<!--#/if-->
......
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