|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openmrs.api.impl.BaseOpenmrsService org.openmrs.api.impl.UserServiceImpl
public class UserServiceImpl
Default implementation of the user service. This class should not be used on its own. The current OpenMRS implementation should be fetched from the Context
UserService
,
Context
Field Summary | |
---|---|
protected UserDAO |
dao
|
Constructor Summary | |
---|---|
UserServiceImpl()
|
Method Summary | |
---|---|
void |
changeHashedPassword(User user,
java.lang.String hashedPassword,
java.lang.String salt)
Changes the current user's password directly. |
void |
changePassword(java.lang.String pw,
java.lang.String pw2)
Changes the current user's password. |
void |
changePassword(User u,
java.lang.String pw)
Changes the user |
void |
changeQuestionAnswer(java.lang.String pw,
java.lang.String q,
java.lang.String a)
Changes the current user's secret question and answer. |
void |
changeQuestionAnswer(User u,
java.lang.String question,
java.lang.String answer)
Changes the passed user's secret question and answer. |
User |
createUser(User user,
java.lang.String password)
Deprecated. |
void |
deleteUser(User user)
Deprecated. |
java.util.List<User> |
findUsers(java.lang.String name,
java.util.List<java.lang.String> roles,
boolean includeVoided)
Deprecated. |
java.util.List<User> |
findUsers(java.lang.String givenName,
java.lang.String familyName,
boolean includeVoided)
Deprecated. |
java.lang.String |
generateSystemId()
Generates system ids based on the following algorithm scheme: user_id-check digit |
java.util.List<Privilege> |
getAllPrivileges()
Returns all privileges currently possible for any User |
java.util.List<Role> |
getAllRoles()
Returns all roles currently possible for any User |
java.util.List<User> |
getAllUsers()
Returns all users in the system |
java.util.List<User> |
getAllUsers(java.util.List<Role> roles,
boolean includeVoided)
Deprecated. |
java.util.List<Role> |
getInheritingRoles(Role role)
Deprecated. |
Privilege |
getPrivilege(java.lang.String p)
Returns Privilege in the system with given String privilege |
Privilege |
getPrivilegeByUuid(java.lang.String uuid)
Get Privilege by its UUID |
java.util.List<Privilege> |
getPrivileges()
Deprecated. |
Role |
getRole(java.lang.String r)
Returns role object with given string role |
Role |
getRoleByUuid(java.lang.String uuid)
Get Role by its UUID |
java.util.List<Role> |
getRoles()
Deprecated. |
User |
getUser(java.lang.Integer userId)
Get user by internal user identifier. |
User |
getUserByUsername(java.lang.String username)
Get user by username (user's login identifier) |
User |
getUserByUuid(java.lang.String uuid)
Get user by the given uuid. |
java.util.List<User> |
getUsers()
Deprecated. |
java.util.List<User> |
getUsers(java.lang.String nameSearch,
java.util.List<Role> roles,
boolean includeVoided)
Return a user if any part of the search matches first/last/system id and the user has one at least one of the given roles assigned to them |
java.util.List<User> |
getUsersByName(java.lang.String givenName,
java.lang.String familyName,
boolean includeVoided)
Search for a list of users by exact first name and last name. |
java.util.List<User> |
getUsersByPerson(Person person,
boolean includeRetired)
Get all user accounts that belong to a given person. |
java.util.List<User> |
getUsersByRole(Role role)
Get users by role granted |
void |
grantUserRole(User user,
Role role)
Deprecated. |
boolean |
hasDuplicateUsername(User user)
true/false if username or systemId is already in db in username or system_id columns |
boolean |
isSecretAnswer(User u,
java.lang.String answer)
Compares answer against the user 's secret answer. |
void |
purgePrivilege(Privilege privilege)
Completely remove a privilege from the database |
void |
purgeRole(Role role)
Complete remove a role from the database |
void |
purgeUser(User user)
Completely remove a location from the database (not reversible). |
void |
purgeUser(User user,
boolean cascade)
Completely remove a user from the database (not reversible). |
User |
removeUserProperty(User user,
java.lang.String key)
Removes the property denoted by key from the user 's properties. |
User |
retireUser(User user,
java.lang.String reason)
Deactive a user account so that it can no longer log in. |
void |
revokeUserRole(User user,
Role role)
Deprecated. |
Privilege |
savePrivilege(Privilege privilege)
Save the given privilege in the database |
Role |
saveRole(Role role)
Save the given role in the database |
User |
saveUser(User user,
java.lang.String password)
Saves a user to the database. |
void |
setUserDAO(UserDAO dao)
|
User |
setUserProperty(User user,
java.lang.String key,
java.lang.String value)
Adds the key /value pair to the given user . |
User |
unretireUser(User user)
Clears retired flag for a user. |
User |
unvoidUser(User user)
Clear voided flag for user (equivalent to an "undelete" or Lazarus Effect for user) |
void |
updateUser(User user)
Deprecated. replaced by saveUser(User, String) |
User |
voidUser(User user,
java.lang.String reason)
Mark user as voided (effectively deleting user without removing their data — since anything the user touched in the database will still have their internal identifier and point to the voided user for historical tracking purposes. |
Methods inherited from class org.openmrs.api.impl.BaseOpenmrsService |
---|
onShutdown, onStartup |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.openmrs.api.OpenmrsService |
---|
onShutdown, onStartup |
Field Detail |
---|
protected UserDAO dao
Constructor Detail |
---|
public UserServiceImpl()
Method Detail |
---|
public void setUserDAO(UserDAO dao)
public User createUser(User user, java.lang.String password) throws APIException
createUser
in interface UserService
APIException
UserService.createUser(org.openmrs.User, java.lang.String)
public User saveUser(User user, java.lang.String password) throws APIException
UserService
saveUser
in interface UserService
APIException
UserService.saveUser(org.openmrs.User, java.lang.String)
public User getUser(java.lang.Integer userId) throws APIException
UserService
getUser
in interface UserService
userId
- internal identifier
APIException
UserService.getUser(java.lang.Integer)
public User getUserByUsername(java.lang.String username) throws APIException
UserService
getUserByUsername
in interface UserService
username
- user's identifier used for authentication
APIException
UserService.getUserByUsername(java.lang.String)
public boolean hasDuplicateUsername(User user) throws APIException
UserService
hasDuplicateUsername
in interface UserService
user
- User to compare
APIException
UserService.hasDuplicateUsername(org.openmrs.User)
public java.util.List<User> getUsersByRole(Role role) throws APIException
UserService
getUsersByRole
in interface UserService
role
- Role that the Users must have to be returned
APIException
UserService.getUsersByRole(org.openmrs.Role)
public void updateUser(User user) throws APIException
saveUser(User, String)
UserService
user
to the database.
updateUser
in interface UserService
APIException
UserService.updateUser(org.openmrs.User)
public void grantUserRole(User user, Role role) throws APIException
UserService
grantUserRole
in interface UserService
APIException
UserService.grantUserRole(org.openmrs.User, org.openmrs.Role)
public void revokeUserRole(User user, Role role) throws APIException
UserService
revokeUserRole
in interface UserService
APIException
UserService.revokeUserRole(org.openmrs.User, org.openmrs.Role)
public User voidUser(User user, java.lang.String reason) throws APIException
UserService
voidUser
in interface UserService
APIException
UserService.voidUser(org.openmrs.User, java.lang.String)
public User retireUser(User user, java.lang.String reason) throws APIException
UserService
retireUser
in interface UserService
APIException
UserService.retireUser(org.openmrs.User, java.lang.String)
public User unvoidUser(User user) throws APIException
UserService
unvoidUser
in interface UserService
APIException
UserService.unvoidUser(org.openmrs.User)
public User unretireUser(User user) throws APIException
UserService
unretireUser
in interface UserService
APIException
UserService.unretireUser(org.openmrs.User)
public void deleteUser(User user) throws APIException
deleteUser
in interface UserService
APIException
UserService.deleteUser(org.openmrs.User)
public java.util.List<User> getUsers() throws APIException
getUsers
in interface UserService
APIException
UserService.getUsers()
public java.util.List<User> getAllUsers() throws APIException
UserService
getAllUsers
in interface UserService
APIException
UserService.getAllUsers()
public java.util.List<Privilege> getPrivileges() throws APIException
getPrivileges
in interface UserService
APIException
UserService.getPrivileges()
public java.util.List<Privilege> getAllPrivileges() throws APIException
UserService
getAllPrivileges
in interface UserService
APIException
UserService.getAllPrivileges()
public Privilege getPrivilege(java.lang.String p) throws APIException
UserService
getPrivilege
in interface UserService
APIException
UserService.getPrivilege(java.lang.String)
public void purgePrivilege(Privilege privilege) throws APIException
UserService
purgePrivilege
in interface UserService
privilege
- Privilege to delete
APIException
UserService.purgePrivilege(org.openmrs.Privilege)
public Privilege savePrivilege(Privilege privilege) throws APIException
UserService
savePrivilege
in interface UserService
privilege
- Privilege to update
APIException
UserService.savePrivilege(org.openmrs.Privilege)
public java.util.List<Role> getRoles() throws APIException
getRoles
in interface UserService
APIException
UserService.getRoles()
public java.util.List<Role> getAllRoles() throws APIException
UserService
getAllRoles
in interface UserService
APIException
UserService.getAllRoles()
public java.util.List<Role> getInheritingRoles(Role role) throws APIException
getInheritingRoles
in interface UserService
APIException
UserService.getInheritingRoles(org.openmrs.Role)
public Role getRole(java.lang.String r) throws APIException
UserService
getRole
in interface UserService
APIException
UserService.getRole(java.lang.String)
public void purgeRole(Role role) throws APIException
UserService
purgeRole
in interface UserService
role
- Role to delete from the database
APIException
UserService.purgeRole(org.openmrs.Role)
public Role saveRole(Role role) throws APIException
UserService
saveRole
in interface UserService
role
- Role to update
APIException
UserService.saveRole(org.openmrs.Role)
public void changePassword(User u, java.lang.String pw) throws APIException
UserService
user's password
** Restricted to Super User access**
- Specified by:
changePassword
in interface UserService
- Parameters:
u
- userpw
- new password
- Throws:
APIException
- See Also:
UserService.changePassword(org.openmrs.User, java.lang.String)
public void changePassword(java.lang.String pw, java.lang.String pw2) throws APIException
UserService
changePassword
in interface UserService
pw
- current passwordpw2
- new password
APIException
UserService.changePassword(java.lang.String, java.lang.String)
public void changeHashedPassword(User user, java.lang.String hashedPassword, java.lang.String salt) throws APIException
UserService
changeHashedPassword
in interface UserService
user
- the user whose password you want to changehashedPassword
- - the already hashed password to storesalt
- - the salt which should be used with this hashed password
APIException
UserService.changeHashedPassword(User, String, String)
public void changeQuestionAnswer(User u, java.lang.String question, java.lang.String answer) throws APIException
UserService
changeQuestionAnswer
in interface UserService
u
- User to change
APIException
UserService.changeQuestionAnswer(User, String, String)
public void changeQuestionAnswer(java.lang.String pw, java.lang.String q, java.lang.String a)
UserService
changeQuestionAnswer
in interface UserService
pw
- user's passwordq
- questiona
- answerUserService.changeQuestionAnswer(java.lang.String, java.lang.String,
java.lang.String)
public boolean isSecretAnswer(User u, java.lang.String answer)
UserService
answer
against the user
's secret answer.
isSecretAnswer
in interface UserService
u
- userUserService.isSecretAnswer(org.openmrs.User, java.lang.String)
public java.util.List<User> findUsers(java.lang.String name, java.util.List<java.lang.String> roles, boolean includeVoided)
findUsers
in interface UserService
UserService.findUsers(String, List, boolean)
public java.util.List<User> findUsers(java.lang.String givenName, java.lang.String familyName, boolean includeVoided)
findUsers
in interface UserService
UserService.findUsers(String, String, boolean)
public java.util.List<User> getUsersByName(java.lang.String givenName, java.lang.String familyName, boolean includeVoided) throws APIException
UserService
getUsersByName
in interface UserService
APIException
UserService.getUsersByName(java.lang.String, java.lang.String, boolean)
public java.util.List<User> getUsersByPerson(Person person, boolean includeRetired) throws APIException
UserService
getUsersByPerson
in interface UserService
APIException
UserService.getUsersByPerson(org.openmrs.Person, boolean)
public java.util.List<User> getAllUsers(java.util.List<Role> roles, boolean includeVoided)
getAllUsers
in interface UserService
UserService.getAllUsers(List, boolean)
public java.util.List<User> getUsers(java.lang.String nameSearch, java.util.List<Role> roles, boolean includeVoided) throws APIException
UserService
roles
assigned to them
getUsers
in interface UserService
nameSearch
- string to compare to the beginning of user's given/middle/family/family2
namesroles
- all the Roles the user must containincludeVoided
- true/false whether to include voided users
APIException
UserService.getUsers(java.lang.String, java.util.List, boolean)
public User setUserProperty(User user, java.lang.String key, java.lang.String value)
UserService
key
/value
pair to the given user
.
Implementations of this method should handle privileges
setUserProperty
in interface UserService
UserService.setUserProperty(User, String, String)
public User removeUserProperty(User user, java.lang.String key)
UserService
key
from the user
's properties.
Implementations of this method should handle privileges
removeUserProperty
in interface UserService
UserService.removeUserProperty(org.openmrs.User, java.lang.String)
public java.lang.String generateSystemId()
generateSystemId
in interface UserService
UserService.generateSystemId()
public void purgeUser(User user) throws APIException
UserService
purgeUser
in interface UserService
user
- the User to remove from the database.
APIException
UserService.purgeUser(org.openmrs.User)
public void purgeUser(User user, boolean cascade) throws APIException
UserService
Users
should be
voided and not deleted altogether (since many foreign key constraints
depend on users, deleting a user would require deleting all traces, and any historical trail
would be lost). This method only clears user roles and attempts to delete the user record. If
the user has been included in any other parts of the database (through a foreign key), the
attempt to delete the user will violate foreign key constraints and fail.
purgeUser
in interface UserService
cascade
- true
to delete associated content
APIException
UserService.purgeUser(org.openmrs.User, boolean)
public Privilege getPrivilegeByUuid(java.lang.String uuid) throws APIException
UserService
getPrivilegeByUuid
in interface UserService
APIException
UserService.getPrivilegeByUuid(java.lang.String)
public Role getRoleByUuid(java.lang.String uuid) throws APIException
UserService
getRoleByUuid
in interface UserService
APIException
UserService.getRoleByUuid(java.lang.String)
public User getUserByUuid(java.lang.String uuid) throws APIException
UserService
getUserByUuid
in interface UserService
APIException
UserService.getUserByUuid(java.lang.String)
|
OpenMRS-1.7.x | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |