Package org.jivesoftware.openfire.admin
Class AdminManager
java.lang.Object
org.jivesoftware.openfire.admin.AdminManager
The AdminManager manages the AdminProvider configured for this server, caches knowledge of
accounts with admin permissions, and provides a single point of entry for handling
getting and setting administrative accounts.
The provider can be specified using the system property:
provider.admin.className = my.admin.provider
- Author:
- Daniel Henninger
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAdminAccount
(String username) Adds a new account to the list of Admin accounts, based off a username, which will be converted into a JID.void
addAdminAccount
(org.xmpp.packet.JID jid) Adds a new account to the list of Admin accounts, based off a JID.void
Clears the list of admin users.List<org.xmpp.packet.JID>
Returns the list of admin users from the provider.static AdminProvider
Returns the currently-installed AdminProvider.static AdminManager
Returns a singleton instance of AdminManager.boolean
isUserAdmin
(String username, boolean allowAdminIfEmpty) Returns true if the user is an admin.boolean
isUserAdmin
(org.xmpp.packet.JID jid, boolean allowAdminIfEmpty) Returns true if the user is an admin.void
Refreshes the list of admin users from the provider.void
removeAdminAccount
(String username) Removes an account from the list of Admin accounts, based off username, which will be converted to a JID.void
removeAdminAccount
(org.xmpp.packet.JID jid) Removes an account from the list of Admin accounts, based off JID.void
setAdminJIDs
(List<org.xmpp.packet.JID> jids) Sets the list of admin users based off of a list of jids.void
setAdminUsers
(List<String> usernames) Sets the list of admin users based off of a list of usernames.
-
Field Details
-
ADMIN_PROVIDER
-
-
Method Details
-
getAdminProvider
Returns the currently-installed AdminProvider. Warning: in virtually all cases the admin provider should not be used directly. Instead, the appropriate methods in AdminManager should be called. Direct access to the admin provider is only provided for special-case logic.- Returns:
- the current AdminProvider.
-
getInstance
Returns a singleton instance of AdminManager.- Returns:
- a AdminManager instance.
-
refreshAdminAccounts
public void refreshAdminAccounts()Refreshes the list of admin users from the provider. -
getAdminAccounts
Returns the list of admin users from the provider.- Returns:
- The list of users with admin status.
-
addAdminAccount
Adds a new account to the list of Admin accounts, based off a username, which will be converted into a JID.- Parameters:
username
- Username of account to add to list of admins.
-
addAdminAccount
public void addAdminAccount(org.xmpp.packet.JID jid) Adds a new account to the list of Admin accounts, based off a JID.- Parameters:
jid
- JID of account to add to list of admins.
-
removeAdminAccount
Removes an account from the list of Admin accounts, based off username, which will be converted to a JID.- Parameters:
username
- Username of user to remove from admin list.
-
removeAdminAccount
public void removeAdminAccount(org.xmpp.packet.JID jid) Removes an account from the list of Admin accounts, based off JID.- Parameters:
jid
- JID of user to remove from admin list.
-
isUserAdmin
Returns true if the user is an admin.- Parameters:
username
- Username of user to check whether they are an admin or not.allowAdminIfEmpty
- Allows the "admin" user to log in if the adminList is empty.- Returns:
- True or false if user is an admin.
-
isUserAdmin
public boolean isUserAdmin(org.xmpp.packet.JID jid, boolean allowAdminIfEmpty) Returns true if the user is an admin.- Parameters:
jid
- JID of user to check whether they are an admin or not.allowAdminIfEmpty
- Allows the "admin" user to log in if the adminList is empty.- Returns:
- True or false if user is an admin.
-
clearAdminUsers
public void clearAdminUsers()Clears the list of admin users. -
setAdminUsers
Sets the list of admin users based off of a list of usernames. Clears list first.- Parameters:
usernames
- List of usernames to set as admins.
-
setAdminJIDs
Sets the list of admin users based off of a list of jids. Clears list first.- Parameters:
jids
- List of jids to set as admins.
-