Project:Case Tracker Work
Version:5.x-0.1-alpha
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

All users see the link 'Work log' with an empty fieldset on all node types even if they don't have the right to log work

Comments

#1

I think the problem is in casetracker_work_nodeapi:
1/ no check of access rights
2/ no check of content type

Solution for 1

function casetracker_work_nodeapi(&$node, $op, $a3 = null, $a4 = null) {
  if (user_access('log work') || user_access('manage work and rates')) {
    switch ($op) {
      case 'view':
        $display = views_build_view('embed', views_get_view('casetracker_work_node'), array($node->nid));
        $display .= drupal_get_form('casetracker_work_entry_form', $op, $node->nid);     
        $node->content['casetracker_work'] = array(
          '#value' => theme('fieldset', array('#title' => 'Work log', '#value' => $display, '#collapsed' => true, '#collapsible' => true,)),
          '#weight' => 10,
        );
        break;
    }
  }
}

#2

Status:active» fixed

Thanks! I've fixed things in the dev version which should be packaged soon
http://drupal.org/node/244771

#3

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.