one of the documented procedures in this installation of the ACS
ad_permission_count   db   on_what_id   on_which_table   { permission_type "" }
What it does:
Returns the number of permissions granted on the specified row in the database (of the specified permission type, if supplied).
Defined in: /web/philip/tcl/ad-general-permissions.tcl

Source code:

    set query "select count(*)
from general_permissions
where on_what_id = $on_what_id
and on_which_table = lower('$on_which_table')"

    if { ![empty_string_p $permission_type] } {
	append query " and permission_type = '[DoubleApos $permission_type]'"

    return [database_to_tcl_string $db $query]