Commit 5ebcfb1a authored by webchick's avatar webchick
Browse files

Issue #1798868 by Luukyb, Albert Volkman: Convert node_test_node_access_all_uid() to state system .

parent f42515e2
...@@ -196,7 +196,7 @@ function testNodeQueryAlterOverride() { ...@@ -196,7 +196,7 @@ function testNodeQueryAlterOverride() {
// $account instead of the global $user, we will log in as // $account instead of the global $user, we will log in as
// noAccessUser2. // noAccessUser2.
$this->drupalLogin($this->noAccessUser2); $this->drupalLogin($this->noAccessUser2);
variable_set('node_test_node_access_all_uid', $this->noAccessUser->uid); state()->set('node_access_test.no_access_uid', $this->noAccessUser->uid);
drupal_static_reset('node_access_view_all_nodes'); drupal_static_reset('node_access_view_all_nodes');
try { try {
$query = db_select('node', 'mytab') $query = db_select('node', 'mytab')
...@@ -211,6 +211,6 @@ function testNodeQueryAlterOverride() { ...@@ -211,6 +211,6 @@ function testNodeQueryAlterOverride() {
catch (Exception $e) { catch (Exception $e) {
$this->fail(t('Altered query is malformed')); $this->fail(t('Altered query is malformed'));
} }
variable_del('node_test_node_access_all_uid'); state()->delete('node_access_test.no_access_uid');
} }
} }
...@@ -19,7 +19,9 @@ function node_access_test_node_grants($account, $op) { ...@@ -19,7 +19,9 @@ function node_access_test_node_grants($account, $op) {
if ($op == 'view' && user_access('node test view', $account)) { if ($op == 'view' && user_access('node test view', $account)) {
$grants['node_access_test'] = array(8888, 8889); $grants['node_access_test'] = array(8888, 8889);
} }
if ($op == 'view' && $account->uid == variable_get('node_test_node_access_all_uid', 0)) {
$no_access_uid = state()->get('node_access_test.no_access_uid') ?: 0;
if ($op == 'view' && $account->uid == $no_access_uid) {
$grants['node_access_all'] = array(0); $grants['node_access_all'] = array(0);
} }
return $grants; return $grants;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment