• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item4809: ConditionalBasedOnGroupMembership

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine   Enhancement Closed   minor 4.2.0

Edit Form Data

Reported By:
Applies To:
Current State:
Waiting For:
Target Release:
Released In:


from TWiki:Support.ConditionalBasedOnGroupMembership

Here's a little hack to add "group" functionality to %IF... Insert the following code into lib/TWiki/If.pm, somewhere around line 86:

$defOps{group} =
{ name => 'group',
prec => 5,
type => 0, # unary
exec => sub {
my( $twiki, $a, $b ) = @_;
my $s=$b->evaluate($twiki);
for my $group ($twiki->{user}->getGroups) {
return 1 if( $s eq $group->wikiName );
return 0;

Then you can use the following syntax:

%IF{ "group TWikiAdminGroup" then="*yes*" else="no"}%

Hope this helps.

-- SteveMokris - 28 Sep 2007

-- TWiki:Main/SvenDowideit - 13 Oct 2007

Simple small very self contained change

I've made the if a little more generic for 4.2, and written a set of unit tests for it:

%IF{ "SvenDowideit ingroup TWikiAdminGroup" then="*yes*" else="no"}%

-- TWiki:Main.SvenDowideit - 13 Oct 2007

Summary ConditionalBasedOnGroupMembership
ReportedBy TWiki:Main.SvenDowideit
Codebase 4.2.0, ~twiki4
SVN Range TWiki-4.3.0, Fri, 12 Oct 2007, build 15261
AppliesTo Engine

Priority Enhancement
CurrentState Closed

Checkins TWikirev:15267 TWikirev:15268
TargetRelease minor
ReleasedIn 4.2.0
Edit | Attach | Watch | Print version | History: r9 < r8 < r7 < r6 < r5 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r9 - 2008-01-22 - KennethLavrsen
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback