function services_views_access in Services Views 6
Same name and namespace in other branches
- 7 services_views.module \services_views_access()
Check the access permission to a given views.
Parameters
$op: String. The operation that's going to be performed.
$args: Array. The arguments that will be passed to the callback.
Return value
Boolean. TRUE if the user is allowed to load the given view.
1 string reference to 'services_views_access'
- services_views_services_resources in ./
services_views.module - Implementation of hook_services_resources().
File
- ./
services_views.module, line 105 - Provides a generic but powerful API for web services.
Code
function services_views_access($op = 'view', $args = array()) {
switch ($op) {
case 'view':
$view = views_get_view($args['view_name']);
if (empty($view)) {
return services_error(t('View @view could not be found', array(
'@view' => $args['view_name'],
)), 404);
}
if (!isset($view->display[$args['display_id']])) {
return services_error(t('Display @display on view @view could not be found', array(
'@display' => $args['display_id'],
'@view' => $args['view_name'],
)), 404);
}
return $view
->access($args['display_id']);
}
}