Forum OpenACS Development: Re: relational segments: how do you use them

Posted by Lars Pind on

You'll find parts of it in subsite::after_mount in acs-subsite/tcl/subsite-procs.tcl.

It creates member and admin rel segments, and grants appropriate privileges to those:


            # Create segment of registered users for administrators
            set segment_name "$truncated_subsite_name Administrators"
            set admin_segment_id [rel_segments_new $subsite_group_id admin_rel $segment_name]

            # Grant admin privileges to the admin segment
            permission::grant \
                -party_id $admin_segment_id \
                -object_id $package_id \
                -privilege admin

            # Grant read/write/create privileges to the member segment
            foreach privilege { read create write } {
                permission::grant \
                    -party_id $segment_id \
                    -object_id $package_id \
                    -privilege $privilege

The rel-type is created upon installation time.

This is on oacs-4-6 tip, unreleased code, will go into an interim 4.6.4 release, and later 5.0 release.