Tracker hook_perm missed

Yur - December 9, 2007 - 18:04
Project:Drupal
Version:7.x-dev
Component:tracker.module
Category:feature request
Priority:normal
Assigned:Unassigned
Status:patch (code needs review)
Description

Answering to "Allow Recent posts only for certain roles?" (http://drupal.org/node/199152) I've found, that there is no hook_perm in tracker.module (Drupal 5.3&5.5).

It cause missing "tracker access" row under Access control page (admin/user/access).

After deep googling, old patch was found, tested and seems to work.

I've insert

/* Implementation of hook_perm() */

function tracker_perm() {
  return array('access recent posts');
}

before

/**
* Implementation of hook_menu().
*

and replace

  'callback' => 'tracker_page', 'access' => user_access('access content'),

to

'callback' => 'tracker_page', 'access' => (user_access('access content') && user_access('access recent posts')),

It works for me, but for sure it need to be tested before patched and committed. Somebody?

P.S. I've attach tracker.module file with code, mentioned above.

AttachmentSize
tracker.module.txt5.63 KB

#1

johanneshahn - January 18, 2008 - 12:26

also replaced line 48:

'callback' => 'tracker_track_user', 'access' => user_access('access content'),

to:

'callback' => 'tracker_track_user', 'access' => (user_access('access content') && user_access('access recent posts')),

look at if($may_cache) else ->

#2

Summit - March 12, 2008 - 22:02

Hi,

The hook is not working for me.
The /tracker page is still available for anonymous users while I set the access control to only be accessable to admin.

EDIT: This post maked me happy: http://drupal.org/node/199152#comment-654288
It appears there is also a view tracker. That should also be disabled.
It is working now, thanks for the hook!

Greetings,
Martijn

#3

incrn8 - July 3, 2008 - 05:16
Version:5.5» 5.7
Status:active» patch (code needs review)

Great fix for a really annoying bug! Thanks. FYI, it also works for 5.7 - patch is attached.

Note, if you have Views enabled, but not tracker, simply disable the "recent posts" View.

AttachmentSize
tracker-perm.patch1.52 KB

#4

drumm - July 6, 2008 - 01:47
Version:5.7» 7.x-dev
Category:bug report» feature request

This new permission would remove access to the tracker when upgrading 5.x until an admin sets the new permission. This is not something that should happen during a routine bugfix upgrade.

It would be best to start with the current development version.

#5

lilou - August 26, 2008 - 12:00

Reroll.

AttachmentSize
tracker-perm-d7.patch1.46 KB
 
 

Drupal is a registered trademark of Dries Buytaert.