Skip to content

Commit

Permalink
Item13999: Remove the overwrite User Topic option
Browse files Browse the repository at this point in the history
It doesn't work, and there are multiple issues.  Looking at the code,
this appears to have been broken as far back as Foswiki 1.0.9
  • Loading branch information
gac410 committed Mar 2, 2016
1 parent c298a40 commit 3381126
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 16 deletions.
6 changes: 1 addition & 5 deletions TopicUserMappingContrib/data/System/BulkRegistration.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="" date="1456768091" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" comment="" date="1456877772" format="1.1" version="1"}%
%META:TOPICPARENT{name="AdminToolsCategory"}%
---+ Bulk Registration

Expand Down Expand Up @@ -27,9 +27,6 @@ Below are the details.
* Set REGISTERTOPIC = %USERSWEB%.UnprocessedRegistrations
* Use this to define where to log the bulk registration process. It will be saved to the %USERSWEB% web.
* Set LOGTOPIC = %REGISTERTOPIC%Log
* Set this to 1 to make the bulk registration overwrite any existing user
topics. By default, existing user topics are left alone.
* Set OVERWRITEHOMETOPICS = 0

---++ The user table

Expand Down Expand Up @@ -107,7 +104,6 @@ Make sure that the extra fields also appear on the %SYSTEMWEB%.UserForm.
<input type="hidden" name="action" value="bulkRegister" /><sticky>&nbsp;</sticky>
<input type="submit" class="foswikiSubmit" value="Bulk Register these people" />
<input type="hidden" name="LogTopic" value="%LOGTOPIC%" />
<input type="hidden" name="OverwriteHomeTopics" value="%OVERWRITEHOMETOPICS%" />
</form>

---++ <nop>%REGISTERTOPIC%
Expand Down
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" date="1456871285" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" date="1456877772" format="1.1" version="1"}%
%META:TOPICPARENT{name="BulkRegister"}%
%{<verbatim class="tml">
===================================================
Expand All @@ -24,7 +24,6 @@
<input type='submit' class='foswikiSubmit' value='Bulk Register these people' />
<input type='hidden' name='redirectto' value='%TOPIC%' />
<input type='hidden' name='LogTopic' value='%TOPIC%Log' /><br/>
Overwrite home topics? <input type='checkbox' class='foswikiInputField' name='OverwriteHomeTopics' />
</form>
</div>"
else="<div class='foswikiAlert'> *Bulk registration is restricted to Administrators.* </div>"}%
Expand Down
10 changes: 1 addition & 9 deletions core/lib/Foswiki/UI/Register.pm
Expand Up @@ -361,9 +361,6 @@ sub bulkRegister {

my $settings = {};

# This gets set from the value in the BulkRegistrations topic
$settings->{doOverwriteTopics} = $query->param('OverwriteHomeTopics') || 0;

unless ( $session->{users}->isAdmin($user) ) {
throw Foswiki::OopsException(
'accessdenied',
Expand Down Expand Up @@ -473,9 +470,6 @@ sub _registerSingleBulkUser {
my ( $session, $fieldNames, $row, $settings ) = @_;
ASSERT($row) if DEBUG;

my $doOverwriteTopics = defined $settings->{doOverwriteTopics}
|| throw Error::Simple('No doOverwriteTopics');

my $log = "---++ Registering $row->{WikiName}\n";

#-- Ensure every required field exists
Expand Down Expand Up @@ -530,9 +524,7 @@ sub _registerSingleBulkUser {
$log .=
"$b1 $row->{WikiName} has been added to the password and user mapping managers\n";

if ( $settings->{doOverwriteTopics}
|| !$session->topicExists( $row->{webName}, $row->{WikiName} ) )
{
if ( !$session->topicExists( $row->{webName}, $row->{WikiName} ) ) {
$log .= _createUserTopic( $session, $row );
}
else {
Expand Down

0 comments on commit 3381126

Please sign in to comment.