I am using Views Access Callback module to set my custom callback access check. I have written a custom module and implemented the hook provided by this module. I have added a condition to return TRUE
and FALSE
. But the access callback get cached.
/**
* Implements hook_views_access_callbacks().
*/
function my_custom_views_access_callbacks() {
return array('my_custom_module_access' => t('Allow my views access.'));
}
function my_custom_module_access() {
$password = \Drupal::config('my_custom.settings')->get('my_custom.pass');
if (isset($_SESSION['my_custom_pass']) && $_SESSION['my_custom_pass'] == Crypt::hashBase64($password)) {
return TRUE;
}
return FALSE;
}
I have added callback like above. So when I drush cr
from command line it will return FALSE
because there is no session in terminal. So when I access the view in browser it still shows access denied because of cache I guess.
My question is how to handle this callback without being cached?
class ViewsAccessCallback extends AccessPluginBase