Commit 024fed81 authored by Dave Cridland's avatar Dave Cridland

Merge pull request #186 from Redor/openfire

Update to REST API plugin version 1.0.1
parents be20d0f0 090831d3
......@@ -44,6 +44,15 @@
REST API Plugin Changelog
</h1>
<p><b>1.0.1</b> -- February 20th, 2015</p>
<ul>
<li>Added possibility to rename a user (Thanks to JustMarried plugin)</li>
<li>Adjusted HTTP Codes by conflict to HTTP CODE: 409</li>
<li>Added subject to Chat room</li>
<li>Disabled jersey logging on startup</li>
<li>By create a new chat room the chat room service will be created if it was not there</li>
</ul>
<p><b>1.0.0</b> -- February 3rd, 2015</p>
<ul>
<li>UserService plugin and MUC Service plugin are merged to the REST API plugin.</li>
......
......@@ -5,8 +5,8 @@
<name>REST API</name>
<description>Allows administration over a RESTful API.</description>
<author>Roman Soldatow</author>
<version>1.0.0</version>
<date>02/03/2015</date>
<version>1.0.1</version>
<date>02/20/2015</date>
<minServerVersion>3.9.0</minServerVersion>
<adminconsole>
......
......@@ -1607,6 +1607,11 @@ If you want to create a resource with JSON data format, please add “<strong>Co
<td>No</td>
<td>Description text of the room.</td>
</tr>
<tr>
<td>subject</td>
<td>Yes</td>
<td>Subject of the room.</td>
</tr>
<tr>
<td>password</td>
<td>Yes</td>
......@@ -1710,8 +1715,6 @@ If you want to create a resource with JSON data format, please add “<strong>Co
</tbody></table>
<h3 id="system-property">System Property</h3>
<table>
......@@ -1876,27 +1879,27 @@ If you want to create a resource with JSON data format, please add “<strong>Co
<pre class="prettyprint prettyprinted"><code><span class="pun">&lt;?</span><span class="pln">xml version</span><span class="pun">=</span><span class="str">"1.0"</span><span class="pln"> encoding</span><span class="pun">=</span><span class="str">"UTF-8"</span><span class="pln"> standalone</span><span class="pun">=</span><span class="str">"yes"</span><span class="pun">?&gt;</span><span class="pln">
</span><span class="tag">&lt;user&gt;</span><span class="pln">
</span><span class="tag">&lt;username&gt;</span><span class="pln">test3</span><span class="tag">&lt;/username&gt;</span><span class="pln">
</span><span class="tag">&lt;password&gt;</span><span class="pln">p4ssword</span><span class="tag">&lt;/password&gt;</span><span class="pln">
</span><span class="tag">&lt;/user&gt;</span></code></pre>
<pre class="prettyprint"><code class=" hljs xml"><span class="hljs-pi">&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">user</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">username</span>&gt;</span>test3<span class="hljs-tag">&lt;/<span class="hljs-title">username</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">password</span>&gt;</span>p4ssword<span class="hljs-tag">&lt;/<span class="hljs-title">password</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">user</span>&gt;</span></code></pre>
<p><strong>Payload Example 2 (available parameters):</strong></p>
<pre class="prettyprint prettyprinted"><code><span class="pun">&lt;?</span><span class="pln">xml version</span><span class="pun">=</span><span class="str">"1.0"</span><span class="pln"> encoding</span><span class="pun">=</span><span class="str">"UTF-8"</span><span class="pln"> standalone</span><span class="pun">=</span><span class="str">"yes"</span><span class="pun">?&gt;</span><span class="pln">
</span><span class="tag">&lt;user&gt;</span><span class="pln">
</span><span class="tag">&lt;username&gt;</span><span class="pln">testuser</span><span class="tag">&lt;/username&gt;</span><span class="pln">
</span><span class="tag">&lt;password&gt;</span><span class="pln">p4ssword</span><span class="tag">&lt;/password&gt;</span><span class="pln">
</span><span class="tag">&lt;name&gt;</span><span class="pln">Test User</span><span class="tag">&lt;/name&gt;</span><span class="pln">
</span><span class="tag">&lt;email&gt;</span><span class="pln">test@localhost.de</span><span class="tag">&lt;/email&gt;</span><span class="pln">
</span><span class="tag">&lt;properties&gt;</span><span class="pln">
</span><span class="tag">&lt;property</span><span class="pln"> </span><span class="atn">key</span><span class="pun">=</span><span class="atv">"keyname"</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">"value"</span><span class="tag">/&gt;</span><span class="pln">
</span><span class="tag">&lt;property</span><span class="pln"> </span><span class="atn">key</span><span class="pun">=</span><span class="atv">"anotherkey"</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">"value"</span><span class="tag">/&gt;</span><span class="pln">
</span><span class="tag">&lt;/properties&gt;</span><span class="pln">
</span><span class="tag">&lt;/user&gt;</span></code></pre>
<pre class="prettyprint"><code class=" hljs xml"><span class="hljs-pi">&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">user</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">username</span>&gt;</span>testuser<span class="hljs-tag">&lt;/<span class="hljs-title">username</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">password</span>&gt;</span>p4ssword<span class="hljs-tag">&lt;/<span class="hljs-title">password</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">name</span>&gt;</span>Test User<span class="hljs-tag">&lt;/<span class="hljs-title">name</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">email</span>&gt;</span>test@localhost.de<span class="hljs-tag">&lt;/<span class="hljs-title">email</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">properties</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">property</span> <span class="hljs-attribute">key</span>=<span class="hljs-value">"keyname"</span> <span class="hljs-attribute">value</span>=<span class="hljs-value">"value"</span>/&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">property</span> <span class="hljs-attribute">key</span>=<span class="hljs-value">"anotherkey"</span> <span class="hljs-attribute">value</span>=<span class="hljs-value">"value"</span>/&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">properties</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">user</span>&gt;</span></code></pre>
......@@ -1913,33 +1916,33 @@ If you want to create a resource with JSON data format, please add “<strong>Co
<pre class="prettyprint prettyprinted"><code><span class="pun">{</span><span class="pln">
</span><span class="str">"username"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"admin"</span><span class="pun">,</span><span class="pln">
</span><span class="str">"password"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"p4ssword"</span><span class="pln">
</span><span class="pun">}</span></code></pre>
<pre class="prettyprint"><code class=" hljs json">{
"<span class="hljs-attribute">username</span>": <span class="hljs-value"><span class="hljs-string">"admin"</span></span>,
"<span class="hljs-attribute">password</span>": <span class="hljs-value"><span class="hljs-string">"p4ssword"</span>
</span>}</code></pre>
<p><strong>Payload Example 2 (available parameters):</strong></p>
<pre class="prettyprint prettyprinted"><code><span class="pun">{</span><span class="pln">
</span><span class="str">"username"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"admin"</span><span class="pun">,</span><span class="pln">
</span><span class="str">"password"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"p4ssword"</span><span class="pun">,</span><span class="pln">
</span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"Administrator"</span><span class="pun">,</span><span class="pln">
</span><span class="str">"email"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"admin@example.com"</span><span class="pun">,</span><span class="pln">
</span><span class="str">"properties"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
</span><span class="str">"property"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="pln">
</span><span class="pun">{</span><span class="pln">
</span><span class="str">"@key"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"console.rows_per_page"</span><span class="pun">,</span><span class="pln">
</span><span class="str">"@value"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"user-summary=8"</span><span class="pln">
</span><span class="pun">},</span><span class="pln">
</span><span class="pun">{</span><span class="pln">
</span><span class="str">"@key"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"console.order"</span><span class="pun">,</span><span class="pln">
</span><span class="str">"@value"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"session-summary=1"</span><span class="pln">
</span><span class="pun">}</span><span class="pln">
</span><span class="pun">]</span><span class="pln">
</span><span class="pun">}</span><span class="pln">
</span><span class="pun">}</span></code></pre>
<pre class="prettyprint"><code class=" hljs json">{
"<span class="hljs-attribute">username</span>": <span class="hljs-value"><span class="hljs-string">"admin"</span></span>,
"<span class="hljs-attribute">password</span>": <span class="hljs-value"><span class="hljs-string">"p4ssword"</span></span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"Administrator"</span></span>,
"<span class="hljs-attribute">email</span>": <span class="hljs-value"><span class="hljs-string">"admin@example.com"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">property</span>": <span class="hljs-value">[
{
"<span class="hljs-attribute">@key</span>": <span class="hljs-value"><span class="hljs-string">"console.rows_per_page"</span></span>,
"<span class="hljs-attribute">@value</span>": <span class="hljs-value"><span class="hljs-string">"user-summary=8"</span>
</span>},
{
"<span class="hljs-attribute">@key</span>": <span class="hljs-value"><span class="hljs-string">"console.order"</span></span>,
"<span class="hljs-attribute">@value</span>": <span class="hljs-value"><span class="hljs-string">"session-summary=1"</span>
</span>}
]
</span>}
</span>}</code></pre>
......@@ -1989,7 +1992,7 @@ If you want to create a resource with JSON data format, please add “<strong>Co
<h2 id="update-a-user">Update a user</h2>
<p>Endpoint to update / overwrite a user</p>
<p>Endpoint to update / rename a user</p>
<blockquote>
<p><strong>PUT</strong> /users/{username}</p>
......@@ -1998,8 +2001,6 @@ If you want to create a resource with JSON data format, please add “<strong>Co
<p><strong>Payload:</strong> User <br>
<strong>Return value:</strong> HTTP status 200 (OK)</p>
<h3 id="possible-parameters-3">Possible parameters</h3>
<table>
......@@ -2039,17 +2040,38 @@ If you want to create a resource with JSON data format, please add “<strong>Co
<pre class="prettyprint prettyprinted"><code><span class="pun">&lt;?</span><span class="pln">xml version</span><span class="pun">=</span><span class="str">"1.0"</span><span class="pln"> encoding</span><span class="pun">=</span><span class="str">"UTF-8"</span><span class="pln"> standalone</span><span class="pun">=</span><span class="str">"yes"</span><span class="pun">?&gt;</span><span class="pln">
</span><span class="tag">&lt;user&gt;</span><span class="pln">
</span><span class="tag">&lt;username&gt;</span><span class="pln">testuser</span><span class="tag">&lt;/username&gt;</span><span class="pln">
</span><span class="tag">&lt;name&gt;</span><span class="pln">Test User edit</span><span class="tag">&lt;/name&gt;</span><span class="pln">
</span><span class="tag">&lt;email&gt;</span><span class="pln">test@edit.de</span><span class="tag">&lt;/email&gt;</span><span class="pln">
</span><span class="tag">&lt;properties&gt;</span><span class="pln">
</span><span class="tag">&lt;property</span><span class="pln"> </span><span class="atn">key</span><span class="pun">=</span><span class="atv">"keyname"</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">"value"</span><span class="tag">/&gt;</span><span class="pln">
</span><span class="tag">&lt;/properties&gt;</span><span class="pln">
</span><span class="tag">&lt;/user&gt;</span></code></pre>
<pre class="prettyprint"><code class=" hljs xml"><span class="hljs-pi">&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">user</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">username</span>&gt;</span>testuser<span class="hljs-tag">&lt;/<span class="hljs-title">username</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">name</span>&gt;</span>Test User edit<span class="hljs-tag">&lt;/<span class="hljs-title">name</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">email</span>&gt;</span>test@edit.de<span class="hljs-tag">&lt;/<span class="hljs-title">email</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">properties</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">property</span> <span class="hljs-attribute">key</span>=<span class="hljs-value">"keyname"</span> <span class="hljs-attribute">value</span>=<span class="hljs-value">"value"</span>/&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">properties</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">user</span>&gt;</span></code></pre>
<h4 id="rename-example">Rename Example</h4>
<blockquote>
<p><strong>Header:</strong> Authorization: Basic YWRtaW46MTIzNDU= <br>
<strong>Header:</strong> Content-Type application/xml</p>
<p><strong>PUT</strong> <a href="http://example.org:9090/plugins/restapi/v1/users/oldUsername">http://example.org:9090/plugins/restapi/v1/users/oldUsername</a></p>
</blockquote>
<p><strong>Payload:</strong></p>
<pre class="prettyprint"><code class=" hljs xml"><span class="hljs-pi">&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">user</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">username</span>&gt;</span>newUsername<span class="hljs-tag">&lt;/<span class="hljs-title">username</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">name</span>&gt;</span>Test User edit<span class="hljs-tag">&lt;/<span class="hljs-title">name</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">email</span>&gt;</span>test@edit.de<span class="hljs-tag">&lt;/<span class="hljs-title">email</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">properties</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">property</span> <span class="hljs-attribute">key</span>=<span class="hljs-value">"keyname"</span> <span class="hljs-attribute">value</span>=<span class="hljs-value">"value"</span>/&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">properties</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">user</span>&gt;</span></code></pre>
<h4 id="json-example">JSON Example</h4>
......@@ -2064,17 +2086,17 @@ If you want to create a resource with JSON data format, please add “<strong>Co
<pre class="prettyprint prettyprinted"><code><span class="pun">{</span><span class="pln">
</span><span class="str">"username"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"testuser"</span><span class="pun">,</span><span class="pln">
</span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"Test User edit"</span><span class="pun">,</span><span class="pln">
</span><span class="str">"email"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"test@edit.de"</span><span class="pun">,</span><span class="pln">
</span><span class="str">"properties"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
</span><span class="str">"property"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
</span><span class="str">"@key"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"keyname"</span><span class="pun">,</span><span class="pln">
</span><span class="str">"@value"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"value"</span><span class="pln">
</span><span class="pun">}</span><span class="pln">
</span><span class="pun">}</span><span class="pln">
</span><span class="pun">}</span></code></pre>
<pre class="prettyprint"><code class=" hljs json">{
"<span class="hljs-attribute">username</span>": <span class="hljs-value"><span class="hljs-string">"testuser"</span></span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"Test User edit"</span></span>,
"<span class="hljs-attribute">email</span>": <span class="hljs-value"><span class="hljs-string">"test@edit.de"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">property</span>": <span class="hljs-value">{
"<span class="hljs-attribute">@key</span>": <span class="hljs-value"><span class="hljs-string">"keyname"</span></span>,
"<span class="hljs-attribute">@value</span>": <span class="hljs-value"><span class="hljs-string">"value"</span>
</span>}
</span>}
</span>}</code></pre>
......@@ -2171,11 +2193,11 @@ If you want to create a resource with JSON data format, please add “<strong>Co
<pre class="prettyprint prettyprinted"><code><span class="pun">&lt;?</span><span class="pln">xml version</span><span class="pun">=</span><span class="str">"1.0"</span><span class="pln"> encoding</span><span class="pun">=</span><span class="str">"UTF-8"</span><span class="pln"> standalone</span><span class="pun">=</span><span class="str">"yes"</span><span class="pun">?&gt;</span><span class="pln">
</span><span class="tag">&lt;groups&gt;</span><span class="pln">
</span><span class="tag">&lt;groupname&gt;</span><span class="pln">Admins</span><span class="tag">&lt;/groupname&gt;</span><span class="pln">
</span><span class="tag">&lt;groupname&gt;</span><span class="pln">Support</span><span class="tag">&lt;/groupname&gt;</span><span class="pln">
</span><span class="tag">&lt;/groups&gt;</span></code></pre>
<pre class="prettyprint"><code class=" hljs xml"><span class="hljs-pi">&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">groups</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">groupname</span>&gt;</span>Admins<span class="hljs-tag">&lt;/<span class="hljs-title">groupname</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">groupname</span>&gt;</span>Support<span class="hljs-tag">&lt;/<span class="hljs-title">groupname</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">groups</span>&gt;</span></code></pre>
......@@ -2227,11 +2249,11 @@ If you want to create a resource with JSON data format, please add “<strong>Co
<pre class="prettyprint prettyprinted"><code><span class="pun">&lt;?</span><span class="pln">xml version</span><span class="pun">=</span><span class="str">"1.0"</span><span class="pln"> encoding</span><span class="pun">=</span><span class="str">"UTF-8"</span><span class="pln"> standalone</span><span class="pun">=</span><span class="str">"yes"</span><span class="pun">?&gt;</span><span class="pln">
</span><span class="tag">&lt;groups&gt;</span><span class="pln">
</span><span class="tag">&lt;groupname&gt;</span><span class="pln">Admins</span><span class="tag">&lt;/groupname&gt;</span><span class="pln">
</span><span class="tag">&lt;groupname&gt;</span><span class="pln">Support</span><span class="tag">&lt;/groupname&gt;</span><span class="pln">
</span><span class="tag">&lt;/groups&gt;</span></code></pre>
<pre class="prettyprint"><code class=" hljs xml"><span class="hljs-pi">&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">groups</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">groupname</span>&gt;</span>Admins<span class="hljs-tag">&lt;/<span class="hljs-title">groupname</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">groupname</span>&gt;</span>Support<span class="hljs-tag">&lt;/<span class="hljs-title">groupname</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">groups</span>&gt;</span></code></pre>
......@@ -2419,24 +2441,24 @@ Payload Example 1 (required parameters):</p>
<pre class="prettyprint prettyprinted"><code><span class="pun">&lt;?</span><span class="pln">xml version</span><span class="pun">=</span><span class="str">"1.0"</span><span class="pln"> encoding</span><span class="pun">=</span><span class="str">"UTF-8"</span><span class="pln"> standalone</span><span class="pun">=</span><span class="str">"yes"</span><span class="pun">?&gt;</span><span class="pln">
</span><span class="tag">&lt;rosterItem&gt;</span><span class="pln">
</span><span class="tag">&lt;jid&gt;</span><span class="pln">peter@pan.de</span><span class="tag">&lt;/jid&gt;</span><span class="pln">
</span><span class="tag">&lt;/rosterItem&gt;</span></code></pre>
<pre class="prettyprint"><code class=" hljs xml"><span class="hljs-pi">&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">rosterItem</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">jid</span>&gt;</span>peter@pan.de<span class="hljs-tag">&lt;/<span class="hljs-title">jid</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">rosterItem</span>&gt;</span></code></pre>
<p>Payload Example 2 (available parameters):</p>
<pre class="prettyprint prettyprinted"><code><span class="pun">&lt;?</span><span class="pln">xml version</span><span class="pun">=</span><span class="str">"1.0"</span><span class="pln"> encoding</span><span class="pun">=</span><span class="str">"UTF-8"</span><span class="pln"> standalone</span><span class="pun">=</span><span class="str">"yes"</span><span class="pun">?&gt;</span><span class="pln">
</span><span class="tag">&lt;rosterItem&gt;</span><span class="pln">
</span><span class="tag">&lt;jid&gt;</span><span class="pln">peter@pan1.de</span><span class="tag">&lt;/jid&gt;</span><span class="pln">
</span><span class="tag">&lt;nickname&gt;</span><span class="pln">Peter1</span><span class="tag">&lt;/nickname&gt;</span><span class="pln">
</span><span class="tag">&lt;subscriptionType&gt;</span><span class="pln">3</span><span class="tag">&lt;/subscriptionType&gt;</span><span class="pln">
</span><span class="tag">&lt;groups&gt;</span><span class="pln">
</span><span class="tag">&lt;group&gt;</span><span class="pln">Friends</span><span class="tag">&lt;/group&gt;</span><span class="pln">
</span><span class="tag">&lt;/groups&gt;</span><span class="pln">
</span><span class="tag">&lt;/rosterItem&gt;</span></code></pre>
<pre class="prettyprint"><code class=" hljs xml"><span class="hljs-pi">&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">rosterItem</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">jid</span>&gt;</span>peter@pan1.de<span class="hljs-tag">&lt;/<span class="hljs-title">jid</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">nickname</span>&gt;</span>Peter1<span class="hljs-tag">&lt;/<span class="hljs-title">nickname</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">subscriptionType</span>&gt;</span>3<span class="hljs-tag">&lt;/<span class="hljs-title">subscriptionType</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">groups</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">group</span>&gt;</span>Friends<span class="hljs-tag">&lt;/<span class="hljs-title">group</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">groups</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">rosterItem</span>&gt;</span></code></pre>
......@@ -2545,15 +2567,15 @@ Payload Example 1 (required parameters):</p>
<pre class="prettyprint prettyprinted"><code><span class="pun">&lt;?</span><span class="pln">xml version</span><span class="pun">=</span><span class="str">"1.0"</span><span class="pln"> encoding</span><span class="pun">=</span><span class="str">"UTF-8"</span><span class="pln"> standalone</span><span class="pun">=</span><span class="str">"yes"</span><span class="pun">?&gt;</span><span class="pln">
</span><span class="tag">&lt;rosterItem&gt;</span><span class="pln">
</span><span class="tag">&lt;jid&gt;</span><span class="pln">peter@pan.de</span><span class="tag">&lt;/jid&gt;</span><span class="pln">
</span><span class="tag">&lt;nickname&gt;</span><span class="pln">Peter Pan</span><span class="tag">&lt;/nickname&gt;</span><span class="pln">
</span><span class="tag">&lt;subscriptionType&gt;</span><span class="pln">0</span><span class="tag">&lt;/subscriptionType&gt;</span><span class="pln">
</span><span class="tag">&lt;groups&gt;</span><span class="pln">
</span><span class="tag">&lt;group&gt;</span><span class="pln">Support</span><span class="tag">&lt;/group&gt;</span><span class="pln">
</span><span class="tag">&lt;/groups&gt;</span><span class="pln">
</span><span class="tag">&lt;/rosterItem&gt;</span></code></pre>
<pre class="prettyprint"><code class=" hljs xml"><span class="hljs-pi">&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">rosterItem</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">jid</span>&gt;</span>peter@pan.de<span class="hljs-tag">&lt;/<span class="hljs-title">jid</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">nickname</span>&gt;</span>Peter Pan<span class="hljs-tag">&lt;/<span class="hljs-title">nickname</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">subscriptionType</span>&gt;</span>0<span class="hljs-tag">&lt;/<span class="hljs-title">subscriptionType</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">groups</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">group</span>&gt;</span>Support<span class="hljs-tag">&lt;/<span class="hljs-title">group</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">groups</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">rosterItem</span>&gt;</span></code></pre>
......@@ -2772,55 +2794,54 @@ Payload Example 1 (required parameters):</p>
<pre class="prettyprint prettyprinted"><code><span class="tag">&lt;chatRoom&gt;</span><span class="pln">
</span><span class="tag">&lt;naturalName&gt;</span><span class="pln">global-1</span><span class="tag">&lt;/naturalName&gt;</span><span class="pln">
</span><span class="tag">&lt;roomName&gt;</span><span class="pln">global</span><span class="tag">&lt;/roomName&gt;</span><span class="pln">
</span><span class="tag">&lt;description&gt;</span><span class="pln">Global Chat Room</span><span class="tag">&lt;/description&gt;</span><span class="pln">
</span><span class="tag">&lt;/chatRoom&gt;</span></code></pre>
<pre class="prettyprint"><code class=" hljs xml"><span class="hljs-tag">&lt;<span class="hljs-title">chatRoom</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">naturalName</span>&gt;</span>global-1<span class="hljs-tag">&lt;/<span class="hljs-title">naturalName</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">roomName</span>&gt;</span>global<span class="hljs-tag">&lt;/<span class="hljs-title">roomName</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">description</span>&gt;</span>Global Chat Room<span class="hljs-tag">&lt;/<span class="hljs-title">description</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">chatRoom</span>&gt;</span></code></pre>
<p><strong>Payload Example 2 (available parameters):</strong></p>
<pre class="prettyprint prettyprinted"><code><span class="tag">&lt;chatRoom&gt;</span><span class="pln">
</span><span class="tag">&lt;roomName&gt;</span><span class="pln">global</span><span class="tag">&lt;/roomName&gt;</span><span class="pln">
</span><span class="tag">&lt;naturalName&gt;</span><span class="pln">global-2</span><span class="tag">&lt;/naturalName&gt;</span><span class="pln">
</span><span class="tag">&lt;description&gt;</span><span class="pln">Global Chat Room</span><span class="tag">&lt;/description&gt;</span><span class="pln">
</span><span class="tag">&lt;creationDate&gt;</span><span class="pln">2014-02-12T15:52:37.592+01:00</span><span class="tag">&lt;/creationDate&gt;</span><span class="pln">
</span><span class="tag">&lt;modificationDate&gt;</span><span class="pln">2014-09-12T15:35:54.702+02:00</span><span class="tag">&lt;/modificationDate&gt;</span><span class="pln">
</span><span class="tag">&lt;maxUsers&gt;</span><span class="pln">0</span><span class="tag">&lt;/maxUsers&gt;</span><span class="pln">
</span><span class="tag">&lt;persistent&gt;</span><span class="pln">true</span><span class="tag">&lt;/persistent&gt;</span><span class="pln">
</span><span class="tag">&lt;publicRoom&gt;</span><span class="pln">true</span><span class="tag">&lt;/publicRoom&gt;</span><span class="pln">
</span><span class="tag">&lt;registrationEnabled&gt;</span><span class="pln">false</span><span class="tag">&lt;/registrationEnabled&gt;</span><span class="pln">
</span><span class="tag">&lt;canAnyoneDiscoverJID&gt;</span><span class="pln">false</span><span class="tag">&lt;/canAnyoneDiscoverJID&gt;</span><span class="pln">
</span><span class="tag">&lt;canOccupantsChangeSubject&gt;</span><span class="pln">false</span><span class="tag">&lt;/canOccupantsChangeSubject&gt;</span><span class="pln">
</span><span class="tag">&lt;canOccupantsInvite&gt;</span><span class="pln">false</span><span class="tag">&lt;/canOccupantsInvite&gt;</span><span class="pln">
</span><span class="tag">&lt;canChangeNickname&gt;</span><span class="pln">false</span><span class="tag">&lt;/canChangeNickname&gt;</span><span class="pln">
</span><span class="tag">&lt;logEnabled&gt;</span><span class="pln">true</span><span class="tag">&lt;/logEnabled&gt;</span><span class="pln">
</span><span class="tag">&lt;loginRestrictedToNickname&gt;</span><span class="pln">false</span><span class="tag">&lt;/loginRestrictedToNickname&gt;</span><span class="pln">
</span><span class="tag">&lt;membersOnly&gt;</span><span class="pln">false</span><span class="tag">&lt;/membersOnly&gt;</span><span class="pln">
</span><span class="tag">&lt;moderated&gt;</span><span class="pln">false</span><span class="tag">&lt;/moderated&gt;</span><span class="pln">
</span><span class="tag">&lt;broadcastPresenceRoles&gt;</span><span class="pln">
</span><span class="tag">&lt;broadcastPresenceRole&gt;</span><span class="pln">moderator</span><span class="tag">&lt;/broadcastPresenceRole&gt;</span><span class="pln">
</span><span class="tag">&lt;broadcastPresenceRole&gt;</span><span class="pln">participant</span><span class="tag">&lt;/broadcastPresenceRole&gt;</span><span class="pln">
</span><span class="tag">&lt;broadcastPresenceRole&gt;</span><span class="pln">visitor</span><span class="tag">&lt;/broadcastPresenceRole&gt;</span><span class="pln">
</span><span class="tag">&lt;/broadcastPresenceRoles&gt;</span><span class="pln">
</span><span class="tag">&lt;owners&gt;</span><span class="pln">
</span><span class="tag">&lt;owner&gt;</span><span class="pln">owner@localhost</span><span class="tag">&lt;/owner&gt;</span><span class="pln">
</span><span class="tag">&lt;/owners&gt;</span><span class="pln">
</span><span class="tag">&lt;admins&gt;</span><span class="pln">
</span><span class="tag">&lt;admin&gt;</span><span class="pln">admin@localhost</span><span class="tag">&lt;/admin&gt;</span><span class="pln">
</span><span class="tag">&lt;/admins&gt;</span><span class="pln">
</span><span class="tag">&lt;members&gt;</span><span class="pln">
</span><span class="tag">&lt;member&gt;</span><span class="pln">member2@localhost</span><span class="tag">&lt;/member&gt;</span><span class="pln">
</span><span class="tag">&lt;member&gt;</span><span class="pln">member1@localhost</span><span class="tag">&lt;/member&gt;</span><span class="pln">
</span><span class="tag">&lt;/members&gt;</span><span class="pln">
</span><span class="tag">&lt;outcasts&gt;</span><span class="pln">
</span><span class="tag">&lt;outcast&gt;</span><span class="pln">outcast1@localhost</span><span class="tag">&lt;/outcast&gt;</span><span class="pln">
</span><span class="tag">&lt;/outcasts&gt;</span><span class="pln">
</span><span class="tag">&lt;/chatRoom&gt;</span></code></pre>
<pre class="prettyprint"><code class=" hljs xml"><span class="hljs-tag">&lt;<span class="hljs-title">chatRoom</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">roomName</span>&gt;</span>global<span class="hljs-tag">&lt;/<span class="hljs-title">roomName</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">naturalName</span>&gt;</span>global-2<span class="hljs-tag">&lt;/<span class="hljs-title">naturalName</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">description</span>&gt;</span>Global Chat Room<span class="hljs-tag">&lt;/<span class="hljs-title">description</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">subject</span>&gt;</span>global-2 Subject<span class="hljs-tag">&lt;/<span class="hljs-title">subject</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">creationDate</span>&gt;</span>2014-02-12T15:52:37.592+01:00<span class="hljs-tag">&lt;/<span class="hljs-title">creationDate</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">modificationDate</span>&gt;</span>2014-09-12T15:35:54.702+02:00<span class="hljs-tag">&lt;/<span class="hljs-title">modificationDate</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">maxUsers</span>&gt;</span>0<span class="hljs-tag">&lt;/<span class="hljs-title">maxUsers</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">persistent</span>&gt;</span>true<span class="hljs-tag">&lt;/<span class="hljs-title">persistent</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">publicRoom</span>&gt;</span>true<span class="hljs-tag">&lt;/<span class="hljs-title">publicRoom</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">registrationEnabled</span>&gt;</span>false<span class="hljs-tag">&lt;/<span class="hljs-title">registrationEnabled</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">canAnyoneDiscoverJID</span>&gt;</span>false<span class="hljs-tag">&lt;/<span class="hljs-title">canAnyoneDiscoverJID</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">canOccupantsChangeSubject</span>&gt;</span>false<span class="hljs-tag">&lt;/<span class="hljs-title">canOccupantsChangeSubject</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">canOccupantsInvite</span>&gt;</span>false<span class="hljs-tag">&lt;/<span class="hljs-title">canOccupantsInvite</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">canChangeNickname</span>&gt;</span>false<span class="hljs-tag">&lt;/<span class="hljs-title">canChangeNickname</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">logEnabled</span>&gt;</span>true<span class="hljs-tag">&lt;/<span class="hljs-title">logEnabled</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">loginRestrictedToNickname</span>&gt;</span>false<span class="hljs-tag">&lt;/<span class="hljs-title">loginRestrictedToNickname</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">membersOnly</span>&gt;</span>false<span class="hljs-tag">&lt;/<span class="hljs-title">membersOnly</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">moderated</span>&gt;</span>false<span class="hljs-tag">&lt;/<span class="hljs-title">moderated</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">broadcastPresenceRoles</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">broadcastPresenceRole</span>&gt;</span>moderator<span class="hljs-tag">&lt;/<span class="hljs-title">broadcastPresenceRole</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">broadcastPresenceRole</span>&gt;</span>participant<span class="hljs-tag">&lt;/<span class="hljs-title">broadcastPresenceRole</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">broadcastPresenceRole</span>&gt;</span>visitor<span class="hljs-tag">&lt;/<span class="hljs-title">broadcastPresenceRole</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">broadcastPresenceRoles</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">owners</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">owner</span>&gt;</span>owner@localhost<span class="hljs-tag">&lt;/<span class="hljs-title">owner</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">owners</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">admins</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">admin</span>&gt;</span>admin@localhost<span class="hljs-tag">&lt;/<span class="hljs-title">admin</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">admins</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">members</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">member</span>&gt;</span>member2@localhost<span class="hljs-tag">&lt;/<span class="hljs-title">member</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">member</span>&gt;</span>member1@localhost<span class="hljs-tag">&lt;/<span class="hljs-title">member</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">members</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">outcasts</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">outcast</span>&gt;</span>outcast1@localhost<span class="hljs-tag">&lt;/<span class="hljs-title">outcast</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">outcasts</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">chatRoom</span>&gt;</span></code></pre>
<h3 id="json-examples-1">JSON Examples</h3>
......@@ -2835,66 +2856,65 @@ Payload Example 1 (required parameters):</p>
<pre class="prettyprint prettyprinted"><code><span class="pun">{</span><span class="pln">
</span><span class="str">"roomName"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"global"</span><span class="pun">,</span><span class="pln">
</span><span class="str">"naturalName"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"global-2"</span><span class="pun">,</span><span class="pln">
</span><span class="str">"description"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"Global chat room"</span><span class="pln">
</span><span class="pun">}</span></code></pre>
<pre class="prettyprint"><code class=" hljs json">{
"<span class="hljs-attribute">roomName</span>": <span class="hljs-value"><span class="hljs-string">"global"</span></span>,
"<span class="hljs-attribute">naturalName</span>": <span class="hljs-value"><span class="hljs-string">"global-2"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Global chat room"</span>
</span>}</code></pre>
<p><strong>Payload Example 2 (available parameters):</strong></p>
<pre class="prettyprint prettyprinted"><code><span class="str">```
{
"roomName": "global-1",
"naturalName": "global-1_test_hello",
"description": "Global chat room",
"creationDate": "2012-10-18T16:55:12.803+02:00",
"modificationDate": "2014-07-10T09:49:12.411+02:00",
"maxUsers": "0",
"persistent": "true",
"publicRoom": "true",
"registrationEnabled": "false",
"canAnyoneDiscoverJID": "true",
"canOccupantsChangeSubject": "false",
"canOccupantsInvite": "false",
"canChangeNickname": "false",
"logEnabled": "true",
"loginRestrictedToNickname": "true",
"membersOnly": "false",
"moderated": "false",
"broadcastPresenceRoles": {
"broadcastPresenceRole": [
"moderator",
"participant",
"visitor"
<pre class="prettyprint"><code class=" hljs autohotkey"><span class="hljs-escape">``</span><span class="hljs-escape">`
</span>{
<span class="hljs-string">"roomName"</span>: <span class="hljs-string">"global-1"</span>,
<span class="hljs-string">"naturalName"</span>: <span class="hljs-string">"global-1_test_hello"</span>,
<span class="hljs-string">"description"</span>: <span class="hljs-string">"Global chat room"</span>,
<span class="hljs-string">"subject"</span>: <span class="hljs-string">"Global chat room subject"</span>,
<span class="hljs-string">"creationDate"</span>: <span class="hljs-string">"2012-10-18T16:55:12.803+02:00"</span>,
<span class="hljs-string">"modificationDate"</span>: <span class="hljs-string">"2014-07-10T09:49:12.411+02:00"</span>,
<span class="hljs-string">"maxUsers"</span>: <span class="hljs-string">"0"</span>,
<span class="hljs-string">"persistent"</span>: <span class="hljs-string">"true"</span>,
<span class="hljs-string">"publicRoom"</span>: <span class="hljs-string">"true"</span>,
<span class="hljs-string">"registrationEnabled"</span>: <span class="hljs-string">"false"</span>,
<span class="hljs-string">"canAnyoneDiscoverJID"</span>: <span class="hljs-string">"true"</span>,
<span class="hljs-string">"canOccupantsChangeSubject"</span>: <span class="hljs-string">"false"</span>,
<span class="hljs-string">"canOccupantsInvite"</span>: <span class="hljs-string">"false"</span>,
<span class="hljs-string">"canChangeNickname"</span>: <span class="hljs-string">"false"</span>,
<span class="hljs-string">"logEnabled"</span>: <span class="hljs-string">"true"</span>,
<span class="hljs-string">"loginRestrictedToNickname"</span>: <span class="hljs-string">"true"</span>,
<span class="hljs-string">"membersOnly"</span>: <span class="hljs-string">"false"</span>,
<span class="hljs-string">"moderated"</span>: <span class="hljs-string">"false"</span>,
<span class="hljs-string">"broadcastPresenceRoles"</span>: {
<span class="hljs-string">"broadcastPresenceRole"</span>: [
<span class="hljs-string">"moderator"</span>,
<span class="hljs-string">"participant"</span>,
<span class="hljs-string">"visitor"</span>
]
},
"owners": {
"owner": "owner@localhost"
<span class="hljs-string">"owners"</span>: {
<span class="hljs-string">"owner"</span>: <span class="hljs-string">"owner@localhost"</span>
},
"admins": {
"admin": [
"admin@localhost",
"admin2@localhost"
<span class="hljs-string">"admins"</span>: {
<span class="hljs-string">"admin"</span>: [
<span class="hljs-string">"admin@localhost"</span>,
<span class="hljs-string">"admin2@localhost"</span>
]
},
"members": {
"member": [
"member@localhost",
"member2@localhost"
<span class="hljs-string">"members"</span>: {
<span class="hljs-string">"member"</span>: [
<span class="hljs-string">"member@localhost"</span>,
<span class="hljs-string">"member2@localhost"</span>
]
},
"outcasts": {
"outcast": [
"outcast@localhost",
"outcast2@localhost"
<span class="hljs-string">"outcasts"</span>: {
<span class="hljs-string">"outcast"</span>: [
<span class="hljs-string">"outcast@localhost"</span>,
<span class="hljs-string">"outcast2@localhost"</span>
]
}
}</span></code></pre>
}</code></pre>
<h2 id="delete-a-chat-room">Delete a chat room</h2>
......@@ -3002,42 +3022,41 @@ Payload Example 1 (required parameters):</p>
<pre class="prettyprint prettyprinted"><code><span class="tag">&lt;chatRoom&gt;</span><span class="pln">
</span><span class="tag">&lt;roomName&gt;</span><span class="pln">global</span><span class="tag">&lt;/roomName&gt;</span><span class="pln">
</span><span class="tag">&lt;naturalName&gt;</span><span class="pln">global-2</span><span class="tag">&lt;/naturalName&gt;</span><span class="pln">
</span><span class="tag">&lt;description&gt;</span><span class="pln">Global Chat Room edit</span><span class="tag">&lt;/description&gt;</span><span class="pln">
</span><span class="tag">&lt;password&gt;</span><span class="pln">test</span><span class="tag">&lt;/password&gt;</span><span class="pln">
</span><span class="tag">&lt;creationDate&gt;</span><span class="pln">2014-02-12T15:52:37.592+01:00</span><span class="tag">&lt;/creationDate&gt;</span><span class="pln">
</span><span class="tag">&lt;modificationDate&gt;</span><span class="pln">2014-09-12T14:20:56.286+02:00</span><span class="tag">&lt;/modificationDate&gt;</span><span class="pln">
</span><span class="tag">&lt;maxUsers&gt;</span><span class="pln">0</span><span class="tag">&lt;/maxUsers&gt;</span><span class="pln">
</span><span class="tag">&lt;persistent&gt;</span><span class="pln">true</span><span class="tag">&lt;/persistent&gt;</span><span class="pln">
</span><span class="tag">&lt;publicRoom&gt;</span><span class="pln">true</span><span class="tag">&lt;/publicRoom&gt;</span><span class="pln">
</span><span class="tag">&lt;registrationEnabled&gt;</span><span class="pln">false</span><span class="tag">&lt;/registrationEnabled&gt;</span><span class="pln">
</span><span class="tag">&lt;canAnyoneDiscoverJID&gt;</span><span class="pln">false</span><span class="tag">&lt;/canAnyoneDiscoverJID&gt;</span><span class="pln">
</span><span class="tag">&lt;canOccupantsChangeSubject&gt;</span><span class="pln">false</span><span class="tag">&lt;/canOccupantsChangeSubject&gt;</span><span class="pln">
</span><span class="tag">&lt;canOccupantsInvite&gt;</span><span class="pln">false</span><span class="tag">&lt;/canOccupantsInvite&gt;</span><span class="pln">
</span><span class="tag">&lt;canChangeNickname&gt;</span><span class="pln">false</span><span class="tag">&lt;/canChangeNickname&gt;</span><span class="pln">
</span><span class="tag">&lt;logEnabled&gt;</span><span class="pln">true</span><span class="tag">&lt;/logEnabled&gt;</span><span class="pln">
</span><span class="tag">&lt;loginRestrictedToNickname&gt;</span><span class="pln">false</span><span class="tag">&lt;/loginRestrictedToNickname&gt;</span><span class="pln">
</span><span class="tag">&lt;membersOnly&gt;</span><span class="pln">false</span><span class="tag">&lt;/membersOnly&gt;</span><span class="pln">
</span><span class="tag">&lt;moderated&gt;</span><span class="pln">false</span><span class="tag">&lt;/moderated&gt;</span><span class="pln">
</span><span class="tag">&lt;broadcastPresenceRoles/&gt;</span><span class="pln">
</span><span class="tag">&lt;owners&gt;</span><span class="pln">
</span><span class="tag">&lt;owner&gt;</span><span class="pln">owner@localhost</span><span class="tag">&lt;/owner&gt;</span><span class="pln">
</span><span class="tag">&lt;/owners&gt;</span><span class="pln">
</span><span class="tag">&lt;admins&gt;</span><span class="pln">
</span><span class="tag">&lt;admin&gt;</span><span class="pln">admin@localhost</span><span class="tag">&lt;/admin&gt;</span><span class="pln">
</span><span class="tag">&lt;/admins&gt;</span><span class="pln">
</span><span class="tag">&lt;members&gt;</span><span class="pln">
</span><span class="tag">&lt;member&gt;</span><span class="pln">member2@localhost</span><span class="tag">&lt;/member&gt;</span><span class="pln">
</span><span class="tag">&lt;member&gt;</span><span class="pln">member1@localhost</span><span class="tag">&lt;/member&gt;</span><span class="pln">
</span><span class="tag">&lt;/members&gt;</span><span class="pln">
</span><span class="tag">&lt;outcasts&gt;</span><span class="pln">
</span><span class="tag">&lt;outcast&gt;</span><span class="pln">outcast1@localhost</span><span class="tag">&lt;/outcast&gt;</span><span class="pln">
</span><span class="tag">&lt;/outcasts&gt;</span><span class="pln">
</span><span class="tag">&lt;/chatRoom&gt;</span></code></pre>
<pre class="prettyprint"><code class=" hljs xml"><span class="hljs-tag">&lt;<span class="hljs-title">chatRoom</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">roomName</span>&gt;</span>global<span class="hljs-tag">&lt;/<span class="hljs-title">roomName</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">naturalName</span>&gt;</span>global-2<span class="hljs-tag">&lt;/<span class="hljs-title">naturalName</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">description</span>&gt;</span>Global Chat Room edit<span class="hljs-tag">&lt;/<span class="hljs-title">description</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">subject</span>&gt;</span>New subject<span class="hljs-tag">&lt;/<span class="hljs-title">subject</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">password</span>&gt;</span>test<span class="hljs-tag">&lt;/<span class="hljs-title">password</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">creationDate</span>&gt;</span>2014-02-12T15:52:37.592+01:00<span class="hljs-tag">&lt;/<span class="hljs-title">creationDate</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">modificationDate</span>&gt;</span>2014-09-12T14:20:56.286+02:00<span class="hljs-tag">&lt;/<span class="hljs-title">modificationDate</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">maxUsers</span>&gt;</span>0<span class="hljs-tag">&lt;/<span class="hljs-title">maxUsers</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">persistent</span>&gt;</span>true<span class="hljs-tag">&lt;/<span class="hljs-title">persistent</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">publicRoom</span>&gt;</span>true<span class="hljs-tag">&lt;/<span class="hljs-title">publicRoom</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">registrationEnabled</span>&gt;</span>false<span class="hljs-tag">&lt;/<span class="hljs-title">registrationEnabled</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">canAnyoneDiscoverJID</span>&gt;</span>false<span class="hljs-tag">&lt;/<span class="hljs-title">canAnyoneDiscoverJID</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">canOccupantsChangeSubject</span>&gt;</span>false<span class="hljs-tag">&lt;/<span class="hljs-title">canOccupantsChangeSubject</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">canOccupantsInvite</span>&gt;</span>false<span class="hljs-tag">&lt;/<span class="hljs-title">canOccupantsInvite</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">canChangeNickname</span>&gt;</span>false<span class="hljs-tag">&lt;/<span class="hljs-title">canChangeNickname</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">logEnabled</span>&gt;</span>true<span class="hljs-tag">&lt;/<span class="hljs-title">logEnabled</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">loginRestrictedToNickname</span>&gt;</span>false<span class="hljs-tag">&lt;/<span class="hljs-title">loginRestrictedToNickname</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">membersOnly</span>&gt;</span>false<span class="hljs-tag">&lt;/<span class="hljs-title">membersOnly</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">moderated</span>&gt;</span>false<span class="hljs-tag">&lt;/<span class="hljs-title">moderated</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">broadcastPresenceRoles</span>/&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">owners</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">owner</span>&gt;</span>owner@localhost<span class="hljs-tag">&lt;/<span class="hljs-title">owner</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">owners</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">admins</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">admin</span>&gt;</span>admin@localhost<span class="hljs-tag">&lt;/<span class="hljs-title">admin</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">admins</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">members</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">member</span>&gt;</span>member2@localhost<span class="hljs-tag">&lt;/<span class="hljs-title">member</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">member</span>&gt;</span>member1@localhost<span class="hljs-tag">&lt;/<span class="hljs-title">member</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">members</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">outcasts</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">outcast</span>&gt;</span>outcast1@localhost<span class="hljs-tag">&lt;/<span class="hljs-title">outcast</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">outcasts</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">chatRoom</span>&gt;</span></code></pre>
<h2 id="add-user-with-role-to-chat-room">Add user with role to chat room</h2>
......@@ -3270,8 +3289,8 @@ DELETE /chatrooms/{roomName}/{roles}/{name}</p>
<pre class="prettyprint prettyprinted"><code><span class="pun">&lt;?</span><span class="pln">xml version</span><span class="pun">=</span><span class="str">"1.0"</span><span class="pln"> encoding</span><span class="pun">=</span><span class="str">"UTF-8"</span><span class="pln"> standalone</span><span class="pun">=</span><span class="str">"yes"</span><span class="pun">?&gt;</span><span class="pln">
</span><span class="tag">&lt;property</span><span class="pln"> </span><span class="atn">key</span><span class="pun">=</span><span class="atv">"propertyName"</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">"propertyValue"</span><span class="tag">/&gt;</span></code></pre>
<pre class="prettyprint"><code class=" hljs xml"><span class="hljs-pi">&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">property</span> <span class="hljs-attribute">key</span>=<span class="hljs-value">"propertyName"</span> <span class="hljs-attribute">value</span>=<span class="hljs-value">"propertyValue"</span>/&gt;</span></code></pre>
......@@ -3368,8 +3387,8 @@ DELETE /chatrooms/{roomName}/{roles}/{name}</p>
<pre class="prettyprint prettyprinted"><code><span class="pun">&lt;?</span><span class="pln">xml version</span><span class="pun">=</span><span class="str">"1.0"</span><span class="pln"> encoding</span><span class="pun">=</span><span class="str">"UTF-8"</span><span class="pln"> standalone</span><span class="pun">=</span><span class="str">"yes"</span><span class="pun">?&gt;</span><span class="pln">
</span><span class="tag">&lt;property</span><span class="pln"> </span><span class="atn">key</span><span class="pun">=</span><span class="atv">"propertyName"</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">"anotherValue"</span><span class="tag">/&gt;</span></code></pre>
<pre class="prettyprint"><code class=" hljs xml"><span class="hljs-pi">&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">property</span> <span class="hljs-attribute">key</span>=<span class="hljs-value">"propertyName"</span> <span class="hljs-attribute">value</span>=<span class="hljs-value">"anotherValue"</span>/&gt;</span></code></pre>
......@@ -3508,10 +3527,10 @@ Which replies an XML group list formatted like this:</p>
<pre class="prettyprint prettyprinted"><code><span class="tag">&lt;result&gt;</span><span class="pln">
</span><span class="tag">&lt;groupname&gt;</span><span class="pln">group1</span><span class="tag">&lt;/groupname&gt;</span><span class="pln">
</span><span class="tag">&lt;groupname&gt;</span><span class="pln">group2</span><span class="tag">&lt;/groupname&gt;</span><span class="pln">
</span><span class="tag">&lt;/result&gt;</span></code></pre>
<pre class="prettyprint"><code class=" hljs xml"><span class="hljs-tag">&lt;<span class="hljs-title">result</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">groupname</span>&gt;</span>group1<span class="hljs-tag">&lt;/<span class="hljs-title">groupname</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">groupname</span>&gt;</span>group2<span class="hljs-tag">&lt;/<span class="hljs-title">groupname</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">result</span>&gt;</span></code></pre>
<p>The following example gets all groups for a specific user</p>
......@@ -3520,10 +3539,10 @@ Which replies an XML group list formatted like this:</p>
<pre class="prettyprint prettyprinted"><code><span class="tag">&lt;result&gt;</span><span class="pln">
</span><span class="tag">&lt;groupname&gt;</span><span class="pln">usergroup1</span><span class="tag">&lt;/groupname&gt;</span><span class="pln">
</span><span class="tag">&lt;groupname&gt;</span><span class="pln">usergroup2</span><span class="tag">&lt;/groupname&gt;</span><span class="pln">
</span><span class="tag">&lt;/result&gt;</span></code></pre>
<pre class="prettyprint"><code class=" hljs xml"><span class="hljs-tag">&lt;<span class="hljs-title">result</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">groupname</span>&gt;</span>usergroup1<span class="hljs-tag">&lt;/<span class="hljs-title">groupname</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">groupname</span>&gt;</span>usergroup2<span class="hljs-tag">&lt;/<span class="hljs-title">groupname</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">result</span>&gt;</span></code></pre>
<p>* When sending double characters (Chinese/Japanese/Korean etc) you should URLEncode the string as utf8. <br>
In Java this is done like this <br>
......@@ -3659,75 +3678,6 @@ If the strings are encoded incorrectly, double byte characters will look garbele
......
package org.jivesoftware.openfire.plugin.rest.controller;
import java.util.List;
import javax.ws.rs.core.Response;
import org.dom4j.Element;
import org.jivesoftware.openfire.SessionManager;
import org.jivesoftware.openfire.SharedGroupException;
import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.auth.AuthFactory;
import org.jivesoftware.openfire.group.Group;
import org.jivesoftware.openfire.group.GroupManager;
import org.jivesoftware.openfire.plugin.rest.exceptions.ExceptionType;
import org.jivesoftware.openfire.plugin.rest.exceptions.ServiceException;
import org.jivesoftware.openfire.roster.Roster;
import org.jivesoftware.openfire.roster.RosterItem;
import org.jivesoftware.openfire.session.ClientSession;
import org.jivesoftware.openfire.user.User;
import org.jivesoftware.openfire.user.UserAlreadyExistsException;
import org.jivesoftware.openfire.user.UserManager;
import org.jivesoftware.openfire.user.UserNotFoundException;
import org.jivesoftware.openfire.vcard.VCardManager;
import org.xmpp.packet.StreamError;
/**
* The Class JustMarriedController.
*/
public class JustMarriedController {
/**
* Change name.
*
* @param currentUserName
* the current user name
* @param newUserName
* the new user name
* @param deleteOldUser
* the delete old user
* @param newEmail
* the new email
* @param newRealName
* the new real name
* @return true, if successful
* @throws ServiceException
* the service exception
*/
public static boolean changeName(String currentUserName, String newUserName, boolean deleteOldUser,
String newEmail, String newRealName) throws ServiceException {
UserManager userManager = UserManager.getInstance();
try {
User currentUser = userManager.getUser(currentUserName);
// Old user found, create new one
String password = AuthFactory.getPassword(currentUserName);
String newName = (newRealName == null || newRealName.length() == 0) ? currentUser.getName() : newRealName;
String newMail = (newEmail == null || newEmail.length() == 0) ? currentUser.getEmail() : newEmail;
User newUser = userManager.createUser(newUserName, password, currentUser.getName(), newMail);
newUser.setName(newName);
newUser.setNameVisible(currentUser.isNameVisible());
newUser.setEmailVisible(currentUser.isEmailVisible());
newUser.setCreationDate(currentUser.getCreationDate());
copyRoster(currentUser, newUser, currentUserName);
copyProperties(currentUser, newUser);
copyToGroups(currentUserName, newUserName);
copyVCard(currentUserName, newUserName);
if (deleteOldUser) {
deleteUser(currentUser);
}
} catch (UserNotFoundException e) {
throw new ServiceException("Could not find user", currentUserName, ExceptionType.USER_NOT_FOUND_EXCEPTION,
Response.Status.NOT_FOUND, e);
} catch (UserAlreadyExistsException e) {
throw new ServiceException("Could not create new user", newUserName,
ExceptionType.USER_ALREADY_EXISTS_EXCEPTION, Response.Status.CONFLICT, e);
}
return true;
}
/**
* Copy v card.
*
* @param currentUserName
* the current user name
* @param newUserName
* the new user name
* @throws ServiceException
* the service exception
*/
private static void copyVCard(String currentUserName, String newUserName) throws ServiceException {
VCardManager vcardManager = VCardManager.getInstance();
Element vcard = vcardManager.getVCard(currentUserName);
if (vcard != null) {
try {
vcardManager.setVCard(newUserName, vcard);
} catch (Exception e) {
throw new ServiceException("Could not copy vcard to new user", newUserName,
ExceptionType.ILLEGAL_ARGUMENT_EXCEPTION, Response.Status.BAD_REQUEST, e);
}
}
}
/**
* Copy to groups.
*
* @param currentUser
* the current user
* @param newUser
* the new user
*/
private static void copyToGroups(String currentUser, String newUser) {
GroupManager groupManager = GroupManager.getInstance();
for (Group group : groupManager.getGroups()) {
if (group.isUser(currentUser)) {
group.getMembers().add(XMPPServer.getInstance().createJID(newUser, null));
}
}
}
/**
* Delete user.
*
* @param oldUser
* the old user
*/
private static void deleteUser(User oldUser) {
UserManager.getInstance().deleteUser(oldUser);
final StreamError error = new StreamError(StreamError.Condition.not_authorized);
for (ClientSession sess : SessionManager.getInstance().getSessions(oldUser.getUsername())) {
sess.deliverRawText(error.toXML());
sess.close();
}
}
/**
* Copy properties.
*
* @param currentUser
* the current user
* @param newUser
* the new user
*/
private static void copyProperties(User currentUser, User newUser) {
for (String key : currentUser.getProperties().keySet()) {
newUser.getProperties().put(key, User.getPropertyValue(currentUser.getUsername(), key));
}
}
/**
* Copy roster.
*
* @param currentUser
* the current user
* @param newUser
* the new user
* @param currentUserName
* the current user name
* @throws ServiceException
* the service exception
*/
private static void copyRoster(User currentUser, User newUser, String currentUserName) throws ServiceException {
Roster newRoster = newUser.getRoster();
Roster currentRoster = currentUser.getRoster();
for (RosterItem item : currentRoster.getRosterItems()) {
try {
List<String> groups = item.getGroups();
RosterItem justCreated = newRoster.createRosterItem(item.getJid(), item.getNickname(), groups, true,
true);
justCreated.setAskStatus(item.getAskStatus());
justCreated.setRecvStatus(item.getRecvStatus());
justCreated.setSubStatus(item.getSubStatus());
for (Group gr : item.getSharedGroups()) {
justCreated.addSharedGroup(gr);
}
for (Group gr : item.getInvisibleSharedGroups()) {
justCreated.addInvisibleSharedGroup(gr);
}
newRoster.updateRosterItem(justCreated);
addNewUserToOthersRoster(newUser, item, currentUserName);
} catch (UserAlreadyExistsException e) {
throw new ServiceException("Could not create roster item for user ", newUser.getUsername(),
ExceptionType.USER_ALREADY_EXISTS_EXCEPTION, Response.Status.CONFLICT, e);
} catch (SharedGroupException e) {
throw new ServiceException("Could not create roster item, because it is a contact from a shared group",
newUser.getUsername(), ExceptionType.USER_ALREADY_EXISTS_EXCEPTION,
Response.Status.BAD_REQUEST, e);
} catch (UserNotFoundException e) {
throw new ServiceException("Could not update roster item for user " + newUser.getUsername()
+ " because it was not properly created.", newUser.getUsername(),
ExceptionType.USER_NOT_FOUND_EXCEPTION, Response.Status.NOT_FOUND, e);
}
}
}
/**
* Adds the new user to others roster.
*
* @param newUser
* the new user
* @param otherItem
* the other item
* @param currentUser
* the current user
* @throws ServiceException
* the service exception
*/
private static void addNewUserToOthersRoster(User newUser, RosterItem otherItem, String currentUser)
throws ServiceException {
otherItem.getJid();
UserManager userManager = UserManager.getInstance();
// Is this user registered with our OF server?
String username = otherItem.getJid().getNode();
if (username != null && username.length() > 0 && userManager.isRegisteredUser(username)
&& XMPPServer.getInstance().isLocal(XMPPServer.getInstance().createJID(currentUser, null))) {
try {
User otherUser = userManager.getUser(username);
Roster otherRoster = otherUser.getRoster();
RosterItem oldUserOnOthersRoster = otherRoster.getRosterItem(XMPPServer.getInstance().createJID(
currentUser, null));
try {
if (!oldUserOnOthersRoster.isOnlyShared()) {
RosterItem justCreated = otherRoster.createRosterItem(
XMPPServer.getInstance().createJID(newUser.getUsername(), null),
oldUserOnOthersRoster.getNickname(), oldUserOnOthersRoster.getGroups(), true, true);
justCreated.setAskStatus(oldUserOnOthersRoster.getAskStatus());
justCreated.setRecvStatus(oldUserOnOthersRoster.getRecvStatus());
justCreated.setSubStatus(oldUserOnOthersRoster.getSubStatus());
otherRoster.updateRosterItem(justCreated);
}
} catch (UserAlreadyExistsException e) {
throw new ServiceException("Could not create roster item for user ", newUser.getUsername(),
ExceptionType.USER_ALREADY_EXISTS_EXCEPTION, Response.Status.CONFLICT, e);
} catch (SharedGroupException e) {
throw new ServiceException(
"Could not create roster item, because it is a contact from a shared group",
newUser.getUsername(), ExceptionType.USER_ALREADY_EXISTS_EXCEPTION,
Response.Status.BAD_REQUEST, e);
}
} catch (UserNotFoundException e) {
throw new ServiceException("Could not create roster item for user " + newUser.getUsername()
+ " because it is a contact from a shared group.", newUser.getUsername(),
ExceptionType.USER_NOT_FOUND_EXCEPTION, Response.Status.NOT_FOUND, e);
}
}
}
}
......@@ -22,6 +22,7 @@ import org.jivesoftware.openfire.muc.MUCRoom;
import org.jivesoftware.openfire.muc.NotAllowedException;
import org.jivesoftware.openfire.plugin.rest.utils.MUCRoomUtils;
import org.jivesoftware.openfire.plugin.rest.utils.UserUtils;
import org.jivesoftware.util.AlreadyExistsException;
import org.xmpp.packet.JID;
/**
......@@ -139,7 +140,10 @@ public class MUCRoomController {
ExceptionType.NOT_ALLOWED, Response.Status.FORBIDDEN, e);
} catch (ConflictException e) {
throw new ServiceException("Could not create the channel", mucRoomEntity.getRoomName(),
ExceptionType.NOT_ALLOWED, Response.Status.FORBIDDEN, e);
ExceptionType.NOT_ALLOWED, Response.Status.CONFLICT, e);
} catch (AlreadyExistsException e) {
throw new ServiceException("Could not create the channel", mucRoomEntity.getRoomName(),
ExceptionType.ALREADY_EXISTS, Response.Status.CONFLICT, e);
}
}
......@@ -170,7 +174,10 @@ public class MUCRoomController {
} catch (ForbiddenException e) {
throw new ServiceException("Could not update the channel", roomName, ExceptionType.NOT_ALLOWED, Response.Status.FORBIDDEN, e);
} catch (ConflictException e) {
throw new ServiceException("Could not update the channel", roomName, ExceptionType.NOT_ALLOWED, Response.Status.FORBIDDEN, e);
throw new ServiceException("Could not update the channel", roomName, ExceptionType.NOT_ALLOWED, Response.Status.CONFLICT, e);
} catch (AlreadyExistsException e) {
throw new ServiceException("Could not update the channel", mucRoomEntity.getRoomName(),
ExceptionType.ALREADY_EXISTS, Response.Status.CONFLICT, e);
}
}
......@@ -187,9 +194,10 @@ public class MUCRoomController {
* the forbidden exception
* @throws ConflictException
* the conflict exception
* @throws AlreadyExistsException
*/
private void createRoom(MUCRoomEntity mucRoomEntity, String serviceName) throws NotAllowedException,
ForbiddenException, ConflictException {
ForbiddenException, ConflictException, AlreadyExistsException {
// Set owner
JID owner = XMPPServer.getInstance().createJID("admin", null);
......@@ -201,6 +209,12 @@ public class MUCRoomController {
mucRoomEntity.setOwners(owners);
}
// Check if chat service is available, if not create a new one
boolean serviceRegistered = XMPPServer.getInstance().getMultiUserChatManager().isServiceRegistered(serviceName);
if(!serviceRegistered) {
XMPPServer.getInstance().getMultiUserChatManager().createMultiUserChatService(serviceName, serviceName, false);
}
MUCRoom room = XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatService(serviceName)
.getChatRoom(mucRoomEntity.getRoomName().toLowerCase(), owner);
......@@ -295,6 +309,7 @@ public class MUCRoomController {
MUCRoomEntity mucRoomEntity = new MUCRoomEntity(room.getNaturalLanguageName(), room.getName(),
room.getDescription());
mucRoomEntity.setSubject(room.getSubject());
mucRoomEntity.setCanAnyoneDiscoverJID(room.canAnyoneDiscoverJID());
mucRoomEntity.setCanChangeNickname(room.canChangeNickname());
mucRoomEntity.setCanOccupantsChangeSubject(room.canOccupantsChangeSubject());
......@@ -403,7 +418,7 @@ public class MUCRoomController {
} catch (ForbiddenException e) {
throw new ServiceException("Could not add admin", jid, ExceptionType.NOT_ALLOWED, Response.Status.FORBIDDEN, e);
} catch (ConflictException e) {
throw new ServiceException("Could not add admin", jid, ExceptionType.NOT_ALLOWED, Response.Status.FORBIDDEN, e);
throw new ServiceException("Could not add admin", jid, ExceptionType.NOT_ALLOWED, Response.Status.CONFLICT, e);
}
}
......@@ -475,7 +490,7 @@ public class MUCRoomController {
} catch (ForbiddenException e) {
throw new ServiceException("Could not add outcast", jid, ExceptionType.NOT_ALLOWED, Response.Status.FORBIDDEN, e);
} catch (ConflictException e) {
throw new ServiceException("Could not add outcast", jid, ExceptionType.NOT_ALLOWED, Response.Status.FORBIDDEN, e);
throw new ServiceException("Could not add outcast", jid, ExceptionType.NOT_ALLOWED, Response.Status.CONFLICT, e);
}
}
......@@ -499,7 +514,7 @@ public class MUCRoomController {
} catch (ForbiddenException e) {
throw new ServiceException("Could not delete affiliation", jid, ExceptionType.NOT_ALLOWED, Response.Status.FORBIDDEN, e);
} catch (ConflictException e) {
throw new ServiceException("Could not delete affiliation", jid, ExceptionType.NOT_ALLOWED, Response.Status.FORBIDDEN, e);
throw new ServiceException("Could not delete affiliation", jid, ExceptionType.NOT_ALLOWED, Response.Status.CONFLICT, e);
}
}
}
\ No newline at end of file
......@@ -8,6 +8,12 @@ import javax.ws.rs.core.Response;
import org.jivesoftware.openfire.SharedGroupException;
import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.group.Group;
import org.jivesoftware.openfire.group.GroupAlreadyExistsException;
import org.jivesoftware.openfire.group.GroupManager;
import org.jivesoftware.openfire.group.GroupNotFoundException;
import org.jivesoftware.openfire.lockout.LockOutManager;
import org.jivesoftware.openfire.plugin.rest.dao.PropertyDAO;
import org.jivesoftware.openfire.plugin.rest.entity.RosterEntities;
import org.jivesoftware.openfire.plugin.rest.entity.RosterItemEntity;
import org.jivesoftware.openfire.plugin.rest.entity.UserEntities;
......@@ -16,12 +22,7 @@ import org.jivesoftware.openfire.plugin.rest.entity.UserGroupsEntity;
import org.jivesoftware.openfire.plugin.rest.entity.UserProperty;
import org.jivesoftware.openfire.plugin.rest.exceptions.ExceptionType;
import org.jivesoftware.openfire.plugin.rest.exceptions.ServiceException;
import org.jivesoftware.openfire.group.Group;
import org.jivesoftware.openfire.group.GroupAlreadyExistsException;
import org.jivesoftware.openfire.group.GroupManager;
import org.jivesoftware.openfire.group.GroupNotFoundException;
import org.jivesoftware.openfire.lockout.LockOutManager;
import org.jivesoftware.openfire.plugin.rest.dao.PropertyDAO;
import org.jivesoftware.openfire.plugin.rest.utils.UserUtils;
import org.jivesoftware.openfire.roster.Roster;
import org.jivesoftware.openfire.roster.RosterItem;
import org.jivesoftware.openfire.roster.RosterManager;
......@@ -29,7 +30,6 @@ import org.jivesoftware.openfire.user.User;
import org.jivesoftware.openfire.user.UserAlreadyExistsException;
import org.jivesoftware.openfire.user.UserManager;
import org.jivesoftware.openfire.user.UserNotFoundException;
import org.jivesoftware.openfire.plugin.rest.utils.UserUtils;
import org.xmpp.packet.JID;
/**
......@@ -85,9 +85,9 @@ public class UserServiceController {
userEntity.getEmail());
} catch (UserAlreadyExistsException e) {
throw new ServiceException("Could not create new user", userEntity.getUsername(),
ExceptionType.USER_ALREADY_EXISTS_EXCEPTION, Response.Status.BAD_REQUEST);
ExceptionType.USER_ALREADY_EXISTS_EXCEPTION, Response.Status.CONFLICT);
}
addProperties(userEntity);
addProperties(userEntity.getUsername(), userEntity.getProperties());
}
}
......@@ -103,6 +103,16 @@ public class UserServiceController {
*/
public void updateUser(String username, UserEntity userEntity) throws ServiceException {
if (userEntity != null && !username.isEmpty()) {
// Payload contains another username than provided over path
// parameter
if (userEntity.getUsername() != null) {
if (!userEntity.getUsername().equals(username)) {
JustMarriedController.changeName(username, userEntity.getUsername(), true, userEntity.getEmail(),
userEntity.getName());
addProperties(userEntity.getUsername(), userEntity.getProperties());
return;
}
}
User user = getAndCheckUser(username);
if (userEntity.getPassword() != null) {
user.setPassword(userEntity.getPassword());
......@@ -114,7 +124,7 @@ public class UserServiceController {
user.setEmail(userEntity.getEmail());
}
addProperties(userEntity);
addProperties(username, userEntity.getProperties());
}
}
......@@ -143,8 +153,9 @@ public class UserServiceController {
* @return the user entities
* @throws ServiceException
*/
public UserEntities getUserEntities(String userSearch, String propertyKey, String propertyValue) throws ServiceException {
if(propertyKey != null) {
public UserEntities getUserEntities(String userSearch, String propertyKey, String propertyValue)
throws ServiceException {
if (propertyKey != null) {
return getUserEntitiesByProperty(propertyKey, propertyValue);
}
UserEntities userEntities = new UserEntities();
......@@ -339,9 +350,12 @@ public class UserServiceController {
/**
* Adds the user to group.
*
* @param username the username
* @param userGroupsEntity the user groups entity
* @throws ServiceException the service exception
* @param username
* the username
* @param userGroupsEntity
* the user groups entity
* @throws ServiceException
* the service exception
*/
public void addUserToGroups(String username, UserGroupsEntity userGroupsEntity) throws ServiceException {
if (userGroupsEntity != null) {
......@@ -420,11 +434,11 @@ public class UserServiceController {
* @throws ServiceException
* the service exception
*/
private void addProperties(UserEntity userEntity) throws ServiceException {
User user = getAndCheckUser(userEntity.getUsername());
private void addProperties(String username, List<UserProperty> properties) throws ServiceException {
User user = getAndCheckUser(username);
user.getProperties().clear();
if (userEntity.getProperties() != null) {
for (UserProperty property : userEntity.getProperties()) {
if (properties != null) {
for (UserProperty property : properties) {
user.getProperties().put(property.getKey(), property.getValue());
}
}
......@@ -433,9 +447,11 @@ public class UserServiceController {
/**
* Creates the group.
*
* @param groupName the group name
* @param groupName
* the group name
* @return the group
* @throws ServiceException the service exception
* @throws ServiceException
* the service exception
*/
private Group createGroup(String groupName) throws ServiceException {
Group group = null;
......
......@@ -31,6 +31,8 @@ public final class ExceptionType {
/** The Constant NOT_ALLOWED. */
public static final String NOT_ALLOWED = "NotAllowedException";
/** The Constant ALREADY_EXISTS. */
public static final String ALREADY_EXISTS = "AlreadyExistsException";
/**
* Instantiates a new exception type.
*/
......
......@@ -2,6 +2,8 @@ package org.jivesoftware.openfire.plugin.rest.service;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
......@@ -44,7 +46,11 @@ public class JerseyWrapper extends ServletContainer {
/** The prc. */
private static PackagesResourceConfig prc;
/** The Constant JERSEY_LOGGER. */
private final static Logger JERSEY_LOGGER = Logger.getLogger("com.sun.jersey");
static {
JERSEY_LOGGER.setLevel(Level.SEVERE);
config = new HashMap<String, Object>();
config.put(RESOURCE_CONFIG_CLASS_KEY, RESOURCE_CONFIG_CLASS);
prc = new PackagesResourceConfig(SCAN_PACKAGE_DEFAULT);
......
......@@ -50,7 +50,7 @@ public class UserRosterService {
Response.Status.NOT_FOUND, e);
} catch (UserAlreadyExistsException e) {
throw new ServiceException(COULD_NOT_CREATE_ROSTER_ITEM, "", ExceptionType.USER_ALREADY_EXISTS_EXCEPTION,
Response.Status.BAD_REQUEST, e);
Response.Status.CONFLICT, e);
} catch (SharedGroupException e) {
throw new ServiceException(COULD_NOT_CREATE_ROSTER_ITEM, "", ExceptionType.SHARED_GROUP_EXCEPTION,
Response.Status.BAD_REQUEST, e);
......@@ -85,7 +85,7 @@ public class UserRosterService {
Response.Status.BAD_REQUEST, e);
} catch (UserAlreadyExistsException e) {
throw new ServiceException(COULD_NOT_UPDATE_THE_ROSTER, rosterJid,
ExceptionType.USER_ALREADY_EXISTS_EXCEPTION, Response.Status.BAD_REQUEST, e);
ExceptionType.USER_ALREADY_EXISTS_EXCEPTION, Response.Status.CONFLICT, e);
}
return Response.status(Response.Status.OK).build();
}
......
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