Interface UserService
-
- All Known Implementing Classes:
UserServiceImpl
public interface UserService
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description User
changePassword(String username, String current, String newPassword)
User changes passwordUser
createUser(User user)
Map<String,String>
deleteUserProperties(String siteId, List<String> propertiesToDelete)
Delete properties for the given site & current uservoid
deleteUsers(List<Long> userIds, List<String> usernames)
List<User>
enableUsers(List<Long> userIds, List<String> usernames, boolean enabled)
boolean
forgotPassword(String username)
Forgot password feature for given usernameList<User>
getAllUsers(String keyword, int offset, int limit, String sort)
Get paginated list of all users filtered by keywordList<User>
getAllUsersForSite(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 keywordAuthenticatedUser
getCurrentUser()
List<String>
getCurrentUserGlobalPermissions()
Get global permissions of the current authenticated userList<String>
getCurrentUserSitePermissions(String site)
Get permissions of the current authenticated user for given siteList<String>
getCurrentUserSiteRoles(String site)
List<Site>
getCurrentUserSites()
User
getUserByIdOrUsername(long userId, String username)
Map<String,Map<String,String>>
getUserProperties(String siteId)
Get the properties for the given site & the current userList<String>
getUserSiteRoles(long userId, String username, String site)
List<Site>
getUserSites(long userId, String username)
Map<String,Boolean>
hasCurrentUserGlobalPermissions(List<String> permissions)
Check if the current authenticated user has given global permissionsMap<String,Boolean>
hasCurrentUserSitePermissions(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 passwordUser
setPassword(String token, String newPassword)
Set user password - forgot password tokenvoid
updateUser(User user)
Map<String,String>
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 Detail
-
getAllUsersForSite
List<User> 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<User> 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
int getAllUsersForSiteTotal(long orgId, String site, String keyword) throws ServiceLayerException
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
int getAllUsersTotal(String keyword) throws ServiceLayerException
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
User 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<User> 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<String> getUserSiteRoles(long userId, String username, String site) throws ServiceLayerException, UserNotFoundException
-
getCurrentUser
AuthenticatedUser getCurrentUser() throws AuthenticationException, ServiceLayerException
-
getCurrentUserSites
List<Site> getCurrentUserSites() throws AuthenticationException, ServiceLayerException
-
getCurrentUserSiteRoles
List<String> getCurrentUserSiteRoles(String site) throws AuthenticationException, ServiceLayerException
-
forgotPassword
boolean forgotPassword(String username) throws ServiceLayerException, UserNotFoundException, UserExternallyManagedException
Forgot password feature for given username- Parameters:
username
- user that forgot password- Returns:
- true if success
- Throws:
ServiceLayerException
- general service errorUserNotFoundException
- user not foundUserExternallyManagedException
- user is externally managed
-
changePassword
User 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
User 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
Map<String,Map<String,String>> getUserProperties(String siteId) throws ServiceLayerException
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 ServiceLayerException
Update 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, ExecutionException
Get 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
-
-