Commit 1df0b9a0 authored by Ryan Graham's avatar Ryan Graham Committed by ryang

* Added the ability to import user roster data when using a read-only user...

* Added the ability to import user roster data when using a read-only user store such as LDAP or POP3.
* Added the ability to allow user elements in the import file to be in any order.
* Added a check to make sure that the username is valid.
* Removed an unnecessary check when creating roster items.
* Updated UI to match later versions of Wildfire.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@6859 b35dd754-fafc-0310-a699-88a17e54d16e
parent 8a3ff84a
...@@ -6,75 +6,75 @@ ...@@ -6,75 +6,75 @@
<style type="text/css"> <style type="text/css">
/* global font and body settings */ /* global font and body settings */
body { body {
font-size : 100%; font-size : 100%;
background-color : #d3d6d9; background-color : #d3d6d9;
padding: 0px; padding: 0px;
margin: 0px 0px 30px 0px; margin: 0px 0px 30px 0px;
} }
body, td, th { body, td, th {
font-family : arial, helvetica, sans-serif; font-family : arial, helvetica, sans-serif;
font-size : 10pt; font-size : 10pt;
} }
pre, tt, code { pre, tt, code {
font-family : courier new, monospaced; font-family : courier new, monospaced;
font-size : 9pt; font-size : 9pt;
} }
#pageContainer { #pageContainer {
display: block; display: block;
position: relative; position: relative;
clear: both; clear: both;
background-color: #fff; background-color: #fff;
border: 1px solid #999; border: 1px solid #999;
padding: 40px; padding: 40px;
margin: 30px; margin: 30px;
-moz-border-radius: 6px; -moz-border-radius: 6px;
} }
#pageHeader { #pageHeader {
display: block; display: block;
position: relative; position: relative;
height: 80px; height: 80px;
background-color: #e7eaee; background-color: #e7eaee;
border: 1px solid #cccccc; border: 1px solid #cccccc;
border-bottom: none; border-bottom: none;
-moz-border-radius: 5px 5px 0px 0px; -moz-border-radius: 5px 5px 0px 0px;
margin: 10px 0px 0px 0px; margin: 10px 0px 0px 0px;
} }
#pageBody { #pageBody {
margin: 0px 18px 0px 20px; margin: 0px 18px 0px 20px;
} }
/* anchors */ /* anchors */
a:link { a:link {
color: #11568c; color: #11568c;
} }
a:visited { a:visited {
color: #571c8d; color: #571c8d;
} }
a:hover { a:hover {
color: #7a1d42; color: #7a1d42;
text-decoration : underline; text-decoration : underline;
} }
a:active { a:active {
color: #7a1d42; color: #7a1d42;
} }
/* page header elements (logo and navigation) */ /* page header elements (logo and navigation) */
.navigation { .navigation {
display: block; display: block;
position: relative; position: relative;
height: 20px; height: 20px;
background-color: #335588; background-color: #335588;
border: 1px solid #cccccc; border: 1px solid #cccccc;
border-top: none; border-top: none;
color: #ffffff; color: #ffffff;
font-size: 11px; font-size: 11px;
line-height: 18px; line-height: 18px;
padding: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;
margin: 0px 0px 25px 0px; margin: 0px 0px 25px 0px;
overflow: hidden; overflow: hidden;
} }
.navigation a { .navigation a {
margin: 0px 20px 0px 20px; margin: 0px 20px 0px 20px;
} }
.navigation a:link { color: #ffffff; } .navigation a:link { color: #ffffff; }
.navigation a:visited { color: #ffffff; } .navigation a:visited { color: #ffffff; }
...@@ -83,86 +83,93 @@ a:active { ...@@ -83,86 +83,93 @@ a:active {
/* headings */ /* headings */
h1 { h1 {
display: block; display: block;
position: relative; position: relative;
font-size : 1.7em; font-size : 1.7em;
font-weight : bold; font-weight : bold;
color: #670e15; color: #670e15;
padding: 0px; padding: 0px;
margin: 30px 0px 0px 20px; margin: 30px 0px 0px 20px;
} }
h2 { h2 {
font-size : 1.3em; font-size : 1.3em;
font-weight : bold; font-weight : bold;
margin: 40px 0px 6px 0px; margin: 40px 0px 6px 0px;
padding: 0px; padding: 0px;
color: #335588; color: #335588;
} }
h3 { h3 {
font-size : 1.0em; font-size : 1.0em;
font-weight : bold; font-weight : bold;
margin: 25px 0px 3px 0px; margin: 25px 0px 3px 0px;
padding: 0px; padding: 0px;
color: #334466; color: #334466;
} }
/* general elements */ /* general elements */
p { p {
margin: 0px 0px 15px 0px; margin: 0px 0px 15px 0px;
} }
ul { ul {
margin: 5px 0px 15px 35px; margin: 5px 0px 15px 35px;
} }
li { li {
padding-bottom : 4px; padding-bottom : 4px;
} }
tt { tt {
font-family : courier new; font-family : courier new;
font-weight : bold; font-weight : bold;
color : #060; color : #060;
} }
hr { hr {
display: block; display: block;
height: 1px; height: 1px;
background-color: #999999; background-color: #999999;
border: none; border: none;
margin: 40px 0px 20px 0px; margin: 40px 0px 20px 0px;
} }
.footer { .footer {
font-size : 8pt; font-size : 8pt;
color : #666; color : #666;
text-align : center; text-align : center;
margin-top : 2em; margin-top : 2em;
padding-top : 0.5em; padding-top : 0.5em;
border-top : 1px #CCC solid; border-top : 1px #CCC solid;
} }
</style> </style>
</head> </head>
<body> <body>
<div id="pageContainer"> <div id="pageContainer">
<div id="pageHeader">
<div id="pageHeader"> <h1>User Import/Export Plugin Changelog</h1>
<h1>User Import/Export Plugin Changelog</h1> </div>
</div>
<div id="pageBody"> <div id="pageBody">
<h2>2.1.0 -- <span style="font-weight: normal;">Januar 29, 2007</span></h2>
<ul>
<li>Added the ability to import user roster data when using a read-only user store such as LDAP or POP3.</li>
<li>Added the ability to allow user elements in the import file to be in any order.</li>
<li>Added a check to make sure that the username is valid.</li>
<li>Removed an unnecessary check when creating roster items.</li>
<li>Updated UI to match later versions of Wildfire.</li>
</ul>
<h2>2.0.4 -- <span style="font-weight: normal;">October 06, 2006</span></h2> <h2>2.0.4 -- <span style="font-weight: normal;">October 06, 2006</span></h2>
<ul> <ul>
<li>Updated to use compression offered by Wildfire 3.1</li> <li>Updated to use compression offered by Wildfire 3.1</li>
</ul> </ul>
<h2>2.0.3 -- <span style="font-weight: normal;">July 10, 2006</span></h2> <h2>2.0.3 -- <span style="font-weight: normal;">July 10, 2006</span></h2>
<ul> <ul>
<li>Updated to work with Wildfire 3.0.1.</li> <li>Updated to work with Wildfire 3.0.1.</li>
</ul> </ul>
<h2>2.0.2 -- <span style="font-weight: normal;">December 15, 2005</span></h2> <h2>2.0.2 -- <span style="font-weight: normal;">December 15, 2005</span></h2>
<ul> <ul>
<li>Now requires Wildfire 2.4.0.</li> <li>Now requires Wildfire 2.4.0.</li>
</ul> </ul>
<h2>2.0.1 -- <span style="font-weight: normal;">November 29, 2005</span></h2> <h2>2.0.1 -- <span style="font-weight: normal;">November 29, 2005</span></h2>
...@@ -186,10 +193,10 @@ hr { ...@@ -186,10 +193,10 @@ hr {
<h2>1.0 -- <span style="font-weight: normal;">June 1, 2005</span></h2> <h2>1.0 -- <span style="font-weight: normal;">June 1, 2005</span></h2>
<ul> <ul>
<li>Initial release.</li> <li>Initial release.</li>
</ul> </ul>
</div> </div>
</div> </div>
</body> </body>
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="Wildfire"> <xs:element name="Wildfire">
<xs:complexType> <xs:complexType>
<xs:sequence> <xs:sequence>
<xs:element ref="User" maxOccurs="unbounded"/> <xs:element ref="User" maxOccurs="unbounded" />
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
<xs:element name="User"> <xs:element name="User">
<xs:complexType> <xs:complexType>
<xs:sequence> <xs:all>
<xs:element ref="Username" use="required"/> <xs:element ref="Username" use="required" />
<xs:element ref="Password" use="required"/> <xs:element ref="Password" use="required" />
<xs:element ref="Email"/> <xs:element ref="Email" />
<xs:element ref="Name"/> <xs:element ref="Name" />
<xs:element ref="CreationDate"/> <xs:element ref="CreationDate" />
<xs:element ref="ModifiedDate"/> <xs:element ref="ModifiedDate" />
<xs:element ref="Roster"/> <xs:element ref="Roster" />
</xs:sequence> </xs:all>
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
<xs:element name="Username" type="xs:string"/> <xs:element name="Username" type="xs:string" />
<xs:element name="Password" type="xs:string"/> <xs:element name="Password" type="xs:string" />
<xs:element name="Email" type="xs:string"/> <xs:element name="Email" type="xs:string" />
<xs:element name="Name" type="xs:string"/> <xs:element name="Name" type="xs:string" />
<xs:element name="CreationDate" type="jive-date"/> <xs:element name="CreationDate" type="jive-date" />
<xs:element name="ModifiedDate" type="jive-date"/> <xs:element name="ModifiedDate" type="jive-date" />
<xs:element name="Roster"> <xs:element name="Roster">
<xs:complexType> <xs:complexType>
<xs:sequence> <xs:sequence>
<xs:element ref="Item" minOccurs="0" maxOccurs="unbounded"/> <xs:element ref="Item" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
<xs:element name="Item"> <xs:element name="Item">
<xs:complexType> <xs:complexType>
<xs:sequence> <xs:sequence>
<xs:element ref="Group" maxOccurs="unbounded"/> <xs:element ref="Group" maxOccurs="unbounded" />
</xs:sequence> </xs:sequence>
<xs:attribute ref="jid" use="required"/> <xs:attribute ref="jid" use="required" />
<xs:attribute name="askstatus" use="required"/> <xs:attribute name="askstatus" use="required" />
<xs:attribute name="recvstatus" use="required"/> <xs:attribute name="recvstatus" use="required" />
<xs:attribute name="substatus" use="required"/> <xs:attribute name="substatus" use="required" />
<xs:attribute name="name"/> <xs:attribute name="name" />
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
<xs:element name="Group" type="xs:string"/> <xs:element name="Group" type="xs:string" />
<xs:attribute name="jid" type="xs:string"/> <xs:attribute name="jid" type="xs:string" />
<xs:attribute name="name" type="xs:string"/> <xs:attribute name="name" type="xs:string" />
<xs:attribute name="askstatus"> <xs:attribute name="askstatus">
<xs:simpleType> <xs:simpleType>
<xs:restriction base="xs:integer"> <xs:restriction base="xs:integer">
<xs:minInclusive value="-1"/> <xs:minInclusive value="-1" />
<xs:maxInclusive value="3"/> <xs:maxInclusive value="3" />
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
</xs:attribute> </xs:attribute>
<xs:attribute name="recvstatus"> <xs:attribute name="recvstatus">
<xs:simpleType> <xs:simpleType>
<xs:restriction base="xs:integer"> <xs:restriction base="xs:integer">
<xs:minInclusive value="-1"/> <xs:minInclusive value="-1" />
<xs:maxInclusive value="3"/> <xs:maxInclusive value="3" />
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
</xs:attribute> </xs:attribute>
<xs:attribute name="substatus"> <xs:attribute name="substatus">
<xs:simpleType> <xs:simpleType>
<xs:restriction base="xs:integer"> <xs:restriction base="xs:integer">
<xs:minInclusive value="-1"/> <xs:minInclusive value="-1" />
<xs:maxInclusive value="3"/> <xs:maxInclusive value="3" />
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
</xs:attribute> </xs:attribute>
<xs:simpleType name="jive-date"> <xs:simpleType name="jive-date">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string"></xs:restriction>
</xs:restriction> </xs:simpleType>
</xs:simpleType>
</xs:schema> </xs:schema>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<plugin> <plugin>
<class>org.jivesoftware.wildfire.plugin.ImportExportPlugin</class> <class>org.jivesoftware.wildfire.plugin.ImportExportPlugin</class>
<name>User Import Export</name> <name>User Import Export</name>
<description>Enables import and export of user data</description> <description>Enables import and export of user data</description>
<author>Ryan Graham</author> <author>Ryan Graham</author>
<version>2.0.4</version> <version>2.1.0</version>
<date>10/06/2006</date> <date>01/29/2007</date>
<minServerVersion>3.1.0</minServerVersion> <minServerVersion>3.1.0</minServerVersion>
<adminconsole> <adminconsole>
<tab id="tab-users"> <tab id="tab-users">
<sidebar id="user-import-export" name="Import &amp; Export"> <sidebar id="user-import-export" name="Import &amp; Export">
<item id="import-export-selection" name="User Import &amp; Export" <item id="import-export-selection" name="User Import &amp; Export"
url="import-export-selection.jsp" url="import-export-selection.jsp"
description="Allows the importing and exporting of Wildfire user data." /> description="Allows the importing and exporting of Wildfire user data." />
</sidebar> </sidebar>
</tab> </tab>
</adminconsole> </adminconsole>
</plugin> </plugin>
This diff is collapsed.
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
response.setContentType("application/x-download"); response.setContentType("application/x-download");
response.setHeader("Content-Disposition","attachment;filename="+fileName+".xml"); response.setHeader("Content-Disposition","attachment;filename="+fileName+".xml");
ImportExportPlugin plugin = (ImportExportPlugin) XMPPServer.getInstance().getPluginManager().getPlugin("userimportexport"); ImportExportPlugin plugin = (ImportExportPlugin) XMPPServer.getInstance().getPluginManager().getPlugin("userimportexport");
byte[] content = plugin.exportUsersToFile(); byte[] content = plugin.exportUsersToByteArray();
OutputStream os = response.getOutputStream(); OutputStream os = response.getOutputStream();
os.write(content); os.write(content);
os.flush(); os.flush();
......
<%@ page import="java.io.IOException, <%@ page import="java.io.IOException,
java.util.*, java.util.*,
org.jivesoftware.wildfire.plugin.ImportExportPlugin, org.jivesoftware.wildfire.plugin.ImportExportPlugin,
org.jivesoftware.wildfire.XMPPServer, org.jivesoftware.wildfire.XMPPServer,
org.jivesoftware.util.ParamUtils" org.jivesoftware.util.ParamUtils"
...@@ -85,13 +85,12 @@ ...@@ -85,13 +85,12 @@
<form action="export-user-data.jsp?exportUsers" method="post"> <form action="export-user-data.jsp?exportUsers" method="post">
<fieldset> <div class="jive-contentBoxHeader">Export Options</div>
<legend>Export Options</legend> <div class="jive-contentBox">
<div>
<p> <p>
Select the radio button next to the desired export option and then click on the Export button. Select the radio button next to the desired export option and then click on the Export button.
</p> </p>
<table cellpadding="3" cellspacing="0" border="0" width="100%"> <table cellpadding="3" cellspacing="0" border="0" width="100%">
<tbody> <tbody>
<tr> <tr>
...@@ -112,10 +111,7 @@ ...@@ -112,10 +111,7 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</fieldset>
<br><br>
<input type="submit" value="Export"> <input type="submit" value="Export">
</form> </form>
......
...@@ -16,12 +16,6 @@ ...@@ -16,12 +16,6 @@
<p> <p>
<% if (plugin.isUserProviderReadOnly()) { %>
Sorry, because you are using LDAP as your user store, this plugin will not work with your Wildfire installation.
<% } else { %>
The import and export functions allow you to read data into and write user The import and export functions allow you to read data into and write user
data from your Wildfire installation. data from your Wildfire installation.
...@@ -30,7 +24,13 @@ data from your Wildfire installation. ...@@ -30,7 +24,13 @@ data from your Wildfire installation.
<li><a href="export-user-data.jsp">Export User Data</a></li> <li><a href="export-user-data.jsp">Export User Data</a></li>
</ul> </ul>
<% if (plugin.isUserProviderReadOnly()) { %>
Note: because you are using a read-only user data store such as LDAP or POP3 you will only be able to import user roster data, not users themselves.
Please see the <a href="../../plugin-admin.jsp?plugin=userimportexport&showReadme=true&decorator=none">readme</a> for details.
<% } %> <% } %>
</p>
</body> </body>
</html> </html>
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
<% <%
boolean importUsers = request.getParameter("importUsers") != null; boolean importUsers = request.getParameter("importUsers") != null;
boolean success = request.getParameter("success") != null;
ImportExportPlugin plugin = (ImportExportPlugin) XMPPServer.getInstance().getPluginManager().getPlugin("userimportexport"); ImportExportPlugin plugin = (ImportExportPlugin) XMPPServer.getInstance().getPluginManager().getPlugin("userimportexport");
List<String> duplicateUsers = new ArrayList<String>(); List<String> duplicateUsers = new ArrayList<String>();
...@@ -41,8 +40,8 @@ ...@@ -41,8 +40,8 @@
response.sendRedirect("import-user-data.jsp?success=true"); response.sendRedirect("import-user-data.jsp?success=true");
return; return;
} }
errors.put("userAlreadyExists", "userAlreadyExists"); errors.put("invalidUser", "invalidUser");
} }
catch (MalformedURLException e) { catch (MalformedURLException e) {
errors.put("IOException", "IOException"); errors.put("IOException", "IOException");
...@@ -80,8 +79,13 @@ ...@@ -80,8 +79,13 @@
Import failed. Import failed.
<% } else if (errors.containsKey("invalidUserFile")) { %> <% } else if (errors.containsKey("invalidUserFile")) { %>
The import file does not match the user schema. The import file does not match the user schema.
<% } else if (errors.containsKey("userAlreadyExists")) { %> <% } else if (errors.containsKey("invalidUser")) { %>
The following users are already exist in the system and were not loaded:<br>
<% if (plugin.isUserProviderReadOnly()) { %>
The following users did not exist in the system or have invalid username so their roster was not loaded:<br>
<% } else { %>
The following users already exist in the system or have invalid username and were not loaded:<br>
<% } %>
<% <%
Iterator iter = duplicateUsers.iterator(); Iterator iter = duplicateUsers.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
...@@ -108,7 +112,11 @@ ...@@ -108,7 +112,11 @@
<tbody> <tbody>
<tr> <tr>
<td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0"></td> <td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0"></td>
<td class="jive-icon-label">All users added successfully.</td> <% if (plugin.isUserProviderReadOnly()) { %>
<td class="jive-icon-label">User roster data added successfully.</td>
<% } else { %>
<td class="jive-icon-label">All users added successfully.</td>
<% } %>
</tr> </tr>
</tbody> </tbody>
</table> </table>
...@@ -122,9 +130,8 @@ Use the form below to import a user data XML file. ...@@ -122,9 +130,8 @@ Use the form below to import a user data XML file.
<form action="import-user-data.jsp?importUsers" method="post" enctype="multipart/form-data"> <form action="import-user-data.jsp?importUsers" method="post" enctype="multipart/form-data">
<fieldset> <div class="jive-contentBoxHeader">Import</div>
<legend>Import</legend> <div class="jive-contentBox">
<div>
<p> <p>
Choose a file to import:</p> Choose a file to import:</p>
<input type="file" name="thefile"> <input type="file" name="thefile">
...@@ -136,10 +143,7 @@ Use the form below to import a user data XML file. ...@@ -136,10 +143,7 @@ Use the form below to import a user data XML file.
See the migration section of the <a href="../../plugin-admin.jsp?plugin=userimportexport&showReadme=true&decorator=none">readme</a> for details. See the migration section of the <a href="../../plugin-admin.jsp?plugin=userimportexport&showReadme=true&decorator=none">readme</a> for details.
</p> </p>
Replace Domain: <input type="text" size="20" maxlength="150" name="previousDomain" value=""/> Replace Domain: <input type="text" size="20" maxlength="150" name="previousDomain" value=""/>
</div>
</div>
</fieldset>
<br><br>
<input type="submit" value="Import"> <input type="submit" value="Import">
</form> </form>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment