Commit 28218f8d authored by Daryl Herzmann's avatar Daryl Herzmann Committed by akrherz

Add ability to enable / disable accounts via LockOutManager,

bumped OF version requirement to match need for LockOutManager  JM-1446


git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@11074 b35dd754-fafc-0310-a699-88a17e54d16e
parent 27ffe224
......@@ -44,6 +44,12 @@
User Service Plugin Changelog
</h1>
<p><b>1.3.1</b> -- August 12, 2008</p>
<ul>
<li>Added support for lockout (type=disable) and unlock (type=enable). Author: Daryl Herzmann</li>
</ul>
<p><b>1.3.0</b> -- October 12, 2007</p>
<ul>
<li>Added support for filtering by IP address.</li>
......@@ -75,4 +81,4 @@ User Service Plugin Changelog
</body>
</html>
\ No newline at end of file
</html>
......@@ -5,9 +5,9 @@
<name>User Service</name>
<description>Allows administration of users via HTTP requests.</description>
<author>Justin Hunt</author>
<version>1.3.0</version>
<date>10/12/2007</date>
<minServerVersion>3.3.0</minServerVersion>
<version>1.3.1</version>
<date>06/16/2009</date>
<minServerVersion>3.5.1</minServerVersion>
<adminconsole>
<tab id="tab-server">
......@@ -18,4 +18,4 @@
</tab>
</adminconsole>
</plugin>
\ No newline at end of file
</plugin>
......@@ -93,7 +93,7 @@ The following parameters can be passed into the request:<p>
</tr>
<tr>
<td class="name">type</td><td>Required</td><td>The admin service required.
Possible values are add, delete, update</td>
Possible values are add, delete, update, enable, disable</td>
</tr>
<tr>
<td class="name">secret</td><td>Required</td>
......@@ -101,7 +101,7 @@ The following parameters can be passed into the request:<p>
</tr>
<tr>
<td class="name">username</td><td>Required</td>
<td>The username of the user to add, update or delete. ie the part before the @ symbol.</td>
<td>The username of the user to add, update, delete, enable, or disable. ie the part before the @ symbol.</td>
</tr>
<tr>
<td class="name">password</td><td>Required for add operation</td>
......@@ -146,6 +146,27 @@ http://example.com:9090/plugins/userService/userservice?type=delete&secret=bigse
</form>
</ul>
The following example disables a user (lockout)
<ul>
<form>
<textarea cols=65 rows=4 wrap=virtual>
http://example.com:9090/plugins/userService/userservice?type=disable&secret=bigsecret&username=kafka
</textarea>
</form>
</ul>
The following example enables a user (removes lockout)
<ul>
<form>
<textarea cols=65 rows=4 wrap=virtual>
http://example.com:9090/plugins/userService/userservice?type=enable&secret=bigsecret&username=kafka
</textarea>
</form>
</ul>
This example updates a user
<ul>
......
......@@ -17,6 +17,7 @@ import org.jivesoftware.openfire.container.PluginManager;
import org.jivesoftware.openfire.group.Group;
import org.jivesoftware.openfire.group.GroupManager;
import org.jivesoftware.openfire.group.GroupNotFoundException;
import org.jivesoftware.openfire.lockout.LockOutManager;
import org.jivesoftware.openfire.user.User;
import org.jivesoftware.openfire.user.UserAlreadyExistsException;
import org.jivesoftware.openfire.user.UserManager;
......@@ -95,6 +96,32 @@ public class UserServicePlugin implements Plugin, PropertyEventListener {
User user = getUser(username);
userManager.deleteUser(user);
}
/**
* Lock Out on a given username
*
* @param username the username of the local user to disable.
* @throws UserNotFoundException if the requested user
* does not exist in the local server.
*/
public void disableUser(String username) throws UserNotFoundException
{
User user = getUser(username);
LockOutManager.getInstance().disableAccount(username, null, null);
}
/**
* Remove the lockout on a given username
*
* @param username the username of the local user to enable.
* @throws UserNotFoundException if the requested user
* does not exist in the local server.
*/
public void enableUser(String username) throws UserNotFoundException
{
User user = getUser(username);
LockOutManager.getInstance().enableAccount(username);
}
public void updateUser(String username, String password, String name, String email, String groupNames)
throws UserNotFoundException
......
......@@ -114,6 +114,14 @@ public class UserServiceServlet extends HttpServlet {
replyMessage("ok",response,out);
//xmlProvider.sendInfo(request, response, presence);
}
else if ("enable".equals(type)) {
plugin.enableUser(username);
replyMessage("ok",response,out);
}
else if ("disable".equals(type)) {
plugin.disableUser(username);
replyMessage("ok",response,out);
}
else if ("update".equals(type)) {
plugin.updateUser(username, password,name,email, groupNames);
replyMessage("ok",response,out);
......
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