[Zope-CMF] adding two types with different permissions

Dieter Maurer dieter@handshake.de
Thu, 1 Aug 2002 22:11:44 +0200


Karl Anderson writes:
 > kapil thangavelu <kthangavelu@earthlink.net> writes:
 > 
 > > On Monday 29 July 2002 12:53 pm, Karl Anderson wrote:
 > > > I'm trying to add two types from the same Zope product.  Because I
 > > > want separate permissions for each's constructors, I'm using two
 > > > ContentInit calls.  However, this isn't working.
 > > 
 > > short answer, as far as i can tell, it isn't possible. the long answer, is 
 > > infinitely more ugly.
 > 
 > Well, Dieter Maurer and Evan both posted example code (with two
 > ContentInit calls for two types in one __init__.py).
 > 
 > Does anyone have a working example with real code?
I use the following working code:

 >	WebCMSClasses = (
 >	    HaufeNews.NewsItem,
 >	    Downloads.Download,
 >	                   )
 >	
 >	
 >	WebCMSConstructors = (
 >	    HaufeNews.addHaufeNewsItem,
 >	    Downloads.addDownload,
 >	                        )
 >	
 >	MemberContentClasses= (
 >	    Query.HaufeQuery,
 >	    )
 >	
 >	MemberContentConstructors= (
 >	    Query.addHaufeQuery,
 >	    )
 >	.....
 >	
 >	    utils.ContentInit( 'WebCMS Inhalte'
 >	                     , content_types=WebCMSClasses
 >	                     , permission=EditHaufeContent
 >	                     , extra_constructors=WebCMSConstructors
 >	                     , fti=Portal.factory_type_information
 >	                     ).initialize( context )
 >	
 >	    utils.ContentInit( 'Member Inhalte'
 >	                     , content_types=MemberContentClasses
 >	                     , permission=AddPortalContent
 >	                     , extra_constructors=MemberContentConstructors
 >	                     , fti=Portal.factory_type_information
 >	                     ).initialize( context )


Dieter