download_authorize

one of the documented procedures in this installation of the ACS
Usage:
download_authorize   db   download_id
What it does:
given download_id, this procedure will check whether the user has display rights over this download. if download doesn't exist page is served to the user informing him that the download doesn't exist. if successfull it will return user_id of the administrator.
Defined in: /web/philip/tcl/download-defs.tcl

Source code:

 

    # deprecated

    set selection [ns_db 0or1row $db "
    select scope, group_id, download_id
    from downloads
    where download_id=$download_id"]

    if { [empty_string_p $selection] } {
	uplevel {
	    ns_return 200 text/html "
	    [ad_scope_admin_header "Download Doesn't Exist" $db]
	    [ad_scope_admin_page_title "Download Doesn't Exist" $db]
	    [ad_scope_admin_context_bar "No Download"]
	    <hr>
	    <blockquote>
	    Requested download does not exist.
	    </blockquote>
	    [ad_scope_admin_footer]
	    "
	}
	ad_script_abort
    }
 
    set_variables_after_query
    
    switch $scope {
	public {
	    set id 0
	}
	group {
	    set id $group_id
	}
    }

    set authorization_status [ad_scope_authorization_status $db $scope registered group_member none $id]

    set user_id [ad_verify_and_get_user_id]

    switch $authorization_status {
	authorized {
	    return $user_id
	}
	not_authorized {
	    ad_return_warning "Not authorized" "You are not authorized to see this page"
	    return -code 
	}
	reg_required {
	    ad_redirect_for_registration
	    return -code 
	}
    }


philg@mit.edu