Download & Extend

add new sub-task link must be hidden to unauthorized roles

Project:Tasklist
Version:master
Component:Code
Category:bug report
Priority:minor
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

"add new sub-task" link is shown to everyone including anonymous visitors. This link should be visible to roles who have "create task" permission.

Here is a rewrite of tasks_link function: simply added && user_access('create task') to the if statement.

<?php
function tasks_link($type, $node = NULL, $teaser = FALSE) {
 
$links = array();

  if (
$type == 'node' && $node->type == 'tasks' && user_access('create task')) {
    if (!
$teaser) {
     
$links[] = l(t('add new sub-task'), "node/add/tasks",
        array(
'title' => t('Add a new task to this task list')), "edit[parent]=$node->nid");
    }
  }

  return
$links;
}
?>

Comments

#1

Status:active» needs review

here is a patch for it.

AttachmentSize
tasks.module-diff-2006-05-22-19-47-28.patch 717 bytes

#2

Status:needs review» fixed

Fixed in CVS.

#3

Status:fixed» closed (fixed)