From d9452c1dcbe612cac17597ce9819fd7e3373d71e Mon Sep 17 00:00:00 2001 From: Earl Miles <merlin@logrus.com> Date: Wed, 6 May 2009 06:53:41 +0000 Subject: [PATCH] #418346: Fix ctools_access() logic if using "or" and no rule passes. --- includes/context.inc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/context.inc b/includes/context.inc index c8492b71..9f1bbc30 100644 --- a/includes/context.inc +++ b/includes/context.inc @@ -1309,14 +1309,18 @@ function ctools_access($settings, $contexts = array()) { } if ($pass && $settings['logic'] == 'or') { + // Pass if 'or' and this rule passed. return TRUE; } else if (!$pass && $settings['logic'] == 'and') { + // Fail if 'and' and htis rule failed. return FALSE; } } - return TRUE; + // Return TRUE if logic was and, meaning all rules passed. + // Return FALSE if logic was or, meaning no rule passed. + return $settings['logic'] == 'and'; } /** -- GitLab