Question
I just installed the latest TWiki on a Dreamhost server. I'm trying to set access control, but am bumping into a problem. I'd appreciate anyone's help, to determine if this is a configuration problem, or a perhaps a known bug/limitation. Thanks in advance:
I am unable to use a variable with ALLOWTOPICCHANGE:
e.g. * Set ALLOWTOPICCHANGE = % TOPIC %
I'd like each user page to be automatically editable ONLY by the user (and superuser, of course).
I have no problem with "* Set ALLOWTOPICCHANGE =
JohnDoe,
SamAbrams,
SamAbramsGroup"
However if I use any type of variable with ALLOWTOPICCHANGE, then EVERYONE but the superuser gets locked out of the user page.
ALTERNATELY, is there a way to have a user's
WikiName inserted into the
NewUserTemplate? Then I could have "* Set ALLOWTOPICCHANGE =
SamAbrams" directly inserted into the new user page at the time of registration. Not an ideal alternative, but better than what I've got so far.
Thanks !
--
SamAbrams - 20 Dec 2003
Answer
First of all, please consider if you really need this access restriction. See
TWikiAccessControl#An_Important_Control_Considerati
You have not stated the TWiki version you are using. In the latest
TWikiBetaRelease you can tweak the
NewUserTemplate topic to contain
* Set ALLOWTOPICCHANGE = %WIKINAME%, TWikiAdminGroup
The
%WIKINAME% gets expanded to the
WikiName of the registered user.
You need to patch
TWikiRelease01Feb2003 so that the variable gets expanded. In the
register script, add the red part to the
# create user topic if it does not exist section:
$row = $repeat;
$row =~ s/%KEY%/$name/go;
$row =~ s/%VALUE%/$value/go;
$before .= $row;
}
}
$text = "$before$after";
# expand limited set of variables
# NOTE: Keep it in sync with the edit script
my $today = &TWiki::getGmDate();
my $userName = $remoteUser || $wikiName;
$text =~ s/%DATE%/$today/go;
$text =~ s/%USERNAME%/$userName/go; # "jdoe"
$text =~ s/%WIKINAME%/$wikiName/go; # "JonDoe"
$text =~ s/%WIKIUSERNAME%/$webName.$wikiName/go; # "Main.JonDoe"
$text =~ s/%URLPARAM{(.*?)}%/TWiki::handleUrlParam($1)/geo; # expand URL parameters
$text =~ s/%NOP{.*?}%//gos; # Remove filler: Use it to remove access control at time of
$text =~ s/%NOP%//go; # topic instantiation or to prevent search from hitting a template
$meta->put( "TOPICPARENT", ( "name" => $TWiki::wikiUsersTopicname ) );
&TWiki::Store::saveTopic( $webName, $wikiName, $text, $meta, "", 1 );
}
--
PeterThoeny - 22 Dec 2003
Thank you for your quick reply, Peter ! I was using the February 2003 release, and am just going to update to the latest stable beta release to get the above functionality.
--
SamAbrams - 23 Dec 2003