Skip to content

Commit

Permalink
Merge branch 'master' into Item14288
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDaum committed Feb 23, 2017
2 parents 8a845a2 + 2583081 commit 11cd873
Show file tree
Hide file tree
Showing 14 changed files with 188 additions and 431 deletions.
10 changes: 9 additions & 1 deletion ConfigurePlugin/templates/configure.tmpl
Expand Up @@ -52,7 +52,15 @@ configure.js script.
<ol><li>x</li></ol>
<button id="closeSearchButton">Close</button>
</div>
<div id="root" class="main"><span class="splash">Loading ...</span></div>
<div id="root" class="main"><span class="splash">Loading ...</span>
If you are seeing this message, javascript may be blocked or failing to load. Verify that:
<ul><li>pub files are reachable and that the path is correct. (Current path is <tt>%PUBURLPATH%</tt>)
<ul style="list-style-type:none"><li>Hint: Is the Foswiki logo displayed above?</ul>
<li>javascript execution is enabled in the browser, and not blocked by a script blocker
<li>there are no javascript errors that are preventing execution, and
<li>if pub files require authentication to access, authenticate and try again.
</ul>
</div>
<!-- Dialogs and messages -->
<div id="auth_prompt" title="Requires authentication">
<div id="auth_note"></div>
Expand Down
149 changes: 95 additions & 54 deletions TopicUserMappingContrib/data/System/BulkRegistration.txt
@@ -1,5 +1,12 @@
%META:TOPICINFO{author="ProjectContributor" comment="" date="1460853933" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" comment="" date="1487815547" format="1.1" version="1"}%
%META:TOPICPARENT{name="AdminToolsCategory"}%
%ADDTOZONE{"head" text="<style type='text/css'>
#bulkReg .col1 {float:left; width:30%; margin:0 3% 0 0;}
#bulkReg .col2 {float:left; width:66%;}
#bulkReg .col1 .foswikiInputField,
#bulkReg .col1 .foswikiSelect {width:90%;}
#bulkReg .required {font-size:80%; color:#aaa;}
</style>"}%
---+ Bulk Registration

Administrators can use this topic to register (i.e. create logins and user topics) for a group of people in one batch.
Expand All @@ -14,11 +21,9 @@ Note: this is an administrator job - only admistrators can run this.

If you are administrator, you will take these actions:
1 (First time use) Create new bulk registration topics (see [[#Settings][Settings]] below).
1 In the REGISTERTOPIC (%REGISTERTOPIC%) topic: create a table of new users. An example table is provided below to copy.
1 Return to this topic and press the [[#RegisterForm]["Bulk Register" button]] to create the new topics.
1 Read %LOGTOPIC% to verify if all has gone well.
1 Visit %USERSWEB%.WikiGroups if the new users need to be added to any groups.
1 When you are ready, use the [[BulkResetPassword]] page to assign passwords and notify the users of their new accounts.
1 In the REGISTERTOPIC (%REGISTERTOPIC%) topic: create a table of new users. You can include a list of groups that the new user will automatically join.
1 After saving the table changes, press the button to register the users.
1 Read %LOGTOPIC% to verify if all has gone well. A form to reset the passwords of the new users is provided at the end of the log topic.

Below are the details.

Expand All @@ -30,30 +35,97 @@ Below are the details.

---++ The user table

This table is a template for user data that will be written to the new user topics. If you stick to these basic fields you can just use the first example below.
If you want to write more data (like phone number or country) read the section [[#CustomizingUserData][Customizing user data]] as well.
The user table is a template for user data that will be written to the new user topics. Each column should correspond to a field name captured in the UserForm.
Any field not included in the form will be written to the user topic in bullet format. Add new row for each user to be registered.

If the =Password= field is not included, then use the BulkResetPassword topic to assign new passwords. For convenience, the log of user registrations generated
when bulk registration is run will include a password reset form. Note that
the form is not generated if all users have been provided with passwords.

If the =Password= field is not included, then use the BulkResetPassword topic to assign new passwords.
If a password is included, it must be a valid password (&gt; minimum length, etc.)

%IF{"{Register}{AllowLoginName}" then="*Your system is configured to use Login Names. Be sure to include the !LoginName column in your table*"}%

---+++ Example format

The following should be inserted into your %REGISTERTOPIC% as a table. This is the most simple format:

<verbatim class='tml'>
Use the following form to create a new Unprocessed Registration topic.
* Enter a new topic name. You can use %REGISTERTOPIC% or any other new topic in the %USERSWEB%
* Select one or more optional fieldnames.
* Click "Create the topic" - you will be redirected to the new topic.

<div id="bulkReg" class="foswikiFormSteps">
<form name="picker" action="%SCRIPTURL{view}%/%WEB%/%TOPIC%#BuildTopic">
<div class="foswikiFormStep">
<h3>Choose the user template</h3>
<div class="col1">
<select name="usertemplate" onchange="picker.submit()">
<option>%URLPARAM{"usertemplate" default="%SYSTEMWEB%.NewUserTemplate"}%</option>
%SEARCH{"%VALUE%%SPLIT%" scope="all" topic="*Template" web="%USERSWEB%" type="literal" nonoise="on" format="<option value=\"%USERSWEB%.$topic\">%USERSWEB%.$topic</option>"}%</select>
</select>
</div><!--//col1-->
<div class="col2">
<p>
Select the template used when creating user topics. On most sites,
this is the NewUserTemplate. Note that this selection will reload the
page to refresh the field names used by that template.
</p>
</div><!--//col2-->
</div>
</form>
#BuildTopic
<noautolink>
%EDITTABLE{}%
| FirstName | LastName | Email | WikiName |
| Test | User | you@your.domain | TestUser |
</noautolink></verbatim>
<form name="savebulk" action="%SCRIPTURLPATH{save}%/%USERSWEB%" method="post"> \
<input type="hidden" name="onlynewtopic" value="1" />

<div class="foswikiFormStep">
<h3>Name of the new bulk registration topic <span class="required">Required</span></h3>
<div class="col1">
<p>
<input type="text" name="topic" />
</p>
</div><!--//col1-->
<div class="col2">
<p>
Enter a new topic name. This topic must not exist in the %USERSWEB% web.
</p>
</div><!--//col2-->
<div class="foswikiClear"></div>
</div><!--//foswikiFormStep-->

<div class="foswikiFormStep">
<h3>Fields to include in the registration</h3>
<div class="col1">
<p>
<select multiple='on' name='fields'>
%FORMAT{"%CALCULATE{$LISTUNIQUE(%QUERY{"'%URLPARAM{"usertemplate" default="System.NewUserTemplate"}%'/fields.name"}%)}%" type="string" format="<option value='$item'>$item</option>"}%
</select>
</p>
</div><!--//col1-->
<div class="col2">
Use Ctrl-click to select multiple fields. (LastName and FirstName
will be included even if not selected. They are required for registration.)
</div><!--//col2-->
<div class="foswikiClear"></div>
</div> <!-- foswikiFormStep -->

<div class="foswikiFormStep">
<div class="col1">
<h3>Create the topic</h3>
</div><!--//col1-->
<div class="col2">
<p>
Create the topic in the %USERSWEB% Web
</p>
</div> <!-- col2 -->
<div class="foswikiClear"></div>
</div> <!-- foswikkFormStep -->
<input type="hidden" name="usertemplate" value="%URLPARAM{"usertemplate" default="NewUserTemplate"}%" />
<input type="hidden" name="action" value="save" />
<input type="hidden" name="topicparent" value="BulkRegistration" />
<input type="hidden" name="templatetopic" value="%SYSTEMWEB%.BulkRegistrationInputTemplate" />
<input type="submit" class="foswikiSubmit" value="Create the topic" />
</div><!-- foswikiFormSteps -->
</form>
</noautolink>

*Usage:*
1 Copy this text to your clipboard
1 Click through and paste this on %REGISTERTOPIC%.
1 Add and customize entries, save table.
1 Return here

#CustomizingUserData
---+++ Customizing user data
Expand All @@ -62,12 +134,8 @@ You can write additional data to the new user topics. Do this by enhancing the u

Any fields you define in this table will end up in the User's topic. If a form (such as %SYSTEMWEB%.UserForm) is attached to NewUserTemplate then the data will go in as META:FIELDS, meaning that you can use SEARCH formfield constructs to search.

If you use the %SYSTEMWEB%.UserForm then ensure that it contains all the fields you define here. Otherwise they will disappear when the user edits their home topic!

---++++ Mandatory fields
* =WikiName=
* =FirstName=
* =LastName=

---++++ Optional fields
* =LoginName= - __Required if the system is configured to__ ==AllowLoginName== (Commonly referred to as the UserName).
Expand All @@ -77,17 +145,6 @@ If you use the %SYSTEMWEB%.UserForm then ensure that it contains all the fields
* =templatetopic= - Template used when creating the User topic. If not provided, defaults to [[%USERSWEB%.NewUserTemplate]], or [[%SYSTEMWEB%.NewUserTemplate]].
* =AddToGroups= - A comma-separated list of groups. When user is registered, they will be added to the listed groups. The groups must exist.

---++++ Customized table example

Make sure that the extra fields also appear on the %SYSTEMWEB%.UserForm.

<verbatim class='tml'>
<noautolink>
%EDITTABLE{}%
| FirstName | LastName | Email | WikiName | AddToGroups | CustomFieldThis | SomeOtherRandomField | WhateverYouLike |
| Test | User | you@example.com | TestUser | MyGroup, DocGroup | A | B | C |
</noautolink></verbatim>

---

%IF{
Expand All @@ -99,21 +156,5 @@ Make sure that the extra fields also appear on the %SYSTEMWEB%.UserForm.
<!--
%JQREQUIRE{"chili"}%
-->
#RegisterForm
<form name="bulkRegister" action="%SCRIPTURLPATH{"manage"}%/%REGISTERTOPIC%" method="post">
<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%" />
</form>

---++ <nop>%REGISTERTOPIC%

%INCLUDE{"%REGISTERTOPIC%" warn="Topic does not exist"}%

---++ <nop>%LOGTOPIC%

%INCLUDE{"%LOGTOPIC%" warn="Topic will be created during registration run."}%

---

*%MAKETEXT{"Related topics:"}%* AdminToolsCategory
@@ -1,8 +1,18 @@
%META:TOPICINFO{author="ProjectContributor" date="1456871285" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" date="1487815547" format="1.1" version="1"}%
%META:TOPICPARENT{name="WikiUsers"}%
%EDITTABLE{ headerrows="1" }%%STARTSECTION{type="expandvariables"}%
| *WikiName* |%IF{"{Register}{AllowLoginName}" then=" *LoginName* |"}% *Email* | *Password* | *AddToGroups* |\
*%CALCULATE{"$LISTJOIN(* | *, $LISTIF($NOT($EXACT($item,Email)),%QUERY{"'%URLPARAM{"usertemplate" default="%SYSTEMWEB%.NewUserTemplate"}%'/fields.name"}%))"}%* |

%IF{
"context passwords_modifyable"
then=""
else='<div class="foswikiHelp">%X% <strong>%MAKETEXT{"Caution: The password system is currently read only. Users will not be added to the Password file."}%</strong>%BR%
%MAKETEXT{"If your wiki uses an external password manager, and the users you want to register are known to the password manager, then bulk registration may still be useful. Please contact [_1] if you are unsure." args="%WIKIWEBMASTER%"}%</strong></div>'
}%


%EDITTABLE{ headerrows="1" format="text,20,%URLPARAM{"usertemplate" default="NewUserTemplate"}%" }%%STARTSECTION{type="expandvariables"}%
| *TemplateTopic* | *WikiName* |%IF{"{Register}{AllowLoginName}" then=" *LoginName* |"}% *Password* | *AddToGroups* \
%FORMAT{"%CALCULATE{$LISTUNIQUE(Email,LastName,FirstName,%URLPARAM{"fields" multiple="on" separator=","}%)}%" type="text" format=" | *$item* " separator="" type="string"}% |

%ENDSECTION%

%META:PREFERENCE{name="ALLOWTOPICVIEW" title="ALLOWTOPICVIEW" type="Set" value="AdminGroup"}%
Expand Down
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" date="1456982088" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" date="1487815547" format="1.1" version="1"}%
%META:TOPICPARENT{name="BulkRegister"}%
%{<verbatim class="tml">
===================================================
Expand All @@ -23,6 +23,7 @@ _Be sure to remember to save any table changes!_
<form name='bulkRegister' action='%SCRIPTURLPATH{"manage"}%/%TOPIC%' method='post'>
<input type='hidden' name='action' value='bulkRegister' /><sticky>&nbsp;</sticky>
<input type='submit' class='foswikiSubmit' value='Bulk Register these people' />
<input type='hidden' name='topic' value='%USERSWEB%.%TOPIC%' />
<input type='hidden' name='redirectto' value='%TOPIC%' />
<input type='hidden' name='LogTopic' value='%TOPIC%Log' />
<input type='hidden' name='templatetopic' value='%USER_TEMPLATE{default=""}%' />
Expand Down
37 changes: 18 additions & 19 deletions TopicUserMappingContrib/data/System/NewUserTemplate.txt
@@ -1,6 +1,6 @@
%META:TOPICINFO{author="ProjectContributor" date="1418937051" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" comment="" date="1487815547" format="1.1" version="1"}%
%META:TOPICPARENT{name="WikiUsers"}%
---+ <nop>%TOPIC%
---+ %TOPIC%

%SPLIT%
* %KEY%: %VALUE%%SPLIT%
Expand All @@ -9,20 +9,19 @@
* Set ALLOWTOPICCHANGE = %WIKIUSERNAME%
-->


%META:FORM{name="%25SYSTEMWEB%25.UserForm"}%
%META:FIELD{name="FirstName" attributes="" title="<nop>FirstName" value=""}%
%META:FIELD{name="LastName" attributes="" title="<nop>LastName" value=""}%
%META:FIELD{name="OrganisationName" attributes="" title="<nop>OrganisationName" value=""}%
%META:FIELD{name="OrganisationURL" attributes="" title="<nop>OrganisationURL" value=""}%
%META:FIELD{name="Profession" attributes="" title="Profession" value=""}%
%META:FIELD{name="Country" attributes="" title="Country" value=""}%
%META:FIELD{name="State" attributes="" title="State" value=""}%
%META:FIELD{name="Address" attributes="" title="Address" value=""}%
%META:FIELD{name="Location" attributes="" title="Location" value=""}%
%META:FIELD{name="Telephone" attributes="" title="Telephone" value=""}%
%META:FIELD{name="VoIP" attributes="" title="<nop>VoIP" value=""}%
%META:FIELD{name="InstantMessagingIM" attributes="" title="<nop>InstantMessaging (IM)" value=""}%
%META:FIELD{name="Email" attributes="" title="Email" value=""}%
%META:FIELD{name="HomePage" attributes="" title="<nop>HomePage" value=""}%
%META:FIELD{name="Comment" attributes="" title="Comment" value=""}%
%META:FORM{name="UserForm"}%
%META:FIELD{name="FirstName" title="<nop>FirstName" value=""}%
%META:FIELD{name="LastName" title="<nop>LastName" value=""}%
%META:FIELD{name="OrganisationName" title="<nop>OrganisationName" value=""}%
%META:FIELD{name="OrganisationURL" title="<nop>OrganisationURL" value=""}%
%META:FIELD{name="Profession" title="Profession" value=""}%
%META:FIELD{name="Country" title="[[System.CountryList][Country]]" value=""}%
%META:FIELD{name="State" title="State" value=""}%
%META:FIELD{name="Address" title="Address" value=""}%
%META:FIELD{name="Location" title="Location" value=""}%
%META:FIELD{name="Telephone" title="Telephone" value=""}%
%META:FIELD{name="VoIP" title="<nop>VoIP" value=""}%
%META:FIELD{name="InstantMessagingIM" title="<nop>InstantMessaging (IM)" value=""}%
%META:FIELD{name="Email" title="Email" value=""}%
%META:FIELD{name="HomePage" title="<nop>HomePage" value=""}%
%META:FIELD{name="Comment" title="Comment" value=""}%
26 changes: 1 addition & 25 deletions UnitTestContrib/test/unit/NetTests.pm
Expand Up @@ -20,31 +20,7 @@ sub set_up {
$this->{net} = new Foswiki::Net();
}

sub LWP {
$expectedHeader = qr#text/html; charset=(utf-?8|iso-?8859-?1)#;

# Force re-eval
undef $Foswiki::Net::LWPAvailable;
}

sub Sockets {
$expectedHeader = qr#text/html#;
$Foswiki::Net::LWPAvailable = 0;
}

sub HTTPResponse {
$Foswiki::Net::noHTTPResponse = 0;
}

sub noHTTPResponse {
$Foswiki::Net::noHTTPResponse = 1;
}

sub fixture_groups {
return ( [ 'LWP', 'Sockets' ], [ 'HTTPResponse', 'noHTTPResponse' ] );
}

sub verify_getExternalResource {
sub test_getExternalResource {
my $this = shift;

# need a known, simple, robust URL to get
Expand Down
4 changes: 2 additions & 2 deletions core/lib/Foswiki/Contrib/core/DEPENDENCIES
Expand Up @@ -28,8 +28,8 @@ IO::Socket::SSL,>=1.80,cpan,Optional, for outbound SSL/TLS connections, eg. e-ma
Locale::Language,>=0,cpan,Optional, required if {UserInterfaceInternationalisation} is enabled in configuration.
Locale::Maketext::Lexicon,>=0,cpan,Optional, required if {UserInterfaceInternationalisation} is enabled in configuration.
Locale::Msgfmt,>=0,cpan,Optional, used to compress the language files in locale directory if enabled.
LWP,>=0,cpan,Optional, needed by the Configure Extensions installer,for external URL based INCLUDEs and URL item verification.
LWP::Protocol::https,>=0,cpan,Optional, needed by the Configure Extensions installer,for external URL based INCLUDEs and URL item verification.
LWP,>=0,cpan,Required, needed by the Configure Extensions installer,for external URL based INCLUDEs and URL item verification.
LWP::Protocol::https,>=0,cpan,Required, needed by the Configure Extensions installer,for external URL based INCLUDEs and URL item verification.
Mozilla::CA,>=20110904,cpan,Optional, SSL host verification for e-mail and other SSL/TLS connections.
Socket,>=2.001,cpan,Required, for base Foswiki.
URI,>=0,cpan,Required, used for Foswiki::Net URL parsing
Expand Down
1 change: 0 additions & 1 deletion core/lib/Foswiki/Contrib/core/MANIFEST
Expand Up @@ -598,7 +598,6 @@ lib/Foswiki/Merge.pm 0444
lib/Foswiki/Meta.pm 0444
lib/Foswiki/MetaCache.pm 0444
lib/Foswiki/Net.pm 0444
lib/Foswiki/Net/HTTPResponse.pm 0444
lib/Foswiki/Net/UserCredAgent.pm 0444
lib/Foswiki/OopsException.pm 0444
lib/Foswiki/PageCache.pm 0444
Expand Down
5 changes: 1 addition & 4 deletions core/lib/Foswiki/Func.pm
Expand Up @@ -303,10 +303,7 @@ the following subset of methods is available:
| =is_error()= |
| =is_redirect()= |
Note that if LWP is *not* available, this function:
1 can only really be trusted for HTTP/1.0 urls. If HTTP/1.1 or another
protocol is required, you are *strongly* recommended to =require LWP=.
1 Will not parse multipart content
Note that LWP is required for this function.
In the event of the server returning an error, then =is_error()= will return
true, =code()= will return a valid HTTP status code
Expand Down

0 comments on commit 11cd873

Please sign in to comment.