public abstract class UserManager extends Object
Abstract UserManager class.
Modifier and Type | Class and Description |
---|---|
static class |
UserManager.ContactType |
Modifier and Type | Field and Description |
---|---|
protected HashMap<String,List<DutySchedule>> |
m_dutySchedules
The duty schedules for each user
|
protected GroupManager |
m_groupManager |
protected Map<String,User> |
m_users
A mapping of user IDs to the User objects
|
Modifier | Constructor and Description |
---|---|
protected |
UserManager(GroupManager groupManager)
Constructor for UserManager.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkSaltedPassword(String raw,
String encrypted) |
boolean |
comparePasswords(String userID,
String aPassword)
This method compares two encrypted strings for equality.
|
int |
countUsersWithRole(String roleid)
countUsersWithRole
|
void |
deleteUser(String name)
Removes the user from the list of users.
|
protected abstract void |
doUpdate()
update
|
String |
encryptedPassword(String aPassword,
boolean useSalt)
encryptedPassword
|
String |
getContactInfo(String userID,
String command)
Get the contact info given a command string
|
String |
getContactInfo(User user,
String command)
getContactInfo
|
String |
getContactServiceProvider(String userID,
String command)
Get the contact service provider, given a command string
|
String |
getContactServiceProvider(User user,
String command)
getContactServiceProvider
|
String |
getEmail(String userID)
Get a email by name
|
String |
getEmail(User user)
Get a email by user
|
abstract long |
getFileSize() |
String |
getHomePhone(String userID)
Get a home phone number
|
String |
getHomePhone(User user)
Get a home phone number
|
abstract long |
getLastModified() |
String |
getMicroblogName(String name)
Get a user's microblog username by username
|
String |
getMicroblogName(User user)
Get a user's microblog username by User
|
String |
getMobilePhone(String userID)
Get a mobile phone number
|
String |
getMobilePhone(User user)
Get a mobile phone number
|
String |
getNumericPage(String userID)
Get a numeric service provider
|
String |
getNumericPage(User user)
Get a numeric service provider
|
String |
getNumericPin(String userID)
Get a numeric pin
|
String |
getNumericPin(User user)
Get a numeric pin
|
OnmsUser |
getOnmsUser(String username) |
OnmsUserList |
getOnmsUserList() |
String |
getPagerEmail(String userID)
Get a pager email by name
|
String |
getPagerEmail(User user)
Get a pager email by user
|
String |
getTextPage(String userID)
Get a Text Page Service Provider
|
String |
getTextPage(User user)
Get a Text Page Service Provider
|
String |
getTextPin(String userID)
Get a text pin
|
String |
getTextPin(User user)
Get a text pin
|
String |
getTuiPin(String name)
Get a user's telephone PIN by name
|
String |
getTuiPin(User user)
Get a user's telephone PIN by User object
|
User |
getUser(String name)
Get a user by name
|
List<String> |
getUserNames()
getUserNames
|
Map<String,User> |
getUsers()
Return a
Map of usernames to user instances. |
String[] |
getUsersScheduledForRole(String roleid,
Date time)
getUsersScheduledForRole
|
String[] |
getUsersWithRole(String roleid)
getUsersWithRole
|
String |
getWorkPhone(String userID)
Get a work phone number
|
String |
getWorkPhone(User user)
Get a work phone number
|
String |
getXMPPAddress(String userID)
Get an XMPP address by name
|
String |
getXMPPAddress(User user)
Get an XMPP address by name
|
boolean |
hasRole(String roleid)
hasRole
|
boolean |
hasUser(String userName)
Returns a boolean indicating if the user name appears in the XML file
|
abstract boolean |
isUpdateNeeded() |
boolean |
isUserOnDuty(String user,
Calendar time)
Determines if a user is on duty at a given time.
|
boolean |
isUserScheduledForRole(User user,
String roleid,
Date time)
isUserScheduledForRole
|
void |
parseXML(InputStream in)
parseXML
|
abstract void |
reload() |
void |
renameUser(String oldName,
String newName)
When this method is called users name is changed, so also is the username
belonging to the group and the view.
|
void |
save(OnmsUser user) |
void |
saveUser(String name,
User details)
Adds a new user and overwrites the "users.xml"
|
void |
saveUsers(Collection<User> usersList)
saveUsers
|
protected abstract void |
saveXML(String writerString)
saveXML
|
void |
setEncryptedPassword(String userID,
String aPassword,
boolean salted)
Sets the password for this user, assuming that the value passed in is
already encrypted properly
|
void |
setUnencryptedPassword(String userID,
String aPassword)
Sets the password for this user, first encrypting it
|
void |
update() |
boolean |
userHasRole(User user,
String roleid)
userHasRole
|
protected GroupManager m_groupManager
protected HashMap<String,List<DutySchedule>> m_dutySchedules
protected UserManager(GroupManager groupManager)
Constructor for UserManager.
groupManager
- a GroupManager
object.public void parseXML(InputStream in) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
parseXML
in
- a InputStream
object.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public void saveUser(String name, User details) throws Exception
public boolean isUserOnDuty(String user, Calendar time) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
user
- the user idtime
- the time to check for a duty scheduleIOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public Map<String,User> getUsers() throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
Map
of usernames to user instances.Map
object.IOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public OnmsUserList getOnmsUserList() throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException, IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
IOException
public OnmsUser getOnmsUser(String username) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException, IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
IOException
public boolean hasUser(String userName) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
userName
- a String
object.IOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public List<String> getUserNames() throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
getUserNames
List
object.IOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public User getUser(String name) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
name
- the name of the user to returnIOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public String getTuiPin(String name) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
name
- the name of the user to returnIOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public String getTuiPin(User user) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
user
- a User
object.IOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public String getMicroblogName(String name) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException, FileNotFoundException, IOException
name
- the username of the user whose microblog username should be returnedIOException
- if any.FileNotFoundException
- if any.org.exolab.castor.xml.ValidationException
- if any.org.exolab.castor.xml.MarshalException
- if any.public String getMicroblogName(User user) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException, FileNotFoundException, IOException
user
- the user object of the user whose microblog username should be returnedIOException
- if any.FileNotFoundException
- if any.org.exolab.castor.xml.ValidationException
- if any.org.exolab.castor.xml.MarshalException
- if any.public String getContactInfo(String userID, String command) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
userID
- the name of the usercommand
- the command to look up the contact info forIOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public String getContactInfo(User user, String command) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
getContactInfo
user
- a User
object.command
- a String
object.String
object.IOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public String getContactServiceProvider(String userID, String command) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
userID
- the name of the usercommand
- the command to look up the contact info forIOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public String getContactServiceProvider(User user, String command) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
getContactServiceProvider
user
- a User
object.command
- a String
object.String
object.IOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public String getEmail(String userID) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
userID
- the user ID of the user to returnIOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public String getEmail(User user) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
user
- the user to find the email forIOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public String getPagerEmail(String userID) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
userID
- the user ID of the user to returnIOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public String getPagerEmail(User user) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
user
- a User
object.IOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public String getNumericPin(String userID) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
userID
- the user ID of the user to returnIOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public String getNumericPin(User user) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
user
- a User
object.IOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public String getXMPPAddress(String userID) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
userID
- the user ID of the user to returnIOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public String getXMPPAddress(User user) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
user
- a User
object.IOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public String getNumericPage(String userID) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
userID
- the user ID of the user to returnIOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public String getNumericPage(User user) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
user
- a User
object.IOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public String getTextPin(String userID) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
userID
- the user ID of the user to returnIOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public String getTextPin(User user) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
user
- a User
object.IOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public String getTextPage(String userID) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
userID
- the user ID of the user to returnIOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public String getTextPage(User user) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
user
- a User
object.IOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public String getWorkPhone(String userID) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException, IOException
userID
- the user ID of the user to returnIOException
- if any.org.exolab.castor.xml.ValidationException
- if any.org.exolab.castor.xml.MarshalException
- if any.public String getWorkPhone(User user) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException, IOException
user
- a User
object.IOException
- if any.org.exolab.castor.xml.ValidationException
- if any.org.exolab.castor.xml.MarshalException
- if any.public String getMobilePhone(String userID) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException, IOException
userID
- the user ID of the user to returnIOException
- if any.org.exolab.castor.xml.ValidationException
- if any.org.exolab.castor.xml.MarshalException
- if any.public String getMobilePhone(User user) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException, IOException
user
- a User
object.IOException
- if any.org.exolab.castor.xml.ValidationException
- if any.org.exolab.castor.xml.MarshalException
- if any.public String getHomePhone(String userID) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException, IOException
userID
- the user ID of the user to returnIOException
- if any.org.exolab.castor.xml.ValidationException
- if any.org.exolab.castor.xml.MarshalException
- if any.public String getHomePhone(User user) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException, IOException
user
- a User
object.IOException
- if any.org.exolab.castor.xml.ValidationException
- if any.org.exolab.castor.xml.MarshalException
- if any.public void saveUsers(Collection<User> usersList) throws Exception
saveUsers
usersList
- a Collection
object.Exception
- if any.public void deleteUser(String name) throws Exception
protected abstract void saveXML(String writerString) throws IOException
saveXML
writerString
- a String
object.IOException
- if any.public void renameUser(String oldName, String newName) throws Exception
public void setEncryptedPassword(String userID, String aPassword, boolean salted) throws Exception
userID
- the user ID to change the password foraPassword
- the encrypted passwordException
- if any.public void setUnencryptedPassword(String userID, String aPassword) throws Exception
userID
- the user ID to change the password foraPassword
- the passwordException
- if any.public String encryptedPassword(String aPassword, boolean useSalt)
encryptedPassword
public boolean comparePasswords(String userID, String aPassword)
userID
- the user ID to check against.aPassword
- the password to check for equalityprotected abstract void doUpdate() throws IOException, FileNotFoundException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
update
IOException
- if any.FileNotFoundException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public final void update() throws IOException, FileNotFoundException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
IOException
FileNotFoundException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
public String[] getUsersWithRole(String roleid) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
getUsersWithRole
roleid
- a String
object.String
objects.IOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public boolean userHasRole(User user, String roleid) throws FileNotFoundException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException, IOException
userHasRole
user
- a User
object.roleid
- a String
object.FileNotFoundException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.IOException
- if any.public boolean isUserScheduledForRole(User user, String roleid, Date time) throws FileNotFoundException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException, IOException
isUserScheduledForRole
user
- a User
object.roleid
- a String
object.time
- a Date
object.FileNotFoundException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.IOException
- if any.public String[] getUsersScheduledForRole(String roleid, Date time) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException, IOException
getUsersScheduledForRole
roleid
- a String
object.time
- a Date
object.String
objects.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.IOException
- if any.public boolean hasRole(String roleid) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException, IOException
hasRole
roleid
- a String
object.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.IOException
- if any.public int countUsersWithRole(String roleid) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException, IOException
countUsersWithRole
roleid
- a String
object.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.IOException
- if any.public abstract boolean isUpdateNeeded()
public abstract long getLastModified()
public abstract long getFileSize()
public abstract void reload() throws IOException, FileNotFoundException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
IOException
FileNotFoundException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
Copyright © 2015. All Rights Reserved.