I have a need for a couple of AND conditions plus one or more OR conditions within the same authorization. I can get multiple ANDs working in a single line like this:
AuthMySQLUserCondition "condition1='true' AND condition2='true'"
We're doing the best we can to support this project. But this is a voluntary project, and paying customers must come first. Unfortunately, it means sometimes free projects like this have to be set aside, and occasionally for an extended period.
Of course, if you can do a better job you are quite welcome to work on it yourself.
As for your user conditions - the module wasn't designed to do that, but I see no reason why it wouldn't work. You probably need parens around your entire condition, though.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I appreciate your volunteer efforts. I work 16-18 hours a day myself. If I was qualified to program in low-level languages, I would assist, however, I'm strictly a Perl hack.
Sounds like adding () would work, but since the AND condition does not seem to require them, there was no logical reason for me to consider that an OR or any other operator might. This inquiry was posted 5 months ago and the project was time-sensitive, so I had to redesign the system to work around the problem.
Can I suggest adding this solution to the README so the next guy who needs a logical OR doesn't have to reinvent the wheel as well?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No, it's simple precedence. And it has nothing to do with low level languages - it's all SQL.
AND/OR precedence in SQL is the same in most languages - left to right. We already need to add some of our conditions. User conditions are ANDed to the existing ones.
So, you end up with something like:
ourcondition=something AND yourcond1=TRUE OR yourcond2=TRUE
If yourcond2=TRUE is met, it doesn't matter what ourcondition=something is. The statement will evaluate as true, whereas
ourcondition=something AND (yourcond1=TRUE OR yourcond2=TRUE)
ourcondition=true must be met and either of your conditions must be met.
OTOH, if you have
ourcondition=something AND yourcond1=TRUE AND yourcond2=TRUE
all three conditions must be met. It's a simple matter of understanding basic SQL.
I have a need for a couple of AND conditions plus one or more OR conditions within the same authorization. I can get multiple ANDs working in a single line like this:
AuthMySQLUserCondition "condition1='true' AND condition2='true'"
or as multiple lines like this:
AuthMySQLUserCondition condition1='true'
AuthMySQLUserCondition condition2='true'
However, everything fails if I try this:
AuthMySQLUserCondition "condition1='true' OR condition2='true'"
Is there a way to sneak an OR in there someplace?
So WTF??? Are the people who wrote this module dead or something? Why no response in nearly a month?
We're doing the best we can to support this project. But this is a voluntary project, and paying customers must come first. Unfortunately, it means sometimes free projects like this have to be set aside, and occasionally for an extended period.
Of course, if you can do a better job you are quite welcome to work on it yourself.
As for your user conditions - the module wasn't designed to do that, but I see no reason why it wouldn't work. You probably need parens around your entire condition, though.
I appreciate your volunteer efforts. I work 16-18 hours a day myself. If I was qualified to program in low-level languages, I would assist, however, I'm strictly a Perl hack.
Sounds like adding () would work, but since the AND condition does not seem to require them, there was no logical reason for me to consider that an OR or any other operator might. This inquiry was posted 5 months ago and the project was time-sensitive, so I had to redesign the system to work around the problem.
Can I suggest adding this solution to the README so the next guy who needs a logical OR doesn't have to reinvent the wheel as well?
No, it's simple precedence. And it has nothing to do with low level languages - it's all SQL.
AND/OR precedence in SQL is the same in most languages - left to right. We already need to add some of our conditions. User conditions are ANDed to the existing ones.
So, you end up with something like:
ourcondition=something AND yourcond1=TRUE OR yourcond2=TRUE
If yourcond2=TRUE is met, it doesn't matter what ourcondition=something is. The statement will evaluate as true, whereas
ourcondition=something AND (yourcond1=TRUE OR yourcond2=TRUE)
ourcondition=true must be met and either of your conditions must be met.
OTOH, if you have
ourcondition=something AND yourcond1=TRUE AND yourcond2=TRUE
all three conditions must be met. It's a simple matter of understanding basic SQL.
We will consider a note in the next release.
BTW - I'm not sure why the following would work:
AuthMySQLUserCondition condition1='true'
AuthMySQLUserCondition condition2='true'
You should get one or the other - but not both.
Jerry