Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Openfire
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Openfire
Commits
c6435b62
Commit
c6435b62
authored
Sep 16, 2015
by
Roman S
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated the REST API plugin to 1.1.6
Fixed: the problem with wrong media type by error
parent
ed012548
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
276 additions
and
52 deletions
+276
-52
changelog.html
src/plugins/restAPI/changelog.html
+6
-0
plugin.xml
src/plugins/restAPI/plugin.xml
+2
-2
readme.html
src/plugins/restAPI/readme.html
+193
-48
UserServiceController.java
...penfire/plugin/rest/controller/UserServiceController.java
+37
-0
RESTExceptionMapper.java
.../openfire/plugin/rest/exceptions/RESTExceptionMapper.java
+21
-1
GroupService.java
...vesoftware/openfire/plugin/rest/service/GroupService.java
+1
-1
UserGroupService.java
...ftware/openfire/plugin/rest/service/UserGroupService.java
+16
-0
No files found.
src/plugins/restAPI/changelog.html
View file @
c6435b62
...
@@ -44,6 +44,12 @@
...
@@ -44,6 +44,12 @@
REST API Plugin Changelog
REST API Plugin Changelog
</h1>
</h1>
<p><b>
1.1.6
</b>
-- September 24th, 2015
</p>
<ul>
<li>
Added: Endpoints to add / remove a user from a user group
</li>
<li>
Fixed: Error response in JSON format
</li>
</ul>
<p><b>
1.1.5
</b>
-- September 1st, 2015
</p>
<p><b>
1.1.5
</b>
-- September 1st, 2015
</p>
<ul>
<ul>
<li>
Added: Send broadcast message to all online users
</li>
<li>
Added: Send broadcast message to all online users
</li>
...
...
src/plugins/restAPI/plugin.xml
View file @
c6435b62
...
@@ -5,8 +5,8 @@
...
@@ -5,8 +5,8 @@
<name>
REST API
</name>
<name>
REST API
</name>
<description>
Allows administration over a RESTful API.
</description>
<description>
Allows administration over a RESTful API.
</description>
<author>
Roman Soldatow
</author>
<author>
Roman Soldatow
</author>
<version>
1.1.
5
</version>
<version>
1.1.
6
</version>
<date>
09/
01
/2015
</date>
<date>
09/
24
/2015
</date>
<minServerVersion>
3.9.0
</minServerVersion>
<minServerVersion>
3.9.0
</minServerVersion>
<adminconsole>
<adminconsole>
...
...
src/plugins/restAPI/readme.html
View file @
c6435b62
...
@@ -1292,73 +1292,83 @@ body.pdf{font-family:"DejaVu Sans"}body.pdf code,body.pdf pre{font-family:"DejaV
...
@@ -1292,73 +1292,83 @@ body.pdf{font-family:"DejaVu Sans"}body.pdf code,body.pdf pre{font-family:"DejaV
<li><a
href=
"#examples-5"
>
Examples
</a></li>
<li><a
href=
"#examples-5"
>
Examples
</a></li>
</ul>
</ul>
</li>
</li>
<li><a
href=
"#add-user-to-group
"
>
Add user to group
</a><ul>
<li><a
href=
"#add-user-to-group
s"
>
Add user to groups
</a><ul>
<li><a
href=
"#possible-parameters-5"
>
Possible parameters
</a></li>
<li><a
href=
"#possible-parameters-5"
>
Possible parameters
</a></li>
<li><a
href=
"#examples-6"
>
Examples
</a></li>
<li><a
href=
"#examples-6"
>
Examples
</a></li>
</ul>
</ul>
</li>
</li>
<li><a
href=
"#
delete-a-user-from-a-group"
>
Delete a user from a
group
</a><ul>
<li><a
href=
"#
add-user-to-group"
>
Add user to
group
</a><ul>
<li><a
href=
"#possible-parameters-6"
>
Possible parameters
</a></li>
<li><a
href=
"#possible-parameters-6"
>
Possible parameters
</a></li>
<li><a
href=
"#examples-7"
>
Examples
</a></li>
<li><a
href=
"#examples-7"
>
Examples
</a></li>
</ul>
</ul>
</li>
</li>
<li><a
href=
"#
lockout-a-user"
>
Lockout a user
</a><ul>
<li><a
href=
"#
delete-a-user-from-a-groups"
>
Delete a user from a groups
</a><ul>
<li><a
href=
"#possible-parameters-7"
>
Possible parameters
</a></li>
<li><a
href=
"#possible-parameters-7"
>
Possible parameters
</a></li>
<li><a
href=
"#examples-8"
>
Examples
</a></li>
<li><a
href=
"#examples-8"
>
Examples
</a></li>
</ul>
</ul>
</li>
</li>
<li><a
href=
"#
unlock-a-user"
>
Unlock a user
</a><ul>
<li><a
href=
"#
delete-a-user-from-a-group"
>
Delete a user from a group
</a><ul>
<li><a
href=
"#possible-parameters-8"
>
Possible parameters
</a></li>
<li><a
href=
"#possible-parameters-8"
>
Possible parameters
</a></li>
<li><a
href=
"#examples-9"
>
Examples
</a></li>
<li><a
href=
"#examples-9"
>
Examples
</a></li>
</ul>
</ul>
</li>
</li>
<li><a
href=
"#retrieve-user-roster"
>
Retrieve user roster
</a><ul>
<li><a
href=
"#lockout-a-user"
>
Lockout a user
</a><ul>
<li><a
href=
"#possible-parameters-8-1"
>
Possible parameters
</a></li>
<li><a
href=
"#examples-9-1"
>
Examples
</a></li>
</ul>
</li>
<li><a
href=
"#unlock-a-user"
>
Unlock a user
</a><ul>
<li><a
href=
"#possible-parameters-9"
>
Possible parameters
</a></li>
<li><a
href=
"#possible-parameters-9"
>
Possible parameters
</a></li>
<li><a
href=
"#examples-10"
>
Examples
</a></li>
<li><a
href=
"#examples-10"
>
Examples
</a></li>
</ul>
</ul>
</li>
</li>
<li><a
href=
"#
create-a-user-roster-entry"
>
Create a user roster entry
</a><ul>
<li><a
href=
"#
retrieve-user-roster"
>
Retrieve user roster
</a><ul>
<li><a
href=
"#possible-parameters-10"
>
Possible parameters
</a></li>
<li><a
href=
"#possible-parameters-10"
>
Possible parameters
</a></li>
<li><a
href=
"#examples-11"
>
Examples
</a></li>
<li><a
href=
"#examples-11"
>
Examples
</a></li>
</ul>
</ul>
</li>
</li>
<li><a
href=
"#
delete-a-user-roster-entry"
>
Dele
te a user roster entry
</a><ul>
<li><a
href=
"#
create-a-user-roster-entry"
>
Crea
te a user roster entry
</a><ul>
<li><a
href=
"#possible-parameters-11"
>
Possible parameters
</a></li>
<li><a
href=
"#possible-parameters-11"
>
Possible parameters
</a></li>
<li><a
href=
"#examples-12"
>
Examples
</a></li>
<li><a
href=
"#examples-12"
>
Examples
</a></li>
</ul>
</ul>
</li>
</li>
<li><a
href=
"#
update-a-user-roster-entry"
>
Upda
te a user roster entry
</a><ul>
<li><a
href=
"#
delete-a-user-roster-entry"
>
Dele
te a user roster entry
</a><ul>
<li><a
href=
"#possible-parameters-12"
>
Possible parameters
</a></li>
<li><a
href=
"#possible-parameters-12"
>
Possible parameters
</a></li>
<li><a
href=
"#examples-13"
>
Examples
</a></li>
<li><a
href=
"#examples-13"
>
Examples
</a></li>
</ul>
</ul>
</li>
</li>
</ul>
<li><a
href=
"#update-a-user-roster-entry"
>
Update a user roster entry
</a><ul>
</li>
<li><a
href=
"#chat-room-related-rest-endpoints"
>
Chat room related REST Endpoints
</a><ul>
<li><a
href=
"#retrieve-all-chat-rooms"
>
Retrieve all chat rooms
</a><ul>
<li><a
href=
"#possible-parameters-13"
>
Possible parameters
</a></li>
<li><a
href=
"#possible-parameters-13"
>
Possible parameters
</a></li>
<li><a
href=
"#examples-14"
>
Examples
</a></li>
<li><a
href=
"#examples-14"
>
Examples
</a></li>
</ul>
</ul>
</li>
</li>
<li><a
href=
"#retrieve-a-chat-room"
>
Retrieve a chat room
</a><ul>
</ul>
</li>
<li><a
href=
"#chat-room-related-rest-endpoints"
>
Chat room related REST Endpoints
</a><ul>
<li><a
href=
"#retrieve-all-chat-rooms"
>
Retrieve all chat rooms
</a><ul>
<li><a
href=
"#possible-parameters-14"
>
Possible parameters
</a></li>
<li><a
href=
"#possible-parameters-14"
>
Possible parameters
</a></li>
<li><a
href=
"#examples-15"
>
Examples
</a></li>
<li><a
href=
"#examples-15"
>
Examples
</a></li>
</ul>
</ul>
</li>
</li>
<li><a
href=
"#retrieve-
chat-room-participants"
>
Retrieve chat room participants
</a><ul>
<li><a
href=
"#retrieve-
a-chat-room"
>
Retrieve a chat room
</a><ul>
<li><a
href=
"#possible-parameters-15"
>
Possible parameters
</a></li>
<li><a
href=
"#possible-parameters-15"
>
Possible parameters
</a></li>
<li><a
href=
"#examples-16"
>
Examples
</a></li>
<li><a
href=
"#examples-16"
>
Examples
</a></li>
</ul>
</ul>
</li>
</li>
<li><a
href=
"#
create-a-chat-room"
>
Create a chat room
</a><ul>
<li><a
href=
"#
retrieve-chat-room-participants"
>
Retrieve chat room participants
</a><ul>
<li><a
href=
"#possible-parameters-16"
>
Possible parameters
</a></li>
<li><a
href=
"#possible-parameters-16"
>
Possible parameters
</a></li>
<li><a
href=
"#examples-17"
>
Examples
</a></li>
</ul>
</li>
<li><a
href=
"#create-a-chat-room"
>
Create a chat room
</a><ul>
<li><a
href=
"#possible-parameters-17"
>
Possible parameters
</a></li>
<li><a
href=
"#xml-examples-1"
>
XML Examples
</a></li>
<li><a
href=
"#xml-examples-1"
>
XML Examples
</a></li>
<li><a
href=
"#json-examples-1"
>
JSON Examples
</a></li>
<li><a
href=
"#json-examples-1"
>
JSON Examples
</a></li>
</ul>
</ul>
</li>
</li>
<li><a
href=
"#delete-a-chat-room"
>
Delete a chat room
</a><ul>
<li><a
href=
"#delete-a-chat-room"
>
Delete a chat room
</a><ul>
<li><a
href=
"#possible-parameters-17"
>
Possible parameters
</a></li>
<li><a
href=
"#possible-parameters-17
-1
"
>
Possible parameters
</a></li>
<li><a
href=
"#examples-17"
>
Examples
</a></li>
<li><a
href=
"#examples-17
-1
"
>
Examples
</a></li>
</ul>
</ul>
</li>
</li>
<li><a
href=
"#update-a-chat-room"
>
Update a chat room
</a><ul>
<li><a
href=
"#update-a-chat-room"
>
Update a chat room
</a><ul>
...
@@ -1485,6 +1495,8 @@ body.pdf{font-family:"DejaVu Sans"}body.pdf code,body.pdf pre{font-family:"DejaV
...
@@ -1485,6 +1495,8 @@ body.pdf{font-family:"DejaVu Sans"}body.pdf code,body.pdf pre{font-family:"DejaV
<li>
Send broadcast message to all online users
</li>
<li>
Send broadcast message to all online users
</li>
</ul>
</ul>
<h2
id=
"available-rest-api-clients"
>
Available REST API clients
</h2>
<h2
id=
"available-rest-api-clients"
>
Available REST API clients
</h2>
<p>
REST API clients are implementations of the REST API in a specific programming language.
</p>
<p>
REST API clients are implementations of the REST API in a specific programming language.
</p>
...
@@ -2322,9 +2334,9 @@ If you want to create a resource with JSON data format, please add “<strong>Co
...
@@ -2322,9 +2334,9 @@ If you want to create a resource with JSON data format, please add “<strong>Co
<h2
id=
"add-user-to-group
"
>
Add user to group
</h2>
<h2
id=
"add-user-to-group
s"
>
Add user to groups
</h2>
<p>
Endpoint to add user to a group
(s)
</p>
<p>
Endpoint to add user to a group
s
</p>
<blockquote>
<blockquote>
<p><strong>
POST
</strong>
/users/{username}/groups
</p>
<p><strong>
POST
</strong>
/users/{username}/groups
</p>
...
@@ -2333,8 +2345,6 @@ If you want to create a resource with JSON data format, please add “<strong>Co
...
@@ -2333,8 +2345,6 @@ If you want to create a resource with JSON data format, please add “<strong>Co
<p><strong>
Payload:
</strong>
Groups
<br>
<p><strong>
Payload:
</strong>
Groups
<br>
<strong>
Return value:
</strong>
HTTP status 201 (Created)
</p>
<strong>
Return value:
</strong>
HTTP status 201 (Created)
</p>
<h3
id=
"possible-parameters-5"
>
Possible parameters
</h3>
<h3
id=
"possible-parameters-5"
>
Possible parameters
</h3>
<table>
<table>
...
@@ -2378,9 +2388,55 @@ If you want to create a resource with JSON data format, please add “<strong>Co
...
@@ -2378,9 +2388,55 @@ If you want to create a resource with JSON data format, please add “<strong>Co
<h2
id=
"
delete-a-user-from-a-group"
>
Delete a user from a
group
</h2>
<h2
id=
"
add-user-to-group"
>
Add user to
group
</h2>
<p>
Endpoint to remove a user from a group(s)
</p>
<p>
Endpoint to add user to a group
</p>
<blockquote>
<p><strong>
POST
</strong>
/users/{username}/groups/{groupName}
</p>
</blockquote>
<p><strong>
Payload:
</strong>
none
<br>
<strong>
Return value:
</strong>
HTTP status 201 (Created)
</p>
<h3
id=
"possible-parameters-6"
>
Possible parameters
</h3>
<table>
<thead>
<tr>
<th>
Parameter
</th>
<th>
Parameter Type
</th>
<th>
Description
</th>
<th>
Default value
</th>
</tr>
</thead>
<tbody><tr>
<td>
username
</td>
<td>
@Path
</td>
<td>
Exact username
</td>
<td></td>
</tr>
<tr>
<td>
groupName
</td>
<td>
@Path
</td>
<td>
Exact group name
</td>
<td></td>
</tr>
</tbody></table>
<h3
id=
"examples-7"
>
Examples
</h3>
<blockquote>
<p><strong>
Header:
</strong>
Authorization: Basic YWRtaW46MTIzNDU=
<br>
<strong>
Header:
</strong>
Content-Type application/xml
</p>
<p><strong>
POST
</strong>
<a
href=
"http://example.org:9090/plugins/restapi/v1/users/testuser/groups/testGroup"
>
http://example.org:9090/plugins/restapi/v1/users/testuser/groups/testGroup
</a></p>
</blockquote>
<h2
id=
"delete-a-user-from-a-groups"
>
Delete a user from a groups
</h2>
<p>
Endpoint to remove a user from a groups
</p>
<blockquote>
<blockquote>
<p><strong>
DELETE
</strong>
/users/{username}/groups
</p>
<p><strong>
DELETE
</strong>
/users/{username}/groups
</p>
...
@@ -2389,9 +2445,7 @@ If you want to create a resource with JSON data format, please add “<strong>Co
...
@@ -2389,9 +2445,7 @@ If you want to create a resource with JSON data format, please add “<strong>Co
<p><strong>
Payload:
</strong>
Groups
<br>
<p><strong>
Payload:
</strong>
Groups
<br>
<strong>
Return value:
</strong>
HTTP status 200 (OK)
</p>
<strong>
Return value:
</strong>
HTTP status 200 (OK)
</p>
<h3
id=
"possible-parameters-7"
>
Possible parameters
</h3>
<h3
id=
"possible-parameters-6"
>
Possible parameters
</h3>
<table>
<table>
<thead>
<thead>
...
@@ -2413,7 +2467,7 @@ If you want to create a resource with JSON data format, please add “<strong>Co
...
@@ -2413,7 +2467,7 @@ If you want to create a resource with JSON data format, please add “<strong>Co
<h3
id=
"examples-
7
"
>
Examples
</h3>
<h3
id=
"examples-
8
"
>
Examples
</h3>
<blockquote>
<blockquote>
<p><strong>
Header:
</strong>
Authorization: Basic YWRtaW46MTIzNDU=
<br>
<p><strong>
Header:
</strong>
Authorization: Basic YWRtaW46MTIzNDU=
<br>
...
@@ -2434,6 +2488,52 @@ If you want to create a resource with JSON data format, please add “<strong>Co
...
@@ -2434,6 +2488,52 @@ If you want to create a resource with JSON data format, please add “<strong>Co
<h2
id=
"delete-a-user-from-a-group"
>
Delete a user from a group
</h2>
<p>
Endpoint to remove a user from a group
</p>
<blockquote>
<p><strong>
DELETE
</strong>
/users/{username}/groups/{groupName}
</p>
</blockquote>
<p><strong>
Payload:
</strong>
none
<br>
<strong>
Return value:
</strong>
HTTP status 200 (OK)
</p>
<h3
id=
"possible-parameters-8"
>
Possible parameters
</h3>
<table>
<thead>
<tr>
<th>
Parameter
</th>
<th>
Parameter Type
</th>
<th>
Description
</th>
<th>
Default value
</th>
</tr>
</thead>
<tbody><tr>
<td>
username
</td>
<td>
@Path
</td>
<td>
Exact username
</td>
<td></td>
</tr>
<tr>
<td>
groupName
</td>
<td>
@Path
</td>
<td>
Exact group name
</td>
<td></td>
</tr>
</tbody></table>
<h3
id=
"examples-9"
>
Examples
</h3>
<blockquote>
<p><strong>
Header:
</strong>
Authorization: Basic YWRtaW46MTIzNDU=
<br>
<strong>
Header:
</strong>
Content-Type application/xml
</p>
<p><strong>
DELETE
</strong>
<a
href=
"http://example.org:9090/plugins/restapi/v1/users/testuser/groups/testGroup"
>
http://example.org:9090/plugins/restapi/v1/users/testuser/groups/testGroup
</a></p>
</blockquote>
<h2
id=
"lockout-a-user"
>
Lockout a user
</h2>
<h2
id=
"lockout-a-user"
>
Lockout a user
</h2>
<p>
Endpoint to lockout / ban the user from the chat server. The user will be kicked if the user is online.
</p>
<p>
Endpoint to lockout / ban the user from the chat server. The user will be kicked if the user is online.
</p>
...
@@ -2447,7 +2547,7 @@ If you want to create a resource with JSON data format, please add “<strong>Co
...
@@ -2447,7 +2547,7 @@ If you want to create a resource with JSON data format, please add “<strong>Co
<h3
id=
"possible-parameters-
7
"
>
Possible parameters
</h3>
<h3
id=
"possible-parameters-
8
"
>
Possible parameters
</h3>
<table>
<table>
<thead>
<thead>
...
@@ -2469,7 +2569,7 @@ If you want to create a resource with JSON data format, please add “<strong>Co
...
@@ -2469,7 +2569,7 @@ If you want to create a resource with JSON data format, please add “<strong>Co
<h3
id=
"examples-
8
"
>
Examples
</h3>
<h3
id=
"examples-
9
"
>
Examples
</h3>
<blockquote>
<blockquote>
<p><strong>
Header:
</strong>
Authorization: Basic YWRtaW46MTIzNDU=
</p>
<p><strong>
Header:
</strong>
Authorization: Basic YWRtaW46MTIzNDU=
</p>
...
@@ -2492,7 +2592,7 @@ If you want to create a resource with JSON data format, please add “<strong>Co
...
@@ -2492,7 +2592,7 @@ If you want to create a resource with JSON data format, please add “<strong>Co
<h3
id=
"possible-parameters-
8
"
>
Possible parameters
</h3>
<h3
id=
"possible-parameters-
9
"
>
Possible parameters
</h3>
<table>
<table>
<thead>
<thead>
...
@@ -2514,7 +2614,7 @@ If you want to create a resource with JSON data format, please add “<strong>Co
...
@@ -2514,7 +2614,7 @@ If you want to create a resource with JSON data format, please add “<strong>Co
<h3
id=
"examples-
9
"
>
Examples
</h3>
<h3
id=
"examples-
10
"
>
Examples
</h3>
<blockquote>
<blockquote>
<p><strong>
Header:
</strong>
Authorization: Basic YWRtaW46MTIzNDU=
</p>
<p><strong>
Header:
</strong>
Authorization: Basic YWRtaW46MTIzNDU=
</p>
...
@@ -2537,7 +2637,7 @@ If you want to create a resource with JSON data format, please add “<strong>Co
...
@@ -2537,7 +2637,7 @@ If you want to create a resource with JSON data format, please add “<strong>Co
<h3
id=
"possible-parameters-
9
"
>
Possible parameters
</h3>
<h3
id=
"possible-parameters-
10
"
>
Possible parameters
</h3>
<table>
<table>
<thead>
<thead>
...
@@ -2559,7 +2659,7 @@ If you want to create a resource with JSON data format, please add “<strong>Co
...
@@ -2559,7 +2659,7 @@ If you want to create a resource with JSON data format, please add “<strong>Co
<h3
id=
"examples-1
0
"
>
Examples
</h3>
<h3
id=
"examples-1
1
"
>
Examples
</h3>
<blockquote>
<blockquote>
<p><strong>
Header:
</strong>
Authorization: Basic YWRtaW46MTIzNDU=
</p>
<p><strong>
Header:
</strong>
Authorization: Basic YWRtaW46MTIzNDU=
</p>
...
@@ -2582,7 +2682,7 @@ If you want to create a resource with JSON data format, please add “<strong>Co
...
@@ -2582,7 +2682,7 @@ If you want to create a resource with JSON data format, please add “<strong>Co
<h3
id=
"possible-parameters-1
0
"
>
Possible parameters
</h3>
<h3
id=
"possible-parameters-1
1
"
>
Possible parameters
</h3>
<table>
<table>
<thead>
<thead>
...
@@ -2604,7 +2704,7 @@ If you want to create a resource with JSON data format, please add “<strong>Co
...
@@ -2604,7 +2704,7 @@ If you want to create a resource with JSON data format, please add “<strong>Co
<h3
id=
"examples-1
1
"
>
Examples
</h3>
<h3
id=
"examples-1
2
"
>
Examples
</h3>
<blockquote>
<blockquote>
<p><strong>
Header:
</strong>
Authorization: Basic YWRtaW46MTIzNDU=
<br>
<p><strong>
Header:
</strong>
Authorization: Basic YWRtaW46MTIzNDU=
<br>
...
@@ -2652,7 +2752,7 @@ Payload Example 1 (required parameters):</p>
...
@@ -2652,7 +2752,7 @@ Payload Example 1 (required parameters):</p>
<h3
id=
"possible-parameters-1
1
"
>
Possible parameters
</h3>
<h3
id=
"possible-parameters-1
2
"
>
Possible parameters
</h3>
<table>
<table>
<thead>
<thead>
...
@@ -2680,7 +2780,7 @@ Payload Example 1 (required parameters):</p>
...
@@ -2680,7 +2780,7 @@ Payload Example 1 (required parameters):</p>
<h3
id=
"examples-1
2
"
>
Examples
</h3>
<h3
id=
"examples-1
3
"
>
Examples
</h3>
<blockquote>
<blockquote>
<p><strong>
Header:
</strong>
Authorization: Basic YWRtaW46MTIzNDU=
</p>
<p><strong>
Header:
</strong>
Authorization: Basic YWRtaW46MTIzNDU=
</p>
...
@@ -2703,7 +2803,7 @@ Payload Example 1 (required parameters):</p>
...
@@ -2703,7 +2803,7 @@ Payload Example 1 (required parameters):</p>
<h3
id=
"possible-parameters-1
2
"
>
Possible parameters
</h3>
<h3
id=
"possible-parameters-1
3
"
>
Possible parameters
</h3>
<table>
<table>
<thead>
<thead>
...
@@ -2731,7 +2831,7 @@ Payload Example 1 (required parameters):</p>
...
@@ -2731,7 +2831,7 @@ Payload Example 1 (required parameters):</p>
<h3
id=
"examples-1
3
"
>
Examples
</h3>
<h3
id=
"examples-1
4
"
>
Examples
</h3>
<blockquote>
<blockquote>
<p><strong>
Header:
</strong>
Authorization: Basic YWRtaW46MTIzNDU=
<br>
<p><strong>
Header:
</strong>
Authorization: Basic YWRtaW46MTIzNDU=
<br>
...
@@ -2773,7 +2873,7 @@ Payload Example 1 (required parameters):</p>
...
@@ -2773,7 +2873,7 @@ Payload Example 1 (required parameters):</p>
<h3
id=
"possible-parameters-1
3
"
>
Possible parameters
</h3>
<h3
id=
"possible-parameters-1
4
"
>
Possible parameters
</h3>
<table>
<table>
<thead>
<thead>
...
@@ -2807,7 +2907,7 @@ Payload Example 1 (required parameters):</p>
...
@@ -2807,7 +2907,7 @@ Payload Example 1 (required parameters):</p>
<h3
id=
"examples-1
4
"
>
Examples
</h3>
<h3
id=
"examples-1
5
"
>
Examples
</h3>
<blockquote>
<blockquote>
<p><strong>
Header
</strong>
: Authorization: Basic YWRtaW46MTIzNDU=
</p>
<p><strong>
Header
</strong>
: Authorization: Basic YWRtaW46MTIzNDU=
</p>
...
@@ -2833,7 +2933,7 @@ Payload Example 1 (required parameters):</p>
...
@@ -2833,7 +2933,7 @@ Payload Example 1 (required parameters):</p>
<h3
id=
"possible-parameters-1
4
"
>
Possible parameters
</h3>
<h3
id=
"possible-parameters-1
5
"
>
Possible parameters
</h3>
<table>
<table>
<thead>
<thead>
...
@@ -2861,7 +2961,7 @@ Payload Example 1 (required parameters):</p>
...
@@ -2861,7 +2961,7 @@ Payload Example 1 (required parameters):</p>
<h3
id=
"examples-1
5
"
>
Examples
</h3>
<h3
id=
"examples-1
6
"
>
Examples
</h3>
<blockquote>
<blockquote>
<p><strong>
Header:
</strong>
Authorization: Basic YWRtaW46MTIzNDU=
</p>
<p><strong>
Header:
</strong>
Authorization: Basic YWRtaW46MTIzNDU=
</p>
...
@@ -2885,7 +2985,7 @@ Payload Example 1 (required parameters):</p>
...
@@ -2885,7 +2985,7 @@ Payload Example 1 (required parameters):</p>
<h3
id=
"possible-parameters-1
5
"
>
Possible parameters
</h3>
<h3
id=
"possible-parameters-1
6
"
>
Possible parameters
</h3>
<table>
<table>
<thead>
<thead>
...
@@ -2913,7 +3013,7 @@ Payload Example 1 (required parameters):</p>
...
@@ -2913,7 +3013,7 @@ Payload Example 1 (required parameters):</p>
<h3
id=
"examples-1
6
"
>
Examples
</h3>
<h3
id=
"examples-1
7
"
>
Examples
</h3>
<blockquote>
<blockquote>
<p><strong>
Header:
</strong>
Authorization: Basic YWRtaW46MTIzNDU=
</p>
<p><strong>
Header:
</strong>
Authorization: Basic YWRtaW46MTIzNDU=
</p>
...
@@ -2936,7 +3036,7 @@ Payload Example 1 (required parameters):</p>
...
@@ -2936,7 +3036,7 @@ Payload Example 1 (required parameters):</p>
<h3
id=
"possible-parameters-1
6
"
>
Possible parameters
</h3>
<h3
id=
"possible-parameters-1
7
"
>
Possible parameters
</h3>
<table>
<table>
<thead>
<thead>
...
@@ -3095,8 +3195,6 @@ Payload Example 1 (required parameters):</p>
...
@@ -3095,8 +3195,6 @@ Payload Example 1 (required parameters):</p>
}
}
}
</code></pre>
}
</code></pre>
<h2
id=
"delete-a-chat-room"
>
Delete a chat room
</h2>
<h2
id=
"delete-a-chat-room"
>
Delete a chat room
</h2>
<p>
Endpoint to delete a chat room.
</p>
<p>
Endpoint to delete a chat room.
</p>
...
@@ -3916,6 +4014,8 @@ DELETE /chatrooms/{roomName}/{roles}/{name}</p>
...
@@ -3916,6 +4014,8 @@ DELETE /chatrooms/{roomName}/{roles}/{name}</p>
<h1
id=
"message-related-rest-endpoints"
>
Message related REST Endpoints
</h1>
<h1
id=
"message-related-rest-endpoints"
>
Message related REST Endpoints
</h1>
<h2
id=
"send-a-broadcast-message"
>
Send a broadcast message
</h2>
<h2
id=
"send-a-broadcast-message"
>
Send a broadcast message
</h2>
<p>
Endpoint to send a broadcast/server message to all online users
</p>
<p>
Endpoint to send a broadcast/server message to all online users
</p>
...
@@ -3927,6 +4027,8 @@ DELETE /chatrooms/{roomName}/{roles}/{name}</p>
...
@@ -3927,6 +4027,8 @@ DELETE /chatrooms/{roomName}/{roles}/{name}</p>
<p><strong>
Payload:
</strong>
Message
<br>
<p><strong>
Payload:
</strong>
Message
<br>
<strong>
Return value:
</strong>
HTTP status 201 (Created)
</p>
<strong>
Return value:
</strong>
HTTP status 201 (Created)
</p>
<h3
id=
"examples-35"
>
Examples
</h3>
<h3
id=
"examples-35"
>
Examples
</h3>
<blockquote>
<blockquote>
...
@@ -3944,6 +4046,8 @@ DELETE /chatrooms/{roomName}/{roles}/{name}</p>
...
@@ -3944,6 +4046,8 @@ DELETE /chatrooms/{roomName}/{roles}/{name}</p>
<span
class=
"hljs-tag"
>
<
<span
class=
"hljs-title"
>
body
</span>
>
</span>
Your message
<span
class=
"hljs-tag"
>
<
/
<span
class=
"hljs-title"
>
body
</span>
>
</span>
<span
class=
"hljs-tag"
>
<
<span
class=
"hljs-title"
>
body
</span>
>
</span>
Your message
<span
class=
"hljs-tag"
>
<
/
<span
class=
"hljs-title"
>
body
</span>
>
</span>
<span
class=
"hljs-tag"
>
<
/
<span
class=
"hljs-title"
>
message
</span>
>
</span></code></pre>
<span
class=
"hljs-tag"
>
<
/
<span
class=
"hljs-title"
>
message
</span>
>
</span></code></pre>
<h1
id=
"deprecated-user-service-plugin-readme"
>
(Deprecated) User Service Plugin Readme
</h1>
<h1
id=
"deprecated-user-service-plugin-readme"
>
(Deprecated) User Service Plugin Readme
</h1>
...
@@ -4479,6 +4583,47 @@ If the strings are encoded incorrectly, double byte characters will look garbele
...
@@ -4479,6 +4583,47 @@ If the strings are encoded incorrectly, double byte characters will look garbele
...
...
src/plugins/restAPI/src/java/org/jivesoftware/openfire/plugin/rest/controller/UserServiceController.java
View file @
c6435b62
...
@@ -395,6 +395,25 @@ public class UserServiceController {
...
@@ -395,6 +395,25 @@ public class UserServiceController {
}
}
}
}
/**
* Adds the user to group.
*
* @param username the username
* @param groupName the group name
* @throws ServiceException the service exception
*/
public
void
addUserToGroup
(
String
username
,
String
groupName
)
throws
ServiceException
{
Group
group
=
null
;
try
{
group
=
GroupManager
.
getInstance
().
getGroup
(
groupName
);
}
catch
(
GroupNotFoundException
e
)
{
// Create this group
group
=
GroupController
.
getInstance
().
createGroup
(
new
GroupEntity
(
groupName
,
""
));
}
group
.
getMembers
().
add
(
server
.
createJID
(
username
,
null
));
}
/**
/**
* Delete user from groups.
* Delete user from groups.
*
*
...
@@ -420,6 +439,24 @@ public class UserServiceController {
...
@@ -420,6 +439,24 @@ public class UserServiceController {
}
}
}
}
/**
* Delete user from group.
*
* @param username the username
* @param groupName the group name
* @throws ServiceException the service exception
*/
public
void
deleteUserFromGroup
(
String
username
,
String
groupName
)
throws
ServiceException
{
Group
group
=
null
;
try
{
group
=
GroupManager
.
getInstance
().
getGroup
(
groupName
);
}
catch
(
GroupNotFoundException
e
)
{
throw
new
ServiceException
(
"Could not find group"
,
groupName
,
ExceptionType
.
GROUP_NOT_FOUND
,
Response
.
Status
.
NOT_FOUND
,
e
);
}
group
.
getMembers
().
remove
(
server
.
createJID
(
username
,
null
));
}
/**
/**
* Gets the user entities by property key and or value.
* Gets the user entities by property key and or value.
*
*
...
...
src/plugins/restAPI/src/java/org/jivesoftware/openfire/plugin/rest/exceptions/RESTExceptionMapper.java
View file @
c6435b62
package
org
.
jivesoftware
.
openfire
.
plugin
.
rest
.
exceptions
;
package
org
.
jivesoftware
.
openfire
.
plugin
.
rest
.
exceptions
;
import
java.util.List
;
import
javax.ws.rs.core.Context
;
import
javax.ws.rs.core.HttpHeaders
;
import
javax.ws.rs.core.MediaType
;
import
javax.ws.rs.core.MediaType
;
import
javax.ws.rs.core.Response
;
import
javax.ws.rs.core.Response
;
import
javax.ws.rs.core.Response.ResponseBuilder
;
import
javax.ws.rs.ext.ExceptionMapper
;
import
javax.ws.rs.ext.ExceptionMapper
;
import
javax.ws.rs.ext.Provider
;
import
javax.ws.rs.ext.Provider
;
...
@@ -17,6 +22,11 @@ public class RESTExceptionMapper implements ExceptionMapper<ServiceException> {
...
@@ -17,6 +22,11 @@ public class RESTExceptionMapper implements ExceptionMapper<ServiceException> {
/** The log. */
/** The log. */
private
static
Logger
LOG
=
LoggerFactory
.
getLogger
(
RESTExceptionMapper
.
class
);
private
static
Logger
LOG
=
LoggerFactory
.
getLogger
(
RESTExceptionMapper
.
class
);
/** The headers. */
@Context
private
HttpHeaders
headers
;
/**
/**
* Instantiates a new REST exception mapper.
* Instantiates a new REST exception mapper.
*/
*/
...
@@ -36,7 +46,17 @@ public class RESTExceptionMapper implements ExceptionMapper<ServiceException> {
...
@@ -36,7 +46,17 @@ public class RESTExceptionMapper implements ExceptionMapper<ServiceException> {
LOG
.
error
(
LOG
.
error
(
exception
.
getException
()
+
": "
+
exception
.
getMessage
()
+
" with ressource "
exception
.
getException
()
+
": "
+
exception
.
getMessage
()
+
" with ressource "
+
exception
.
getRessource
(),
exception
.
getException
());
+
exception
.
getRessource
(),
exception
.
getException
());
return
Response
.
status
(
exception
.
getStatus
()).
entity
(
errorResponse
).
type
(
MediaType
.
APPLICATION_XML
).
build
();
ResponseBuilder
responseBuilder
=
Response
.
status
(
exception
.
getStatus
()).
entity
(
errorResponse
);
List
<
MediaType
>
accepts
=
headers
.
getAcceptableMediaTypes
();
if
(
accepts
!=
null
&&
accepts
.
size
()
>
0
)
{
MediaType
mediaType
=
accepts
.
get
(
0
);
responseBuilder
=
responseBuilder
.
type
(
mediaType
);
}
else
{
responseBuilder
=
responseBuilder
.
type
(
headers
.
getMediaType
());
}
return
responseBuilder
.
build
();
}
}
}
}
src/plugins/restAPI/src/java/org/jivesoftware/openfire/plugin/rest/service/GroupService.java
View file @
c6435b62
...
@@ -54,7 +54,7 @@ public class GroupService {
...
@@ -54,7 +54,7 @@ public class GroupService {
@DELETE
@DELETE
@Path
(
"/{groupName}"
)
@Path
(
"/{groupName}"
)
public
Response
delete
UserFromGroups
(
@PathParam
(
"groupName"
)
String
groupName
)
throws
ServiceException
{
public
Response
delete
Group
(
@PathParam
(
"groupName"
)
String
groupName
)
throws
ServiceException
{
groupController
.
deleteGroup
(
groupName
);
groupController
.
deleteGroup
(
groupName
);
return
Response
.
status
(
Response
.
Status
.
OK
).
build
();
return
Response
.
status
(
Response
.
Status
.
OK
).
build
();
}
}
...
...
src/plugins/restAPI/src/java/org/jivesoftware/openfire/plugin/rest/service/UserGroupService.java
View file @
c6435b62
...
@@ -37,6 +37,22 @@ public class UserGroupService {
...
@@ -37,6 +37,22 @@ public class UserGroupService {
return
Response
.
status
(
Response
.
Status
.
CREATED
).
build
();
return
Response
.
status
(
Response
.
Status
.
CREATED
).
build
();
}
}
@POST
@Path
(
"/{groupName}"
)
public
Response
addUserToGroup
(
@PathParam
(
"username"
)
String
username
,
@PathParam
(
"groupName"
)
String
groupName
)
throws
ServiceException
{
plugin
.
addUserToGroup
(
username
,
groupName
);
return
Response
.
status
(
Response
.
Status
.
CREATED
).
build
();
}
@DELETE
@Path
(
"/{groupName}"
)
public
Response
deleteUserFromGroup
(
@PathParam
(
"username"
)
String
username
,
@PathParam
(
"groupName"
)
String
groupName
)
throws
ServiceException
{
plugin
.
deleteUserFromGroup
(
username
,
groupName
);
return
Response
.
status
(
Response
.
Status
.
OK
).
build
();
}
@DELETE
@DELETE
public
Response
deleteUserFromGroups
(
@PathParam
(
"username"
)
String
username
,
UserGroupsEntity
userGroupsEntity
)
public
Response
deleteUserFromGroups
(
@PathParam
(
"username"
)
String
username
,
UserGroupsEntity
userGroupsEntity
)
throws
ServiceException
{
throws
ServiceException
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment