Tags:
create new tag
, view all tags

Question

I am testing for a user's membership in a group. Here is what I have tried:

%USERINFO{"DewayneVanHoozer" format="$groups"}%

Am I a member of AnyUndefinedGroup

%CALC{$IF($FIND(AnyUndefinedGroup, %USERINFO{"DewayneVanHoozer" format="$groups"}%), Member, Not Member)}%

Am I a member of SimulationGroup

%CALC{$IF($FIND(SimulationGroup, %USERINFO{"DewayneVanHoozer" format="$groups"}%), Member, Not Member)}%

Am I a member of Group

%CALC{$IF($FIND(Group, %USERINFO{"DewayneVanHoozer" format="$groups"}%), Member, Not Member)}%

Am I a member of TWikiAdminGroup

%CALC{$IF($FIND(TWikiAdminGroup, %USERINFO{"DewayneVanHoozer" format="$groups"}%), Member, Not Member)}%

Am I a member of ModeratorGroup

%CALC{$IF($FIND(ModeratorGroup, %USERINFO{"DewayneVanHoozer" format="$groups"}%), Member, Not Member)}%

which produces these results:

TWikiAdminGroup, ModeratorGroup, SimulationGroup isAdmin()

Am I a member of AnyUndefinedGroup?

Not Member

Am I a member of SimulationGroup

Not Member

Am I a member of Group

Member

Am I a member of TWikiAdminGroup

Member

Am I a member of ModeratorGroup

Not Member 

Any ideas? Should I be escaping something?

I was planning on using this kind of conditional inside a FormattedSearch. My overall goal is to create an address book from the Main web for only those people in a specific group. Once the problem I'm having with the Calc If Find Userinfo is resolved, I will put it into the format of my search.

This successfully produces my table:

| *Last Name* | *First Name* | *Country* | *Telephone* | *Email* | *Groups* |
%SEARCH{"%META:FORM.*[U]serForm" web="%MAINWEB%" scope="text" nosearch="on" nototal="on" order="modified" reverse="on" format="| $formfield(LastName) | $formfield(FirstName) | $formfield(Country) | $formfield(Telephone) | $formfield(Email) | $percntUSERINFO{\"$topic\" format=\"$groups\"}$percnt |" }%

Environment

TWiki version: TWikiRelease04x01x02
TWiki plugins:  
Server OS: WinXP
Web server: Apache 2.2.4
Perl version: 5.8.8
Client OS: WinXP
Web Browser: Firefox 2.0.0.4
Categories: Search

-- DewayneVanHoozer - 21 Jun 2007

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

Sorry, closing this after more than 30 days of inactivity...

-- PeterThoeny - 10 Aug 2007

 
Change status to:
Topic revision: r2 - 2007-08-10 - PeterThoeny
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.