Hi all,

I am using this access callback module for access restriction in one of my views. When i call that views from services3.x. I got the following error,

Fatal error: Call to a member function set_display() on a non-object in /var/www/html/drupal6/sites/all/modules/contrib/views_access_callback/views_access_callback.module on line 34.

Can you please refer me how can i pass the 'access callback value' to get views result.

Thanks & Regards
Sarav.

Comments

a_c_m’s picture

Yup, ran into this. In my experience :

* Breaks for non root (not tested further perms)
* When viewing a full page view, its fine
* When trying to view a block, crash

karol haltenberger’s picture

Category: support » bug
Priority: Normal » Critical
Status: Active » Needs review
StatusFileSize
new746 bytes

If I understand correctly, for page displays, the module's own access callback and its arguments are provided to drupal by the plugin's get_access_callback() function:

return array('views_access_callback_access_callback', array($this->view->name, ...

For other types (block, attachment etc) the plugin has to return the result of the user defined callback, through its own access callback:

return views_access_callback_access_callback($this->options['views_access_callbacks'], array($this->view->name, ...

This however calls the module's intermediary function with the wrong arguments.
The passed arguments should be the same as in the get_access_callback() method.

return views_access_callback_access_callback($this->view->name, ...

To fix this in 6.x-1.0 replace line 9 in views_access_callback_plugin_access_callback.inc

return views_access_callback_access_callback($this->options['views_access_callbacks'], array($this->view->name, $this->display->id, $this->options['views_access_callback']));

with

return views_access_callback_access_callback($this->view->name, $this->display->id, $this->options['views_access_callback']);

or apply the attached patch.

cafuego’s picture

Status: Needs review » Fixed

Patch applied. A new 6.x-1.x-dev version should be out in a few hours.

Status: Fixed » Closed (fixed)

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

noomz’s picture

Version: 6.x-1.0 » 7.x-1.0-beta1
Issue summary: View changes
Status: Closed (fixed) » Patch (to be ported)
StatusFileSize
new879 bytes

Please also apply patch for 7.x-1.0 too. (patch attached)

Schoonzie’s picture

I am also getting this issue on 7.x-1.0-beta1.

Patch in #5 didn't apply cleanly but manually making the change fixed it.

maciej.zgadzaj’s picture

Version: 7.x-1.0-beta1 » 6.x-1.x-dev
Status: Patch (to be ported) » Closed (fixed)