How do I delete content (nodes) that a user no longer has the right to create? Suppose a user of my site has had the right (the correct role with sufficient permissions) to create content of a certain type.

If the right (role) is taken away from them, how could I make the users content automatically be deleted? (the deletion doesn't have to be instant, eg. once a day is fine) i.e the content will be deleted from the moment they no longer have permissions to edit it or create such content.
This code gives you the basic idea:

$nodes = node_load_multiple(array(), array('type' =&gt; 'my_type'));// load node by certain type
foreach ($nodes as $node){
    $uid= $node-&gt;uid;//get the node author id
    $nid = $node-&gt;nid;// get the node id
    $author = user_load($uid);//load the author of the node
    if (!in_array('your_role', $author-&gt;roles)) { //the author has not your_role role
        node_delete($nid);
    }
}  


if you copy this code in the theme_preprocess_html of your template.php, for every page it checks the nodes and its author roles and delete the node id its author has not the role.

If you need to run this code once a user role is updated, you can use Rules module :



I am not able to run this code right now, but it should work correctly. You can use devel module to correctly get the $node properties ($nid and $uid).