Spam System Developer's and Admin's Guide

by Bill Schneider

Adding a spam link to another application

The spam service is a singleton and should be mounted on a single site-node URL, like /spam.

Once the spam service is mounted, you may link to the spam system from other packages to add a spam-all-users-who-meet-some-criteria feature. You need to provide a SQL query that returns a list of party_id's, and the object_id of the object that controls the spam. These parameters to the spam system are passed with ad_set_client_property rather than through the URL/form variables for security and efficiency.

For example, you can create a link to spam all group members from the /admin/groups/one.tcl page in acs-subsite with this code:

# note: you should add "spam_url:onevalue" to ad_page_contract

set sql_query "select member_id as party_id 
     from group_member_map m 
     where group_id = $group_id"

ad_set_client_property spam "sql_query" $sql_query
ad_set_client_property spam "object_id" $group_id

set spam_url "[spam_base]spam-add?"
and adding the link to to the template one.adp:
<p>
 <a href="@spam_url@">Spam all members</a>
</p>

Permissions

A spam message inherits the permissions of whatever object_id is passed into the spam-add page. You need to have write permissions on that object to create a new spam message or edit an existing spam message; and you need admin permission on that object for the spam to be considered "approved" or to approve an unapproved spam. A spam message will not actually be queued for sending unless it is approved.
bschneid@arsdigita.com