Index: casetracker.module =================================================================== --- casetracker.module (revision 3) +++ casetracker.module (working copy) @@ -36,6 +36,7 @@ return array( 'access case tracker', 'administer case tracker', + 'assign cases', ); } @@ -390,9 +391,11 @@ $default_assign_to = variable_get('casetracker_default_assign_to', variable_get('anonymous', t('Anonymous'))); } + // Only show this element if the user has access. $form['casetracker']['assign_to'] = array( '#title' => t('Assign to'), '#required' => TRUE, + '#access' => user_access('assign cases'), ); // Use different widgets based on the potential assignees. @@ -750,14 +753,16 @@ $output .= drupal_render($form['case_title']); if ($form['assign_to']['#type'] == 'radios') { - $header = array_fill(0, 5, array()); - $header[0] = $form['assign_to']['#title']; - $radios = array(); - foreach (element_children($form['assign_to']) as $id) { - $radios[] = drupal_render($form['assign_to'][$id]); + if ($form['assign_to']['#access']) { + $header = array_fill(0, 5, array()); + $header[0] = $form['assign_to']['#title']; + $radios = array(); + foreach (element_children($form['assign_to']) as $id) { + $radios[] = drupal_render($form['assign_to'][$id]); + } + $radios = array_chunk($radios, 5); + $output .= theme('table', $header, $radios, array('class' => 'casetracker-assign-to')); } - $radios = array_chunk($radios, 5); - $output .= theme('table', $header, $radios, array('class' => 'casetracker-assign-to')); drupal_render($form['assign_to']); } else {