one of the documented procedures in this installation of the ACS
im_group_scope_url   group_id   return_url   module_url   { user_belongs_to_group_p "" }
What it does:
Creates a url for a group scoped module. If the current user is not in the group for the module, we redirect first to a page to explain that the user must be in the group to access the scoping functionality.
Defined in: /web/philip/tcl/intranet-defs.tcl

Source code:

    if { [regexp {\?} $module_url] } {
	set url "$module_url&"
    } else {
	set url "$module_url?"
    append url "scope=group&[export_url_vars group_id return_url]"
    if { ![empty_string_p $user_belongs_to_group_p] && $user_belongs_to_group_p } {
	set in_group_p 1
    } else {
	set db [ns_db gethandle subquery]
	set in_group_p [ad_user_group_member $db $group_id [ad_get_user_id]]
	ns_db releasehandle $db
    if { $in_group_p } {
	return $url
    set continue_url $url
    set cancel_url $return_url
    return "[im_url_stub]/group-member-option.tcl?[export_url_vars group_id continue_url cancel_url]"