Class UserService
java.lang.Object
com.symphony.bdk.core.service.user.UserService
- All Implemented Interfaces:
OboService<OboUserService>
,OboUserService
@API(status=STABLE)
public class UserService
extends Object
implements OboUserService, OboService<OboUserService>
Service class for managing users.
This service is used for retrieving information about a particular user, search users by ids, emails or usernames, perform some action related to user like:
- Add or remove roles from an user
- Get or update avatar of an user
- Get, assign or unassign disclaimer to an user
- Get, update feature entitlements of an user
- Get, update status of an user
-
Constructor Summary
ConstructorDescriptionUserService
(UserApi userApi, UsersApi usersApi, AuditTrailApi auditTrailApi, AuthSession authSession, RetryWithRecoveryBuilder<?> retryBuilder) UserService
(UserApi userApi, UsersApi usersApi, AuditTrailApi auditTrailApi, RetryWithRecoveryBuilder<?> retryBuilder) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDisclaimer
(Long userId, String disclaimerId) Assign disclaimer to an user.void
Add a role to an user.create
(V2UserCreate payload) Creates a new user.void
followUser
(List<Long> followerIds, Long userId) Make a list of users to start following a specific user.Get the url of avatar of an usergetDelegates
(Long userId) Get delegates assigned to an user.getDisclaimer
(Long userId) Get disclaimer assigned to an user.getFeatureEntitlements
(Long userId) Get feature entitlements of an user.Get status of an user.getUserDetail
(Long userId) Retrieve user details of a particular user.listAllAuditTrail
(Long startTimestamp, Long endTimestamp, Long initiatorId, String role, Integer chunkSize, Integer maxItems) Returns all audit trail of actions performed by a privileged user in a given period of time.listAllUserFollowers
(Long userId) Returns theStream
of followers of a specific user with default chunk size and total size equals 100.listAllUserFollowers
(Long userId, StreamPaginationAttribute pagination) Returns theStream
of followers of a specific user.listAllUserFollowing
(Long userId) Returns aStream
of users followed by a specific user with default chunk size and total size equals 100.listAllUserFollowing
(Long userId, StreamPaginationAttribute pagination) Returns aStream
of users followed by a specific user.Retrieve all users in the company (pod) and return in aStream
with default chunk size and total size equals 100.listAllUsersDetail
(StreamPaginationAttribute pagination) Retrieve all users in the company (pod) and return in aStream
.listAllUsersDetail
(UserFilter filter) Retrieve all of users in the company (pod) by a filter and return in aStream
with default chunk size and total size equals 100.listAllUsersDetail
(UserFilter filter, StreamPaginationAttribute pagination) Retrieve all of users in the company (pod) by a filter and return in aStream
.listAuditTrail
(Long startTimestamp, Long endTimestamp, CursorPaginationAttribute pagination, Long initiatorId, String role) Returns audit trail of actions performed by a privileged user in a given period of time.List all roles in the podlistUserFollowers
(Long userId) Returns the list of followers of a specific user.listUserFollowers
(Long userId, CursorPaginationAttribute pagination) Returns the list of followers of a specific user.listUsersByEmails
(List<String> emailList) listUsersByEmails
(List<String> emailList, Boolean local, Boolean active) listUsersByIds
(List<Long> uidList) listUsersByIds
(List<Long> uidList, Boolean local, Boolean active) listUsersByUsernames
(List<String> usernameList) listUsersByUsernames
(List<String> usernameList, Boolean active) Retrieve all users in the company (pod).listUsersDetail
(PaginationAttribute pagination) Retrieve all users in the company (pod).listUsersDetail
(UserFilter filter) Retrieve a list of users in the company (pod) by a filter.listUsersDetail
(UserFilter filter, PaginationAttribute pagination) Retrieve a list of users in the company (pod) by a filter.listUsersFollowing
(Long userId) Returns the list of users followed by a specific user.listUsersFollowing
(Long userId, CursorPaginationAttribute pagination) Returns the list of users followed by a specific user.obo
(AuthSession oboSession) Returns a new service instance with OBO-enabled endpoints from a given OBO session.void
removeDisclaimer
(Long userId) Unassign disclaimer from an user.void
removeRole
(Long userId, RoleId roleId) Remove a role from an user.searchAllUsers
(UserSearchQuery query, Boolean local) searchAllUsers
(UserSearchQuery query, Boolean local, StreamPaginationAttribute pagination) searchUsers
(UserSearchQuery query, Boolean local) searchUsers
(UserSearchQuery query, Boolean local, PaginationAttribute pagination) void
suspendUser
(Long userId, String reason, Instant until) Suspends a user account.void
udpateDelegates
(Long userId, Long delegatedUserId, DelegateAction.ActionEnum actionEnum) Update delegates assigned to an user.void
unfollowUser
(List<Long> followerIds, Long userId) Make a list of users to stop following a specific user.void
unsuspendUser
(Long userId) Re-activates a user account.update
(Long userId, V2UserAttributes payload) Updates an existing uservoid
updateAvatar
(Long userId, byte[] image) Update avatar of an uservoid
updateAvatar
(Long userId, InputStream imageStream) Update avatar of an uservoid
updateAvatar
(Long userId, String image) Update avatar of an uservoid
updateFeatureEntitlements
(Long userId, List<Feature> features) Update feature entitlements of an user.void
updateStatus
(Long userId, UserStatus status) Update the status of an userMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.symphony.bdk.core.service.OboService
checkAuthSession
-
Constructor Details
-
UserService
public UserService(UserApi userApi, UsersApi usersApi, AuditTrailApi auditTrailApi, AuthSession authSession, RetryWithRecoveryBuilder<?> retryBuilder) -
UserService
public UserService(UserApi userApi, UsersApi usersApi, AuditTrailApi auditTrailApi, RetryWithRecoveryBuilder<?> retryBuilder)
-
-
Method Details
-
obo
Description copied from interface:OboService
Returns a new service instance with OBO-enabled endpoints from a given OBO session.- Specified by:
obo
in interfaceOboService<OboUserService>
- Parameters:
oboSession
- the OBO session- Returns:
- the instance of the service class with OBO-enabled endpoints
-
listUsersByIds
public List<UserV2> listUsersByIds(@Nonnull List<Long> uidList, @Nullable Boolean local, @Nullable Boolean active) - Specified by:
listUsersByIds
in interfaceOboUserService
- Parameters:
uidList
- List of user idslocal
- If true then a local DB search will be performed and only local pod users will be returned. If absent or false then a directory search will be performed and users from other pods who are visible to the calling user will also be returned.active
- If not set all user status will be returned, if true all active users will be returned, if false all inactive users will be returned- Returns:
- Users found by user ids
- See Also:
-
listUsersByIds
- Specified by:
listUsersByIds
in interfaceOboUserService
- Parameters:
uidList
- List of user ids- Returns:
- Users found by user ids
- See Also:
-
listUsersByEmails
public List<UserV2> listUsersByEmails(@Nonnull List<String> emailList, @Nullable Boolean local, @Nullable Boolean active) - Specified by:
listUsersByEmails
in interfaceOboUserService
- Parameters:
emailList
- List of emailslocal
- If true then a local DB search will be performed and only local pod users will be returned. If absent or false then a directory search will be performed and users from other pods who are visible to the calling user will also be returned.active
- If not set all user status will be returned, if true all active users will be returned, if false all inactive users will be returned- Returns:
- Users found by emails.
- See Also:
-
listUsersByEmails
- Specified by:
listUsersByEmails
in interfaceOboUserService
- Parameters:
emailList
- List of emails- Returns:
- Users found by emails
- See Also:
-
listUsersByUsernames
public List<UserV2> listUsersByUsernames(@Nonnull List<String> usernameList, @Nullable Boolean active) - Specified by:
listUsersByUsernames
in interfaceOboUserService
- Parameters:
usernameList
- List of usernamesactive
- If not set all user status will be returned, if true all active users will be returned, if false all inactive users will be returned- Returns:
- Users found by usernames
- See Also:
-
listUsersByUsernames
- Specified by:
listUsersByUsernames
in interfaceOboUserService
- Parameters:
usernameList
- List of usernames- Returns:
- Users found by usernames
- See Also:
-
searchUsers
- Specified by:
searchUsers
in interfaceOboUserService
- Parameters:
query
- Searching query containing complicated information like title, location, company...local
- If true then a local DB search will be performed and only local pod users will be returned. If absent or false then a directory search will be performed and users from other pods who are visible to the calling user will also be returned.- Returns:
- List of users found by query
- See Also:
-
searchUsers
public List<UserV2> searchUsers(@Nonnull UserSearchQuery query, @Nullable Boolean local, @Nonnull PaginationAttribute pagination) - Specified by:
searchUsers
in interfaceOboUserService
- Parameters:
query
- Searching query containing complicated information like title, location, company...local
- If true then a local DB search will be performed and only local pod users will be returned. If absent or false then a directory search will be performed and users from other pods who are visible to the calling user will also be returned.pagination
- The skip and limit for pagination.- Returns:
- List of users found by query
- See Also:
-
searchAllUsers
@API(status=EXPERIMENTAL) public Stream<UserV2> searchAllUsers(@Nonnull UserSearchQuery query, @Nullable Boolean local) - Specified by:
searchAllUsers
in interfaceOboUserService
- Parameters:
query
- Searching query containing complicated information like title, location, company...local
- If true then a local DB search will be performed and only local pod users will be returned. If absent or false then a directory search will be performed and users from other pods who are visible to the calling user will also be returned.- Returns:
- a
Stream
of users found by query - See Also:
-
searchAllUsers
@API(status=EXPERIMENTAL) public Stream<UserV2> searchAllUsers(@Nonnull UserSearchQuery query, @Nullable Boolean local, @Nonnull StreamPaginationAttribute pagination) - Specified by:
searchAllUsers
in interfaceOboUserService
- Parameters:
query
- Searching query containing complicated information like title, location, company...local
- If true then a local DB search will be performed and only local pod users will be returned. If absent or false then a directory search will be performed and users from other pods who are visible to the calling user will also be returned.pagination
- The chunkSize and totalSize for pagination.- Returns:
- a
Stream
of users found by query - See Also:
-
followUser
Make a list of users to start following a specific user.followUser(List, Long)
- Specified by:
followUser
in interfaceOboUserService
- Parameters:
followerIds
- List of ids of the followers.userId
- The id of the user to be followed.- See Also:
-
unfollowUser
Make a list of users to stop following a specific user.unfollowUser(List, Long)
- Specified by:
unfollowUser
in interfaceOboUserService
- Parameters:
followerIds
- List of the ids of the followers.userId
- The id of the user to be unfollowed.- See Also:
-
getUserDetail
Retrieve user details of a particular user.- Parameters:
userId
- User Id- Returns:
- Details of the user.
- See Also:
-
listUsersDetail
Retrieve all users in the company (pod).- Returns:
- List of retrieved users
- See Also:
-
listUsersDetail
Retrieve all users in the company (pod).- Parameters:
pagination
- The skip and limit for pagination.- Returns:
- List of retrieved users
- See Also:
-
listAllUsersDetail
Retrieve all users in the company (pod) and return in aStream
with default chunk size and total size equals 100.- Returns:
- a
Stream
of retrieved users - See Also:
-
listAllUsersDetail
@API(status=EXPERIMENTAL) public Stream<V2UserDetail> listAllUsersDetail(@Nonnull StreamPaginationAttribute pagination) Retrieve all users in the company (pod) and return in aStream
.- Parameters:
pagination
- The chunkSize and totalSize for pagination.- Returns:
- a
Stream
of retrieved users - See Also:
-
listUsersDetail
Retrieve a list of users in the company (pod) by a filter.- Parameters:
filter
- using to filter users by- Returns:
- List of retrieved users
- See Also:
-
listUsersDetail
public List<V2UserDetail> listUsersDetail(@Nonnull UserFilter filter, @Nonnull PaginationAttribute pagination) Retrieve a list of users in the company (pod) by a filter.- Parameters:
filter
- using to filter users by.pagination
- The skip and limit for pagination.- Returns:
- List of retrieved users
- See Also:
-
listAllUsersDetail
@API(status=EXPERIMENTAL) public Stream<V2UserDetail> listAllUsersDetail(@Nonnull UserFilter filter) Retrieve all of users in the company (pod) by a filter and return in aStream
with default chunk size and total size equals 100.- Parameters:
filter
- using to filter users by- Returns:
- a
Stream
of retrieved users - See Also:
-
listAllUsersDetail
@API(status=EXPERIMENTAL) public Stream<V2UserDetail> listAllUsersDetail(@Nonnull UserFilter filter, @Nonnull StreamPaginationAttribute pagination) Retrieve all of users in the company (pod) by a filter and return in aStream
.- Parameters:
filter
- using to filter users by.pagination
- The chunkSize and totalSize for pagination.- Returns:
- a
Stream
of retrieved users - See Also:
-
addRole
Add a role to an user.- Parameters:
userId
- User IdroleId
- Role Id- See Also:
-
listRoles
List all roles in the pod- Returns:
- List
RoleDetail
of all roles in the pod. - See Also:
-
removeRole
Remove a role from an user.- Parameters:
userId
- User IdroleId
- Role Id- See Also:
-
getAvatar
Get the url of avatar of an user- Parameters:
userId
- User Id- Returns:
- List of avatar urls of the user
- See Also:
-
updateAvatar
Update avatar of an user- Parameters:
userId
- User Idimage
- The avatar image for the user profile picture.The image must be a base64-encoded.- See Also:
-
updateAvatar
Update avatar of an user- Parameters:
userId
- User Idimage
- The avatar image in bytes array for the user profile picture.- See Also:
-
updateAvatar
Update avatar of an user- Parameters:
userId
- User IdimageStream
- The avatar image input stream for the user profile picture.- Throws:
IOException
- See Also:
-
getDisclaimer
Get disclaimer assigned to an user.- Parameters:
userId
- User Id- Returns:
- Disclaimer assigned to the user.
- See Also:
-
removeDisclaimer
Unassign disclaimer from an user.- Parameters:
userId
- User Id- See Also:
-
addDisclaimer
Assign disclaimer to an user.- Parameters:
userId
- User IddisclaimerId
- Disclaimer to be assigned- See Also:
-
getDelegates
Get delegates assigned to an user.- Parameters:
userId
- User Id- Returns:
- List of delegates assigned to an user.
- See Also:
-
udpateDelegates
public void udpateDelegates(@Nonnull Long userId, @Nonnull Long delegatedUserId, @Nonnull DelegateAction.ActionEnum actionEnum) Update delegates assigned to an user.- Parameters:
userId
- User IddelegatedUserId
- Delegated user Id to be assignedactionEnum
- Action to be performed- See Also:
-
getFeatureEntitlements
Get feature entitlements of an user.- Parameters:
userId
- User Id- Returns:
- List of feature entitlements of the user.
- See Also:
-
updateFeatureEntitlements
Update feature entitlements of an user.- Parameters:
userId
- User Idfeatures
- List of feature entitlements to be updated- See Also:
-
getStatus
Get status of an user.- Parameters:
userId
- User Id- Returns:
- Status of the user.
- See Also:
-
updateStatus
Update the status of an user- Parameters:
userId
- User Idstatus
- Status to be updated to the user- See Also:
-
listUserFollowers
Returns the list of followers of a specific user.- Parameters:
userId
- User Id- Returns:
- The list of followers of a specific user with the pagination information.
- See Also:
-
listUserFollowers
public FollowersListResponse listUserFollowers(@Nonnull Long userId, @Nonnull CursorPaginationAttribute pagination) Returns the list of followers of a specific user.- Parameters:
userId
- User Idpagination
- The range and limit for pagination.- Returns:
- The list of followers of a specific user with the pagination information.
- See Also:
-
listAllUserFollowers
Returns theStream
of followers of a specific user with default chunk size and total size equals 100.- Parameters:
userId
- User Id- Returns:
- The
Stream
of followers of a specific user. - See Also:
-
listAllUserFollowers
@API(status=EXPERIMENTAL) public Stream<Long> listAllUserFollowers(@Nonnull Long userId, @Nonnull StreamPaginationAttribute pagination) Returns theStream
of followers of a specific user.- Parameters:
userId
- User Idpagination
- The chunkSize and totalSize for pagination.- Returns:
- The
Stream
of followers of a specific user. - See Also:
-
listUsersFollowing
Returns the list of users followed by a specific user.- Parameters:
userId
- User Id- Returns:
- The list of users followed by a specific user with the pagination information.
- See Also:
-
listUsersFollowing
public FollowingListResponse listUsersFollowing(@Nonnull Long userId, @Nonnull CursorPaginationAttribute pagination) Returns the list of users followed by a specific user.- Parameters:
userId
- User Idpagination
- The range and limit for pagination.- Returns:
- The list of users followed by a specific user with the pagination information.
- See Also:
-
listAllUserFollowing
Returns aStream
of users followed by a specific user with default chunk size and total size equals 100.- Parameters:
userId
- User Id- Returns:
- a
Stream
of users followed by a specific user with the pagination information. - See Also:
-
listAllUserFollowing
@API(status=EXPERIMENTAL) public Stream<Long> listAllUserFollowing(@Nonnull Long userId, @Nonnull StreamPaginationAttribute pagination) Returns aStream
of users followed by a specific user.- Parameters:
userId
- User Idpagination
- The chunkSize and totalSize for pagination.- Returns:
- a
Stream
of users followed by a specific user with the pagination information. - See Also:
-
create
Creates a new user.- Parameters:
payload
- User's details to create.- Returns:
- a
V2UserDetail
with created user details. - See Also:
-
update
Updates an existing user- Parameters:
userId
- User Idpayload
- User's new attributes for update.- Returns:
V2UserDetail
with updated user details.- See Also:
-
listAuditTrail
public V1AuditTrailInitiatorList listAuditTrail(@Nonnull Long startTimestamp, Long endTimestamp, CursorPaginationAttribute pagination, Long initiatorId, String role) Returns audit trail of actions performed by a privileged user in a given period of time.- Parameters:
startTimestamp
- The start time of the period to retrieve the data.endTimestamp
- The end time of the period to retrieve the data.pagination
- The range and limit for pagination of data.initiatorId
- Privileged user id to list audit trail for.role
- Role to list audit trail for.- Returns:
V1AuditTrailInitiatorList
with items and pagination.- See Also:
-
listAllAuditTrail
@API(status=EXPERIMENTAL) public Stream<V1AuditTrailInitiatorResponse> listAllAuditTrail(@Nonnull Long startTimestamp, Long endTimestamp, Long initiatorId, String role, Integer chunkSize, Integer maxItems) Returns all audit trail of actions performed by a privileged user in a given period of time.- Parameters:
startTimestamp
- The start time of the period to retrieve the data.endTimestamp
- The end time of the period to retrieve the data.initiatorId
- Privileged user id to list audit trail for.role
- Role to list audit trail for.chunkSize
- The max number of items to retrieve in a given endpoint callmaxItems
- The max number of items to retrieve in total- Returns:
- a lazy stream of audit trail actions
-
suspendUser
Suspends a user account. Calling this endpoint requires a service account with the User Provisioning role.- Parameters:
userId
- user id to suspendreason
- reason why the user has to be suspendeduntil
- instant till when the user should be suspended- See Also:
-
unsuspendUser
Re-activates a user account. Calling this endpoint requires a service account with the User Provisioning role.- Parameters:
userId
- user id to reactivate- See Also:
-