portal_check_administrator_maybe_redirect

one of the documented procedures in this installation of the ACS
Usage:
portal_check_administrator_maybe_redirect   db   user_id   { group_id "" }   { redirect_location "" }
What it does:
Defined in: /web/philip/tcl/portals-defs.tcl

Source code:


    
    ad_maybe_redirect_for_registration

    # set up the where clause - a blank group_id results in a more restrictive group check
    if ![empty_string_p $group_id] {
	set group_restriction "and (map.group_id = $group_id or group_name=  'Super Administrators')"
    } else {
	set group_restriction "and group_name=  'Super Administrators'"
    }
    if {[empty_string_p $redirect_location]} {
        # Added by Branimir, Jan 26, 2000, we also need to put URL variables into return_url
        set what_the_user_requested [ns_conn url]
        if { !([ns_getform] == "") } {
	     set url_vars [export_entire_form_as_url_vars]
             append what_the_user_requested ?$url_vars
        }
	set redirect_location "/register/index?return_url=[ns_urlencode $what_the_user_requested]"
    }

    set count [database_to_tcl_string $db " 
    select count(*) 
    from    user_group_map map, user_groups ug 
    where   map.user_id = $user_id
    and     map.group_id = ug.group_id
    and     ug.group_type = 'portal_group'
    and     role='administrator'
    $group_restriction"]

    if {$count == 0 } {
	ad_returnredirect $redirect_location
        ad_script_abort
    }
    return


philg@mit.edu