|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@Transactional public interface UserService
Contains methods pertaining to Users in the system Use:
List<User> users = Context.getUserService().getAllUsers();
Context
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. replaced by saveUser(User, String) |
void |
deleteUser(User user)
Deprecated. use purgeUser(User) |
java.util.List<User> |
findUsers(java.lang.String name,
java.util.List<java.lang.String> roles,
boolean includeVoided)
Deprecated. use getUsers(String, List, boolean) |
java.util.List<User> |
findUsers(java.lang.String givenName,
java.lang.String familyName,
boolean includeVoided)
Deprecated. use getUsersByName(String, String, boolean) |
java.lang.String |
generateSystemId()
Get/generate/find the next system id to be doled out. |
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. use getUsers(String, List, boolean) |
java.util.List<Role> |
getInheritingRoles(Role role)
Deprecated. use Role.getInheritedRoles() |
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. use getAllPrivileges() |
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. use getAllRoles() |
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. use getAllUsers() |
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. use User.addRole(Role) |
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. use User.removeRole(Role) |
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. |
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)
Deprecated. use unretireUser(User) |
void |
updateUser(User user)
Deprecated. replaced by saveUser(User, String) |
User |
voidUser(User user,
java.lang.String reason)
Deprecated. use retireUser(User, String) |
Methods inherited from interface org.openmrs.api.OpenmrsService |
---|
onShutdown, onStartup |
Method Detail |
---|
@Authorized(value={"Add Users","Edit Users"}) @Logging(ignoredArgumentIndexes=1) User saveUser(User user, java.lang.String password) throws APIException
user
- password
-
APIException
@Deprecated @Authorized(value="Add Users") @Logging(ignoredArgumentIndexes=1) User createUser(User user, java.lang.String password) throws APIException
saveUser(User, String)
APIException
saveUser(User, String)
@Transactional(readOnly=true) @Authorized(value="View Users") User getUser(java.lang.Integer userId) throws APIException
userId
- internal identifier
APIException
@Transactional(readOnly=true) @Authorized(value="View Users") User getUserByUuid(java.lang.String uuid) throws APIException
uuid
-
APIException
@Transactional(readOnly=true) @Authorized(value="View Users") User getUserByUsername(java.lang.String username) throws APIException
username
- user's identifier used for authentication
APIException
@Transactional(readOnly=true) @Authorized(value="View Users") boolean hasDuplicateUsername(User user) throws APIException
user
- User to compare
APIException
@Transactional(readOnly=true) @Authorized(value="View Users") java.util.List<User> getUsersByRole(Role role) throws APIException
role
- Role that the Users must have to be returned
APIException
@Deprecated @Authorized(value="Edit Users") void updateUser(User user) throws APIException
saveUser(User, String)
user
to the database.
user
-
APIException
saveUser(User, String)
@Deprecated @Authorized(value="Edit Users") void grantUserRole(User user, Role role) throws APIException
User.addRole(Role)
APIException
@Deprecated @Authorized(value="Edit Users") void revokeUserRole(User user, Role role) throws APIException
User.removeRole(Role)
APIException
@Deprecated @Authorized(value="Edit Users") User voidUser(User user, java.lang.String reason) throws APIException
retireUser(User, String)
user
- reason
-
APIException
@Deprecated @Authorized(value="Edit Users") User unvoidUser(User user) throws APIException
unretireUser(User)
user
-
APIException
@Authorized(value="Edit Users") User retireUser(User user, java.lang.String reason) throws APIException
user
- reason
-
APIException
@Authorized(value="Edit Users") User unretireUser(User user) throws APIException
user
- reason
-
APIException
@Deprecated @Authorized(value="Delete Users") void deleteUser(User user) throws APIException
purgeUser(User)
APIException
voidUser(User, String)
,
purgeUser(User)
@Authorized(value="Purge Users") void purgeUser(User user) throws APIException
user
- the User to remove from the database.
APIException
@Authorized(value="Purge Users") void purgeUser(User user, boolean cascade) throws APIException
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.
cascade
- true
to delete associated content
APIException
@Deprecated @Transactional(readOnly=true) java.util.List<Privilege> getPrivileges() throws APIException
getAllPrivileges()
APIException
@Transactional(readOnly=true) java.util.List<Privilege> getAllPrivileges() throws APIException
APIException
@Deprecated @Transactional(readOnly=true) java.util.List<Role> getRoles() throws APIException
getAllRoles()
APIException
@Transactional(readOnly=true) java.util.List<Role> getAllRoles() throws APIException
APIException
@Deprecated @Transactional(readOnly=true) java.util.List<Role> getInheritingRoles(Role role) throws APIException
Role.getInheritedRoles()
APIException
@Authorized(value="Manage Roles") Role saveRole(Role role) throws APIException
role
- Role to update
APIException
@Authorized(value="Purge Roles") void purgeRole(Role role) throws APIException
role
- Role to delete from the database
APIException
@Authorized(value="Manage Privileges") Privilege savePrivilege(Privilege privilege) throws APIException
privilege
- Privilege to update
APIException
@Authorized(value="Purge Privileges") void purgePrivilege(Privilege privilege) throws APIException
privilege
- Privilege to delete
APIException
@Transactional(readOnly=true) Role getRole(java.lang.String r) throws APIException
APIException
@Transactional(readOnly=true) Role getRoleByUuid(java.lang.String uuid) throws APIException
uuid
-
APIException
@Transactional(readOnly=true) Privilege getPrivilege(java.lang.String p) throws APIException
APIException
@Transactional(readOnly=true) Privilege getPrivilegeByUuid(java.lang.String uuid) throws APIException
uuid
-
APIException
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Users") java.util.List<User> getUsers() throws APIException
getAllUsers()
APIException
@Transactional(readOnly=true) @Authorized(value="View Users") java.util.List<User> getAllUsers() throws APIException
APIException
@Authorized(value="Edit User Passwords") @Logging(ignoredArgumentIndexes=1) void changePassword(User u, java.lang.String pw) throws APIException
user's password
** Restricted to Super User access**
- Parameters:
u
- userpw
- new password
- Throws:
APIException
- Expected behavior:
- change password for the given user and password
@Logging(ignoredArgumentIndexes={0,1}) void changePassword(java.lang.String pw, java.lang.String pw2) throws APIException
pw
- current passwordpw2
- new password
APIException
@Authorized(value="Edit User Passwords") void changeHashedPassword(User user, java.lang.String hashedPassword, java.lang.String salt) throws APIException
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
@Authorized(value="Edit User Passwords") @Logging(ignoredArgumentIndexes={1,2}) void changeQuestionAnswer(User u, java.lang.String question, java.lang.String answer) throws APIException
u
- User to changequestion
- answer
-
APIException
@Logging(ignoreAllArgumentValues=true) void changeQuestionAnswer(java.lang.String pw, java.lang.String q, java.lang.String a) throws APIException
pw
- user's passwordq
- questiona
- answer
APIException
@Transactional(readOnly=true) @Logging(ignoredArgumentIndexes=1) boolean isSecretAnswer(User u, java.lang.String answer) throws APIException
answer
against the user
's secret answer.
u
- useranswer
-
APIException
@Transactional(readOnly=true) @Authorized(value="View Users") java.util.List<User> getUsers(java.lang.String nameSearch, java.util.List<Role> roles, boolean includeVoided) throws APIException
roles
assigned to them
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
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Users") java.util.List<User> findUsers(java.lang.String name, java.util.List<java.lang.String> roles, boolean includeVoided) throws APIException
getUsers(String, List, boolean)
APIException
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Users") java.util.List<User> findUsers(java.lang.String givenName, java.lang.String familyName, boolean includeVoided) throws APIException
getUsersByName(String, String, boolean)
APIException
@Transactional(readOnly=true) @Authorized(value="View Users") java.util.List<User> getUsersByName(java.lang.String givenName, java.lang.String familyName, boolean includeVoided) throws APIException
givenName
- familyName
- includeVoided
-
APIException
@Transactional(readOnly=true) @Authorized(value="View Users") java.util.List<User> getUsersByPerson(Person person, boolean includeRetired) throws APIException
person
- includeRetired
-
APIException
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Users") java.util.List<User> getAllUsers(java.util.List<Role> roles, boolean includeVoided) throws APIException
getUsers(String, List, boolean)
APIException
User setUserProperty(User user, java.lang.String key, java.lang.String value) throws APIException
key
/value
pair to the given user
.
Implementations of this method should handle privileges
user
- key
- value
-
APIException
User removeUserProperty(User user, java.lang.String key) throws APIException
key
from the user
's properties.
Implementations of this method should handle privileges
user
- key
-
APIException
java.lang.String generateSystemId()
|
OpenMRS-1.7.x | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |