Download & Extend

Access is "true" when using "only one criteria must pass" but none of them pass

Project:Chaos tool suite (ctools)
Version:6.x-1.0
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I tried adding two selection criteria rules, and set the logic field to "Only one criteria must pass." On a page where neither rule was a match, my panel was still being applied.

I think the issue is in includes/context.inc at the bottom of ctools_access(). As it's looping through each test, it returns the correct value for pass+OR and !pass+AND. Then, if it goes through all of the rules without returning, it returns TRUE (the last line of the function). This seems like a problem, because if there were no "passes" at all, then it will return true here.

Here's what I tried, which seems to resolve my problem:

1. Set a $gotOnePass to FALSE before looping through the tests
2. If a rule is a pass, set the variable to TRUE
3. After the loop, return $gotOnePass instead of return TRUE.

Or, if not the exactly that, I think some change is in order to account for the scenario where none of the rules are true and logic == OR.

Thanks!

Comments

#1

Status:active» fixed

Looks like I fixed this a long time ago but did not mark the issue fixed.

#2

Status:fixed» closed (fixed)

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

#3

Version:6.x-1.0-alpha2» 6.x-1.0

Sorry. I saw this issue was closed once I already submitted my comment.
Will open a new one.

nobody click here