Categorised listings/access levels
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'm still making the PHP->Zope transition. Let me know if I'm completely up the wrong tree ;) -- Phillip Hutchings http://www.sitharus.com/ sitharus@gmail.com / sitharus@sitharus.com
From: "Phillip Hutchings" <sitharus@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
Can anyone point me to how to replace the acl_users in a Zope root? The emergency user doesn't appear to be allowed to add it and I can't find any documentation. I want to replace the default with something with a bit more flexibility, like SimpleUserFolder or GRUF. Thanks -- Mark Barratt Text Matters Information design: we help explain things using language | design | systems | process improvement ______________________________________________________ phone +44 (0)118 986 8313 email markb@textmatters.com web http://www.textmatters.com
Mark Barratt wrote:
Can anyone point me to how to replace the acl_users in a Zope root? The emergency user doesn't appear to be allowed to add it and I can't find any documentation.
I want to replace the default with something with a bit more flexibility, like SimpleUserFolder or GRUF.
Thanks
I do not like the idea of replacing acl_users in Zope root. Especially if you are attaching User Information to something like an external DB (if the DB server goes down you are locked out of Zope!). Also, if you use SUF - first test it out in a new subfolder. When you are confident then drop it in a production (sub) folder. Just my 2 cents. David
David Hassalevris wrote:
I do not like the idea of replacing acl_users in Zope root. Especially if you are attaching User Information to something like an external DB (if the DB server goes down you are locked out of Zope!). Also, if you use SUF - first test it out in a new subfolder. When you are confident then drop it in a production (sub) folder.
Thanks. Problem is, this is an existing site that has been accreting cruft, hard-coded absolute links, and all sorts for some years. I guess I could choose a subfolder, do the tests, then copy the whole of the site into that folder and use VHM to make it the effective root - but there's a couple of hundred megabytes of stuff - is that a safe operation? best -- Mark Barratt Text Matters Information design: we help explain things using language | design | systems | process improvement ______________________________________________________ phone +44 (0)118 986 8313 email markb@textmatters.com web http://www.textmatters.com
Hi Mark, Mark Barratt wrote:
Thanks. Problem is, this is an existing site that has been accreting cruft, hard-coded absolute links, and all sorts for some years. I guess I could choose a subfolder, do the tests, then copy the whole of the site into that folder and use VHM to make it the effective root - but there's a couple of hundred megabytes of stuff - is that a safe operation?
I've done this recently (dropped a large site down a level, used VHM to address the change), and it worked perfectly. The site was tens rather than hundreds of meg, but had some horrible links in it, none of which broke. I did it on a production server, and it hammered the CPU for a few minutes - you may need to be patient! HTH! -- Regards, PhilK Email: phil@xfr.co.uk / Voicemail & Facsimile: 07092 070518 "Work as if you lived in the early days of a better nation." - Alasdair Gray
We have a standard acl_users folder in the site root and an exUserFolder in a subfolder With an apache front end and Virtual Host Monster the outside world does not know about the root layer. This morning I created an extra layer, moving the actual site down and leaving room for some development areas not obvious to the outside world. Some hard-coded utilities did not work properly, but they were easily found and fixed. It all went very well. I would absolutely endorse the recommendation not to substitute your root level acl_users folder. I have tried things on a development box and found myself locked out of the user area - fixed by going in at the root level and using Undo. Cliff Mark Barratt wrote:
David Hassalevris wrote:
I do not like the idea of replacing acl_users in Zope root. Especially if you are attaching User Information to something like an external DB (if the DB server goes down you are locked out of Zope!). Also, if you use SUF - first test it out in a new subfolder. When you are confident then drop it in a production (sub) folder.
Thanks. Problem is, this is an existing site that has been accreting cruft, hard-coded absolute links, and all sorts for some years. I guess I could choose a subfolder, do the tests, then copy the whole of the site into that folder and use VHM to make it the effective root - but there's a couple of hundred megabytes of stuff - is that a safe operation?
best
Cliff Ford wrote:
I would absolutely endorse the recommendation not to substitute your root level acl_users folder. I have tried things on a development box and found myself locked out of the user area - fixed by going in at the root level and using Undo.
Been there, done that already. Thanks to all of you for the unanimous advice - which I'll follow. -- Mark Barratt Text Matters Information design: we help explain things using language | design | systems | process improvement ______________________________________________________ phone +44 (0)118 986 8313 email markb@textmatters.com web http://www.textmatters.com
participants (6)
-
Cliff Ford -
David Hassalevris -
Jonathan Hobbs -
Mark Barratt -
Philip Kilner -
Phillip Hutchings