Forum OpenACS Development: Re: Permissions on categories

Collapse
Posted by Gustaf Neumann on
malte, there is no need to copy code from xowiki, one can use xowiki and reuse it like e.g. in the s5 package. There is also no need to create a high number of subtypes. Here are two approaches, the second one requires no new subtype at all.

1) One can subclass xowiki::File to e.g. XFile, add an "security label" as in mandatory access control systems as an additional attribute (security_label). If this label is an acs-object, one can define a policy rule like

Class XFile -array set require_permission {
download {{security_label read}}
}
one can define as security labels acs-objects "public", "internal use", "confidential", "top secret" and give the users rights to these (acs) objects (e.g. via groups). When an XFile is created, the security labels are associated with the files. With the policy definition above, you should be done.

2) maybe less efficient, but less programming work, using categories as security labels.

xotcl-core defines a couple of "privileges" such as "swa", "login", "creator" which are not necessarily based on acs_permissions. These privileges are defined as single words in the policy rules. One can define custom privileges as well, which are methods with names like "privilege=SOMETHING".

You can define a category tree named "security labels", map the tree to the instance, require the user to provide categories like "public" .. "top secret" for the files.
You can define such a privilege method (e.g. privilege=label), and check in this method, whether the object has such a label. Finally check, if the user has clearance for this label. Since categories are already acs-objcets, rights could be provided for the category objects.

There is an example for a custom privilege rule in generic-procs (privilege=creator, which we used for the conference registration).

Collapse
Posted by Ryan Gallimore on
Hi Gustaf,

Thanks for the instructions. Is it possible to take an existing category tree, like:

Release Notes
Documentation
Support

and grant read/write/admin on any xowiki pages inside each?

For instance I may have a user, Joe, and I want him to be able read-only the pages in Release Notes, edit the Documentation pages, but not even see the Support category.

Thanks.