--- C:\Documents and Settings\acfulton\Desktop\jobtrack\jobtrack.module	2009-02-19 02:43:30.000000000 +1300
+++ C:\Documents and Settings\acfulton\Desktop\jobtrack\jobtrack.module.new	2009-03-16 11:59:58.985894100 +1300
@@ -13,18 +13,21 @@
     'jobtrack_ticket' => array(
       'name' => t('Job ticket'),
       'module' => 'jobtrack',
-      'description' => t('A <em>jobtrack ticket</em> is a ticket for a job.'),
+      'description' => t('A <em>jobtrack ticket</em> is a ticket for a job.'),
     ),
   );
 }
 
 /**
- * Implementation of hook_acces().
+ * Implementation of hook_access().
  */
 function jobtrack_access($op, $node, $account) {
   switch ($op) {
     case 'create':
       return user_access('create tickets', $account);
+    case 'update':
+      $clients = jobtrack_active_clients();
+      return user_access('edit '. $clients[$node->client]->name .' tickets', $account);
   }
 }
 
@@ -328,10 +331,11 @@
  * Implementation of hook_perm().
  */
 function jobtrack_perm() {
-  $perm = array('administer jobtrack', 'create tickets', 'edit own ticket', 'administer state', 'can suppress notification');
+  $perm = array('administer jobtrack', 'create tickets', 'edit own ticket', 'administer state', 'can suppress notification', 'can subscribe others');
   $result = db_query('SELECT name FROM {jobtrack_client} WHERE status = 1');
   while ($client = db_fetch_object($result)) {
     $perm[] = 'access '. check_plain($client->name) .' tickets';
+   $perm[] = 'edit '. check_plain($client->name) .' tickets';
   }
   return $perm;
 }
@@ -905,7 +909,7 @@
 
   // can only unassign tickets if assigned to self, or have admin permissions
   if (!$assigned || $assigned == $user->uid ||
-      user_access('administer jobtrack')) {
+      user_access('can subscribe others')) {
     $available[0] = ' - '. t('not assigned') .' -';
   }
 
@@ -917,7 +921,7 @@
   // can always re-assign ticket to self
   $available[$user->uid] = $user->name;
 
-  if (is_numeric($node->client) && user_access('administer jobtrack')) {
+  if (is_numeric($node->client) && user_access('can subscribe others')) {
     $roles = array();
     $client = db_result(db_query('SELECT name FROM {jobtrack_client} WHERE clid = %d', $node->client));
     // retrieve all roles giving permission to access current tickets
@@ -983,7 +987,8 @@
       '#description' => t('By checking this box you will prevent notification emails from being sent for this ticket update.  It is recommended that you check this box if you are adding sensitive information such as passwords which should not be mailed out in plain text.'),
     );
   }
-  if (is_array($edit) && user_access('administer jobtrack')) {
+
+  if (is_array($edit) && user_access('can subscribe others')) {
     $form['subscribe']['subscribed'] = array(
       '#type' => 'fieldset',
       '#title' => t('Subscribed'),
