Interface UserService
- All Known Implementing Classes:
UserServiceImpl
public interface UserService
-
Method Summary
Modifier and TypeMethodDescriptionchangePassword
(String username, String current, String newPassword) User changes passwordcreateUser
(User user) deleteUserProperties
(String siteId, List<String> propertiesToDelete) Delete properties for the given site & current uservoid
deleteUsers
(List<Long> userIds, List<String> usernames) enableUsers
(List<Long> userIds, List<String> usernames, boolean enabled) void
forgotPassword
(String username) Forgot password feature for given usernamegetAllUsers
(String keyword, int offset, int limit, String sort) Get paginated list of all users filtered by keywordgetAllUsersForSite
(long orgId, String site, String keyword, int offset, int limit, String sort) Get paginated list of all users for site filtered by keywordint
getAllUsersForSiteTotal
(long orgId, String site, String keyword) Get total number of users for site filtered by keywordint
getAllUsersTotal
(String keyword) Get total number of users filtered by keywordGet global permissions of the current authenticated userGet permissions of the current authenticated user for given sitegetForgotPasswordToken
(String username) Get aforgot password token for given usernamegetUserByIdOrUsername
(long userId, String username) getUserProperties
(String siteId) Get the properties for the given site & the current usergetUserSiteRoles
(long userId, String username, String site) getUserSites
(long userId, String username) hasCurrentUserGlobalPermissions
(List<String> permissions) Check if the current authenticated user has given global permissionshasCurrentUserSitePermissions
(String site, List<String> permissions) Check if the current authenticated user has given permissions for given siteboolean
resetPassword
(String username, String newPassword) Admin resets the user passwordsetPassword
(String token, String newPassword) Set user password - forgot password tokenvoid
updateUser
(User user) updateUserProperties
(String siteId, Map<String, String> propertiesToUpdate) Update or add properties for the given site & the current userboolean
validateToken
(String token) Validate forgot password token
-
Method Details
-
getAllUsersForSite
List<UserResponse> getAllUsersForSite(long orgId, String site, String keyword, int offset, int limit, String sort) throws ServiceLayerException Get paginated list of all users for site filtered by keyword- Parameters:
orgId
- organization identifiersite
- site identifierkeyword
- keyword to filter usersoffset
- offset for paginationlimit
- limit number of users to return per pagesort
- sort order- Returns:
- requested page of list of users
- Throws:
ServiceLayerException
-
getAllUsers
List<UserResponse> getAllUsers(String keyword, int offset, int limit, String sort) throws ServiceLayerException Get paginated list of all users filtered by keyword- Parameters:
keyword
- keyword to filter usersoffset
- offset for paginationlimit
- limit number of users to return per pagesort
- sort order- Returns:
- requested page of list of users
- Throws:
ServiceLayerException
-
getAllUsersForSiteTotal
Get total number of users for site filtered by keyword- Parameters:
orgId
- organization identifiersite
- site identifierkeyword
- keyword to filter users- Returns:
- total number of users for site filtered by keyword
- Throws:
ServiceLayerException
-
getAllUsersTotal
Get total number of users filtered by keyword- Parameters:
keyword
- keyword to filter user- Returns:
- total number of users filtered by keyword
- Throws:
ServiceLayerException
-
createUser
UserResponse createUser(User user) throws UserAlreadyExistsException, ServiceLayerException, AuthenticationException -
updateUser
void updateUser(User user) throws ServiceLayerException, UserNotFoundException, AuthenticationException, UserExternallyManagedException -
deleteUsers
void deleteUsers(List<Long> userIds, List<String> usernames) throws ServiceLayerException, AuthenticationException, UserNotFoundException, UserExternallyManagedException -
getUserByIdOrUsername
User getUserByIdOrUsername(long userId, String username) throws ServiceLayerException, UserNotFoundException -
enableUsers
List<UserResponse> enableUsers(List<Long> userIds, List<String> usernames, boolean enabled) throws ServiceLayerException, UserNotFoundException, AuthenticationException, UserExternallyManagedException -
getUserSites
List<Site> getUserSites(long userId, String username) throws ServiceLayerException, UserNotFoundException -
getUserSiteRoles
List<NormalizedRole> getUserSiteRoles(long userId, String username, String site) throws ServiceLayerException, UserNotFoundException -
getCurrentUser
-
getCurrentUserSites
-
getCurrentUserSiteRoles
List<String> getCurrentUserSiteRoles(String site) throws AuthenticationException, ServiceLayerException -
forgotPassword
Forgot password feature for given username- Parameters:
username
- user that forgot password- Throws:
ServiceLayerException
- general service error
-
getForgotPasswordToken
Get aforgot password token for given username- Parameters:
username
-- Returns:
-
changePassword
UserResponse changePassword(String username, String current, String newPassword) throws PasswordDoesNotMatchException, UserExternallyManagedException, ServiceLayerException, AuthenticationException, UserNotFoundException User changes password- Parameters:
username
- usernamecurrent
- current passwordnewPassword
- new password- Returns:
- user whose password is successfully changed
- Throws:
PasswordDoesNotMatchException
- password does not match with storedUserExternallyManagedException
- user is externally managedServiceLayerException
- general service errorAuthenticationException
- authentication errorUserNotFoundException
- user not found
-
setPassword
UserResponse setPassword(String token, String newPassword) throws UserNotFoundException, UserExternallyManagedException, ServiceLayerException Set user password - forgot password token- Parameters:
token
- forgot password tokennewPassword
- new password- Returns:
- uses whose password is successfully set
- Throws:
UserNotFoundException
- user not foundUserExternallyManagedException
- user is externally managedServiceLayerException
- general service error
-
resetPassword
boolean resetPassword(String username, String newPassword) throws UserNotFoundException, UserExternallyManagedException, ServiceLayerException Admin resets the user password- Parameters:
username
- usernamenewPassword
- new password- Returns:
- true if user's password is successfully reset
- Throws:
UserNotFoundException
- user not foundUserExternallyManagedException
- user is externally managedServiceLayerException
- general service error
-
validateToken
boolean validateToken(String token) throws UserNotFoundException, UserExternallyManagedException, ServiceLayerException Validate forgot password token- Parameters:
token
- forgot password token to validate- Returns:
- true if token is valid otherwise false
- Throws:
UserNotFoundException
- user not foundUserExternallyManagedException
- user is externally managedServiceLayerException
- general service error
-
getUserProperties
Get the properties for the given site & the current user- Parameters:
siteId
- the id of the site- Returns:
- the current properties
- Throws:
ServiceLayerException
- if there is any error fetching the properties
-
updateUserProperties
Map<String,String> updateUserProperties(String siteId, Map<String, String> propertiesToUpdate) throws ServiceLayerExceptionUpdate or add properties for the given site & the current user- Parameters:
siteId
- the id of the sitepropertiesToUpdate
- the properties to update or add- Returns:
- the updated properties
- Throws:
ServiceLayerException
- if there is any error updating or fetching the properties
-
deleteUserProperties
Map<String,String> deleteUserProperties(String siteId, List<String> propertiesToDelete) throws ServiceLayerException Delete properties for the given site & current user- Parameters:
siteId
- the id of the sitepropertiesToDelete
- the list of keys to delete- Returns:
- the updated properties
- Throws:
ServiceLayerException
- if there is any error deleting or fetching the properties
-
getCurrentUserSitePermissions
List<String> getCurrentUserSitePermissions(String site) throws ServiceLayerException, UserNotFoundException, ExecutionException Get permissions of the current authenticated user for given site- Parameters:
site
- site identifier- Returns:
- Throws:
ServiceLayerException
UserNotFoundException
ExecutionException
-
hasCurrentUserSitePermissions
Map<String,Boolean> hasCurrentUserSitePermissions(String site, List<String> permissions) throws ServiceLayerException, UserNotFoundException, ExecutionException Check if the current authenticated user has given permissions for given site- Parameters:
site
- site identifierpermissions
- list of permissions to check- Returns:
- map with values true or false for each given permission
- Throws:
ServiceLayerException
UserNotFoundException
ExecutionException
-
getCurrentUserGlobalPermissions
List<String> getCurrentUserGlobalPermissions() throws ServiceLayerException, UserNotFoundException, ExecutionExceptionGet global permissions of the current authenticated user- Returns:
- Throws:
ServiceLayerException
UserNotFoundException
ExecutionException
-
hasCurrentUserGlobalPermissions
Map<String,Boolean> hasCurrentUserGlobalPermissions(List<String> permissions) throws ServiceLayerException, UserNotFoundException, ExecutionException Check if the current authenticated user has given global permissions- Parameters:
permissions
- list of permissions to check- Returns:
- map with values true or false for each given permission
- Throws:
ServiceLayerException
UserNotFoundException
ExecutionException
-