general_comments_admin_authorize

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

Source code:



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

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

    set authorization_status [ad_scope_authorization_status $db $scope admin group_admin 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"
	    ad_script_abort
	}
	reg_required {
	    ad_redirect_for_registration
	    ad_script_abort
	}
    }


philg@mit.edu