[Zope] Categorised listings/access levels

Jonathan Hobbs toolkit at magma.ca
Tue Dec 21 07:16:53 EST 2004


From: "Phillip Hutchings" <sitharus at gmail.com>
> OK, bit of an odd problem.
>
> I'm trying to create a Zope product that will display a series of
> items. The items have a title, URL and description displayed. They
> will also be sorted by categories - two main categories (mine, others)
> and many subcategories. An item can only have one main category and
> one subcategory.
>
> When displayed the items will be sorted main category->sub
> category->title, in alphabetic order, but I might want to sort in
> other ways.
>
> So, to get to the point, I was wondering what the Zope method of
> actually doing this would be. In PHP I'd create a table referencing
> the main/subcategories and just use an ORDER BY. In Zope I was
> thinking of using two classes - a container (subclass ObjectManager)
> and an item class. The item would have all the properties and I'd sort
> through those, possibly using a ZCatalog or something to index.
>
> I was wondering if that was the 'correct' approach, and if so what
> could I do to optimise searching?
>
> Secondly, a related problem. I want one user to have read/write access
> to the product, and others to have a read-only access, and anonymous
> to have no access. I assume that to give the access levels I'd create
> roles using SecurityManager calls in the Product class, and for the
> read/write role I'd use a local role. I would also guess that I'd
> assign local roles for each person with read/write access, as it would
> need to be set on a per-instance basis.

I would use ZCatalog and create a catalog index for each field that you want
to sort on or search on.

You can create routines (eg. dtml methods/python scripts) for the various
access activities (ie. one routine which is only used for 'viewing', another
routine which is used for 'updating') and then assign these routines a
security access level via Proxy Roles,  then set the corresponding security
level requirements on the ZCatalog and folder(s) where you will be storing
the actual objects).

Lots of info in the zope book on these topics, and you can google for more
info.

HTH

Jonathan




More information about the Zope mailing list