Forum OpenACS Development: Mapping category trees to object types

I assume someone must have had this request before, but I don't find the option in the code, so before I develop it on my own:

How do I map a category_tree to an object_type ?

As acs_object_types are not objects themself, the obvious way does not work. Two solutions pop into my mind:

a) Make object types acs objects. This has the benefit of solving my problem as well as allowing default permissions on object types (e.g. you can edit all tasks, but not the projects). But I'm sure there are many many reasons against it which I just don't see.

b) Extend category tree map to include an object_type, allow the object_id to be null and change the whole code to take care of that.

c) create a custom "dummy" object for the object type which I use to map against. Then in my code make sure to query against this dummy object instead of the object_type or the package_id

Collapse
Posted by Tom Jackson on
Could you create a new acs_object type to map category_tree to object_type?

I'm not sure how making object_type into an acs_object would allow you to have default permissions on objects of a particular type, I guess by setting the context_id of the object to that of the object_type, which hardly ever would be correct.

The idea of a dummy object, I think I once called a proxy object. Set permissions on the proxy and then other objects inherit through their context_id.

What is the purpose of mapping a category tree to a row in object_type?

Collapse
Posted by Malte Sussdorff on
The purpose is the following. I have a package course management with two object types (at the moment): Course and Courseinstance (similar to dotlrn). For editing the course instance I want to have one tree, for editing the course I want to use two other trees.

In the custom package this can be easily solved by adding the category_tree_id to the ad_form, but if you want to generalize this you are stuck. because there is no way to do this kind of mapping.

I think I will use a mapping within categories, but for the time being it is a custom package so I dont have to worry about it too much. And adding the mapping in categories would mean a lot of code writing, so I will stay away from it until needed (as you should provide an UI for it as well ...).