Tags:
create new tag
view all tags

SID-00367: Conditional Access Control

Status: Answered 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

      Change status to:
ALERT! 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.
SupportForm
Status Answered
Title Conditional Access Control
SupportCategory CategoryAccessControl
TWiki version 4.2.4
Server OS

Web server

Perl version

Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r6 - 2009-09-05 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.