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

erdemkose - April 15, 2006 - 15:10
Project:Tasklist
Version:HEAD
Component:Code
Category:bug report
Priority:minor
Assigned:Unassigned
Status:closed
Description

"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;
}
?>

#1

sanduhrs - May 22, 2006 - 17:48
Status:active» needs review

here is a patch for it.

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

#2

moonray - March 19, 2007 - 15:05
Status:needs review» fixed

Fixed in CVS.

#3

Anonymous - April 2, 2007 - 15:16
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.