Index: workflow.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/workflow/workflow.module,v
--- workflow.module	6 May 2008 16:50:48 -0000	1.54.2.28
+++ workflow.module	27 May 2008 20:03:03 -0000
@@ -373,6 +373,18 @@
       workflow_execute_transition($node, $sid, $node->workflow_comment);
     }
     else {
+      global $user;
+      $state_name = db_result(db_query('SELECT state FROM {workflow_states} WHERE sid = %d', $sid));
+      // Check immediately for permission to change state
+      $roles = array_keys($user->roles);
+      if (($user->uid == $node->uid && $node->uid > 0) || (arg(0) == 'node' && arg(1) == 'add')) {
+        $roles += array('author');
+      }
+      if (!workflow_transition_allowed($tid, $roles)) {
+        drupal_set_message(t("You do not have permissions to change the state n this node from its current state to @state_name.", array( "@state_name" => $state_name )), 'error');
+        return;
+      }
+
       // Schedule the the time to change the state.
       $comment = $node->workflow_comment;
       $old_sid = workflow_node_current_state($node);
@@ -2134,7 +2146,7 @@
     // Make sure transition is still valid.
     if ($node->_workflow == $row->old_sid) {
       // Do transition.
-      workflow_execute_transition($node, $row->sid, $row->comment);
+      workflow_execute_transition($node, $row->sid, $row->comment, TRUE);
 
       watchdog('content', t('%type: scheduled transition of %title.', array('%type' => t($node->type), '%title' => $node->title)), WATCHDOG_NOTICE, l(t('view'), 'node/'. $node->nid));
       $clear_cache = TRUE;