public abstract class UserManager extends Object implements UserConfig
Abstract UserManager class.
UserConfig.ContactType| Modifier and Type | Field and Description |
|---|---|
static String |
ALLOW_UNSALTED_PROPERTY |
protected Map<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)
checkSaltedPassword
|
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(String userId,
UserConfig.ContactType contactType)
getContactInfo
|
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)
getOnmsUser
|
OnmsUserList |
getOnmsUserList()
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 |
hasOnCallRole(String roleid)
hasOnCallRole
|
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 onmsUser)
save
|
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 |
setContactInfo(String userId,
UserConfig.ContactType contactType,
String contactValue)
setContactInfo
|
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()
update
|
boolean |
userHasRole(User user,
String roleid)
userHasRole
|
public static final String ALLOW_UNSALTED_PROPERTY
protected GroupManager m_groupManager
protected Map<String,List<DutySchedule>> m_dutySchedules
protected UserManager(GroupManager groupManager)
Constructor for UserManager.
groupManager - a GroupManager object.public void parseXML(InputStream in)
parseXML
parseXML in interface UserConfigin - a InputStream object.public void saveUser(String name, User details) throws Exception
saveUser in interface UserConfigname - a String object.details - a User object.Exception - if any.public void save(OnmsUser onmsUser) throws Exception
UserConfigsave
save in interface UserConfigExceptionpublic boolean isUserOnDuty(String user, Calendar time) throws IOException
isUserOnDuty in interface UserConfiguser - the user idtime - the time to check for a duty scheduleIOException - if any.public Map<String,User> getUsers() throws IOException
Map of usernames to user instances.getUsers in interface UserConfigMap object.IOException - if any.public OnmsUserList getOnmsUserList() throws IOException
UserConfiggetOnmsUserList
getOnmsUserList in interface UserConfigIOExceptionpublic OnmsUser getOnmsUser(String username) throws IOException
UserConfiggetOnmsUser
getOnmsUser in interface UserConfigIOExceptionpublic boolean hasUser(String userName) throws IOException
hasUser in interface UserConfiguserName - a String object.IOException - if any.public List<String> getUserNames() throws IOException
getUserNames
getUserNames in interface UserConfigList object.IOException - if any.public User getUser(String name) throws IOException
getUser in interface UserConfigname - the name of the user to returnIOException - if any.public String getTuiPin(String name) throws IOException
getTuiPin in interface UserConfigname - the name of the user to returnIOException - if any.public String getTuiPin(User user) throws IOException
getTuiPin in interface UserConfiguser - a User object.IOException - if any.public String getMicroblogName(String name) throws FileNotFoundException, IOException
getMicroblogName in interface UserConfigname - the username of the user whose microblog username should be returnedIOException - if any.FileNotFoundException - if any.public String getMicroblogName(User user) throws FileNotFoundException, IOException
user - the user object of the user whose microblog username should be returnedIOException - if any.FileNotFoundException - if any.public void setContactInfo(String userId, UserConfig.ContactType contactType, String contactValue) throws Exception
UserConfigsetContactInfo
setContactInfo in interface UserConfigExceptionpublic String getContactInfo(String userId, UserConfig.ContactType contactType) throws IOException
UserConfiggetContactInfo
getContactInfo in interface UserConfigIOException#getContactInfo(String, String)}public String getContactInfo(String userID, String command) throws IOException
getContactInfo in interface UserConfiguserID - the name of the usercommand - the command to look up the contact info forIOException - if any.public String getContactInfo(User user, String command) throws IOException
getContactInfo
getContactInfo in interface UserConfiguser - a User object.command - a String object.String object.IOException - if any.public String getContactServiceProvider(String userID, String command) throws IOException
getContactServiceProvider in interface UserConfiguserID - the name of the usercommand - the command to look up the contact info forIOException - if any.public String getContactServiceProvider(User user, String command) throws IOException
getContactServiceProvider
getContactServiceProvider in interface UserConfiguser - a User object.command - a String object.String object.IOException - if any.public String getEmail(String userID) throws IOException
getEmail in interface UserConfiguserID - the user ID of the user to returnIOException - if any.public String getEmail(User user) throws IOException
getEmail in interface UserConfiguser - the user to find the email forIOException - if any.public String getPagerEmail(String userID) throws IOException
getPagerEmail in interface UserConfiguserID - the user ID of the user to returnIOException - if any.public String getPagerEmail(User user) throws IOException
getPagerEmail in interface UserConfiguser - a User object.IOException - if any.public String getNumericPin(String userID) throws IOException
getNumericPin in interface UserConfiguserID - the user ID of the user to returnIOException - if any.public String getNumericPin(User user) throws IOException
getNumericPin in interface UserConfiguser - a User object.IOException - if any.public String getXMPPAddress(String userID) throws IOException
getXMPPAddress in interface UserConfiguserID - the user ID of the user to returnIOException - if any.public String getXMPPAddress(User user) throws IOException
getXMPPAddress in interface UserConfiguser - a User object.IOException - if any.public String getNumericPage(String userID) throws IOException
getNumericPage in interface UserConfiguserID - the user ID of the user to returnIOException - if any.public String getNumericPage(User user) throws IOException
getNumericPage in interface UserConfiguser - a User object.IOException - if any.public String getTextPin(String userID) throws IOException
getTextPin in interface UserConfiguserID - the user ID of the user to returnIOException - if any.public String getTextPin(User user) throws IOException
getTextPin in interface UserConfiguser - a User object.IOException - if any.public String getTextPage(String userID) throws IOException
getTextPage in interface UserConfiguserID - the user ID of the user to returnIOException - if any.public String getTextPage(User user) throws IOException
getTextPage in interface UserConfiguser - a User object.IOException - if any.public String getWorkPhone(String userID) throws IOException
getWorkPhone in interface UserConfiguserID - the user ID of the user to returnIOException - if any.public String getWorkPhone(User user) throws IOException
getWorkPhone in interface UserConfiguser - a User object.IOException - if any.public String getMobilePhone(String userID) throws IOException
getMobilePhone in interface UserConfiguserID - the user ID of the user to returnIOException - if any.public String getMobilePhone(User user) throws IOException
getMobilePhone in interface UserConfiguser - a User object.IOException - if any.public String getHomePhone(String userID) throws IOException
getHomePhone in interface UserConfiguserID - the user ID of the user to returnIOException - if any.public String getHomePhone(User user) throws IOException
getHomePhone in interface UserConfiguser - a User object.IOException - if any.public void saveUsers(Collection<User> usersList) throws Exception
saveUsers
saveUsers in interface UserConfigusersList - a Collection object.Exception - if any.public void deleteUser(String name) throws Exception
deleteUser in interface UserConfigname - a String object.Exception - if any.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
renameUser in interface UserConfigoldName - a String object.newName - a String object.Exception - if any.public void setEncryptedPassword(String userID, String aPassword, boolean salted) throws Exception
setEncryptedPassword in interface UserConfiguserID - the user ID to change the password foraPassword - the encrypted passwordException - if any.public void setUnencryptedPassword(String userID, String aPassword) throws Exception
setUnencryptedPassword in interface UserConfiguserID - the user ID to change the password foraPassword - the passwordException - if any.public String encryptedPassword(String aPassword, boolean useSalt)
encryptedPassword
encryptedPassword in interface UserConfigaPassword - a String object.useSalt - TODOString object.public boolean comparePasswords(String userID, String aPassword)
comparePasswords in interface UserConfiguserID - the user ID to check against.aPassword - the password to check for equalitypublic boolean checkSaltedPassword(String raw, String encrypted)
UserConfigcheckSaltedPassword
checkSaltedPassword in interface UserConfigprotected abstract void doUpdate()
throws IOException,
FileNotFoundException
update
IOException - if any.FileNotFoundException - if any.public final void update()
throws IOException,
FileNotFoundException
UserConfigupdate
update in interface UserConfigIOExceptionFileNotFoundExceptionpublic String[] getUsersWithRole(String roleid) throws IOException
getUsersWithRole
getUsersWithRole in interface UserConfigroleid - a String object.String objects.IOException - if any.public boolean userHasRole(User user, String roleid) throws FileNotFoundException, IOException
userHasRole
userHasRole in interface UserConfiguser - a User object.roleid - a String object.FileNotFoundException - if any.IOException - if any.public boolean isUserScheduledForRole(User user, String roleid, Date time) throws FileNotFoundException, IOException
isUserScheduledForRole
isUserScheduledForRole in interface UserConfiguser - a User object.roleid - a String object.time - a Date object.FileNotFoundException - if any.IOException - if any.public String[] getUsersScheduledForRole(String roleid, Date time) throws IOException
getUsersScheduledForRole
getUsersScheduledForRole in interface UserConfigroleid - a String object.time - a Date object.String objects.IOException - if any.public boolean hasOnCallRole(String roleid) throws IOException
hasOnCallRole
hasOnCallRole in interface UserConfigroleid - a String object.IOException - if any.public int countUsersWithRole(String roleid) throws IOException
countUsersWithRole
countUsersWithRole in interface UserConfigroleid - a String object.IOException - if any.public abstract boolean isUpdateNeeded()
public abstract long getLastModified()
public abstract long getFileSize()
public abstract void reload()
throws IOException,
FileNotFoundException
IOExceptionFileNotFoundExceptionCopyright © 2022. All rights reserved.