one of the documented procedures in this installation of the ACS
fs_check_write_p   db   user_id   version_id   { group_id "" }
What it does:
Returns 1 if the user can write the file; 0 otherwise.
Defined in: /web/philip/tcl/file-storage-defs.tcl

Source code:

    set file_id [database_to_tcl_string $db  "select file_id from fs_versions_latest where version_id = $version_id"]

    # see if the user is the owner.  If not, see if the user has permission
    if { [database_to_tcl_string $db  "select count(*) from fs_files 
             where fs_files.file_id = $file_id 
	     and fs_files.owner_id = $user_id"] > 0} {

        return 1

    } else {
        set selection [ns_db 1row $db  "select folder_p, group_id from fs_files 
             where fs_files.file_id = $file_id"]

        if { $folder_p == "t" && ![empty_string_p $group_id] } {
            # Folders in group document trees are a special case: 
            # The user may write to it iff he is a member 
            # of the group.

            return [ad_user_group_member $db $group_id $user_id]

        return [ad_user_has_row_permission_p $db $user_id "write" $version_id "FS_VERSIONS"]