SID-00367: Conditional Access Control
| Status: |
Answered |
TWiki version: |
4.2.4 |
Perl version: |
|
| Category: |
CategoryAccessControl |
Server OS: |
|
Last update: |
16 years ago |
At my company, we have pages that we need to close for editing every so often (e.g. right before a release we close the requirements page).
I was expecting to be able to do conditional access control but I'm running into problems. I think this is a bug (a design failure) in TWiki. This should be possible.
Perhaps there is a Workaround.
I tried:
%IFDEFINEDTHEN{"%LockStatus%" as="LOCKED"}%
* Set ALLOWTOPICCHANGE = Main.GroupOne
%FIDEFINED%
but Set doesn't work as expected inside IFDEFINED (
ALLOWTOPICCHANGE was set regardless of the value of
%LockStatus%.
I also tried:
* Set ALLOWTOPICCHANGE = %IFDEFINED{"%LockStatus%" as="LOCKED" then="Main.GroupOne" else=""}%
as well as
%CALC{$SET(LockStatus,Locked)}%
%CALC{$SET(AllowedUsers, Main.GroupOne)}%
* Set ALLOWTOPICCHANGE = %CALC{$IF($EXACT($GET(LockStatus),LOCKED),$GET(AllowedUsers,)}%
and various permutations using CALC.
Part of the problem appears to be due to the way that TWiki sets variables.
* Set Foo = %CALC{...}%
doesn't set the variable FOO to the return value of the calculated expression. It sets the FOO to the string
%CALC...% which is re-evaluated every time
%FOO% is used.
Thus, if
$EXACT($GET(LockStatus),LOCKED) evaluates as false, the resulting command doesn't set
ALLOWTOPICCHANGE to empty. It sets
ALLOWTOPICCHANGE to
CALC string and everyone is locked out of the page.
Is there anything that can be done?
Should I file a bug report?
--
VickiBrown - 2009-06-12
Discussion and Answer
In general,
WorkflowPlugin can be used to control edit states. So perhaps you could use that with a "PreRelease" state?
If you can't use a preference variable as a state referent, consider
GlobalReplacePlugin
>
I was expecting to be able to do [some wizzy stuff] Should I file a bug report?
That's not a bug: that's a development request.
--
SeanCMorgan - 2009-07-29
Closing this question after more than 30 days of inactivity. Feel free to reopen if needed. Consider engaging one of the
TWiki consultants if you need timely help. We invite you to
get involved with the community, it is more likely you get community support if you support the open source project!
--
PeterThoeny - 2009-09-05
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.