Interface UserServiceInternal
- All Known Implementing Classes:
UserServiceInternalImpl
public interface UserServiceInternal
-
Method Summary
Modifier and TypeMethodDescriptionbooleanchangePassword(String username, String current, String newPassword) createUser(User user) deleteUserProperties(String siteId, List<String> propertiesToDelete) Delete properties for the given site & current uservoiddeleteUsers(List<Long> userIds, List<String> usernames) enableUsers(List<Long> userIds, List<String> usernames, boolean enabled) getAllUsers(String keyword, int offset, int limit, String sort) Get paginated list of all users filtered by keywordgetAllUsersForSite(long orgId, List<String> groupNames, String keyword, int offset, int limit, String sort) Get paginated list of all users for site filtered by keywordintgetAllUsersForSiteTotal(long orgId, String siteId, String keyword) Get total number of users for site filtered by keywordintgetAllUsersTotal(String keyword) Get total number of users filtered by keywordReturns the current authenticated usergetUserByGitName(String gitName) Get user by git name.getUserByIdOrUsername(long userId, String username) getUserGroups(long userId, String username) getUserProperties(String siteId) Get the properties for the given site & the current usergetUsersByIdOrUsername(List<Long> userIds, List<String> usernames) booleanisSystemAdmin(String username) Check if given user has system_admin rolebooleanisUserMemberOfGroup(String username, String groupName) booleansetUserPassword(String username, String newPassword) voidupdateUser(User user) updateUserProperties(String siteId, Map<String, String> propertiesToUpdate) Update or add properties for the given site & the current userbooleanuserExists(long userId, String username)
-
Method Details
-
getUserByIdOrUsername
@NonNull User getUserByIdOrUsername(long userId, String username) throws UserNotFoundException, ServiceLayerException -
getUsersByIdOrUsername
List<User> getUsersByIdOrUsername(List<Long> userIds, List<String> usernames) throws ServiceLayerException, UserNotFoundException -
getAllUsersForSite
List<User> getAllUsersForSite(long orgId, List<String> groupNames, String keyword, int offset, int limit, String sort) throws ServiceLayerException Get paginated list of all users for site filtered by keyword- Parameters:
orgId- organization identifiergroupNames- group names for sitekeyword- keyword to filter usersoffset- pagination offsetlimit- 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 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 identifiersiteId- 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
-
userExists
- Throws:
ServiceLayerException
-
updateUser
-
deleteUsers
void deleteUsers(List<Long> userIds, List<String> usernames) throws UserNotFoundException, ServiceLayerException -
enableUsers
List<User> enableUsers(List<Long> userIds, List<String> usernames, boolean enabled) throws UserNotFoundException, ServiceLayerException -
getUserGroups
List<Group> getUserGroups(long userId, String username) throws UserNotFoundException, ServiceLayerException -
isUserMemberOfGroup
boolean isUserMemberOfGroup(String username, String groupName) throws UserNotFoundException, ServiceLayerException -
changePassword
boolean changePassword(String username, String current, String newPassword) throws PasswordDoesNotMatchException, UserExternallyManagedException, ServiceLayerException -
setUserPassword
boolean setUserPassword(String username, String newPassword) throws UserNotFoundException, ServiceLayerException -
getUserByGitName
Get user by git name. Special use case because git stores user as string of first and last name separated by ' '- Parameters:
gitName- first and last name separated with ' '- Returns:
- user
- Throws:
ServiceLayerExceptionUserNotFoundException
-
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
-
getCurrentUser
Returns the current authenticated user- Returns:
- the user if present
- Throws:
AuthenticationException- if there is no user authenticated
-
isSystemAdmin
Check if given user has system_admin role- Parameters:
username- user- Returns:
- true if user is system_admin, false otherwise
-