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 Details

  • Method Details

    • obo

      public OboUserService obo(AuthSession oboSession)
      Description copied from interface: OboService
      Returns a new service instance with OBO-enabled endpoints from a given OBO session.
      Specified by:
      obo in interface OboService<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 interface OboUserService
      Parameters:
      uidList - List of user ids
      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.
      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

      public List<UserV2> listUsersByIds(@Nonnull List<Long> uidList)
      Specified by:
      listUsersByIds in interface OboUserService
      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 interface OboUserService
      Parameters:
      emailList - List of emails
      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.
      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

      public List<UserV2> listUsersByEmails(@Nonnull List<String> emailList)
      Specified by:
      listUsersByEmails in interface OboUserService
      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 interface OboUserService
      Parameters:
      usernameList - List of usernames
      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 usernames
      See Also:
    • listUsersByUsernames

      public List<UserV2> listUsersByUsernames(@Nonnull List<String> usernameList)
      Specified by:
      listUsersByUsernames in interface OboUserService
      Parameters:
      usernameList - List of usernames
      Returns:
      Users found by usernames
      See Also:
    • searchUsers

      public List<UserV2> searchUsers(@Nonnull UserSearchQuery query, @Nullable Boolean local)
      Specified by:
      searchUsers in interface OboUserService
      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 interface OboUserService
      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 interface OboUserService
      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 interface OboUserService
      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

      public void followUser(@Nonnull List<Long> followerIds, @Nonnull Long userId)
      Make a list of users to start following a specific user. followUser(List, Long)
      Specified by:
      followUser in interface OboUserService
      Parameters:
      followerIds - List of ids of the followers.
      userId - The id of the user to be followed.
      See Also:
    • unfollowUser

      public void unfollowUser(@Nonnull List<Long> followerIds, @Nonnull Long userId)
      Make a list of users to stop following a specific user. unfollowUser(List, Long)
      Specified by:
      unfollowUser in interface OboUserService
      Parameters:
      followerIds - List of the ids of the followers.
      userId - The id of the user to be unfollowed.
      See Also:
    • getUserDetail

      public V2UserDetail getUserDetail(@Nonnull Long userId)
      Retrieve user details of a particular user.
      Parameters:
      userId - User Id
      Returns:
      Details of the user.
      See Also:
    • listUsersDetail

      public List<V2UserDetail> listUsersDetail()
      Retrieve all users in the company (pod).
      Returns:
      List of retrieved users
      See Also:
    • listUsersDetail

      public List<V2UserDetail> listUsersDetail(@Nonnull PaginationAttribute pagination)
      Retrieve all users in the company (pod).
      Parameters:
      pagination - The skip and limit for pagination.
      Returns:
      List of retrieved users
      See Also:
    • listAllUsersDetail

      @API(status=EXPERIMENTAL) public Stream<V2UserDetail> listAllUsersDetail()
      Retrieve all users in the company (pod) and return in a Stream 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 a Stream.
      Parameters:
      pagination - The chunkSize and totalSize for pagination.
      Returns:
      a Stream of retrieved users
      See Also:
    • listUsersDetail

      public List<V2UserDetail> listUsersDetail(@Nonnull UserFilter filter)
      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 a Stream 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 a Stream.
      Parameters:
      filter - using to filter users by.
      pagination - The chunkSize and totalSize for pagination.
      Returns:
      a Stream of retrieved users
      See Also:
    • addRole

      public void addRole(@Nonnull Long userId, @Nonnull RoleId roleId)
      Add a role to an user.
      Parameters:
      userId - User Id
      roleId - Role Id
      See Also:
    • listRoles

      public List<RoleDetail> listRoles()
      List all roles in the pod
      Returns:
      List RoleDetail of all roles in the pod.
      See Also:
    • removeRole

      public void removeRole(@Nonnull Long userId, @Nonnull RoleId roleId)
      Remove a role from an user.
      Parameters:
      userId - User Id
      roleId - Role Id
      See Also:
    • getAvatar

      public List<Avatar> getAvatar(@Nonnull Long userId)
      Get the url of avatar of an user
      Parameters:
      userId - User Id
      Returns:
      List of avatar urls of the user
      See Also:
    • updateAvatar

      public void updateAvatar(@Nonnull Long userId, @Nonnull String image)
      Update avatar of an user
      Parameters:
      userId - User Id
      image - The avatar image for the user profile picture.The image must be a base64-encoded.
      See Also:
    • updateAvatar

      public void updateAvatar(@Nonnull Long userId, @Nonnull byte[] image)
      Update avatar of an user
      Parameters:
      userId - User Id
      image - The avatar image in bytes array for the user profile picture.
      See Also:
    • updateAvatar

      public void updateAvatar(@Nonnull Long userId, @Nonnull InputStream imageStream) throws IOException
      Update avatar of an user
      Parameters:
      userId - User Id
      imageStream - The avatar image input stream for the user profile picture.
      Throws:
      IOException
      See Also:
    • getDisclaimer

      public Disclaimer getDisclaimer(@Nonnull Long userId)
      Get disclaimer assigned to an user.
      Parameters:
      userId - User Id
      Returns:
      Disclaimer assigned to the user.
      See Also:
    • removeDisclaimer

      public void removeDisclaimer(@Nonnull Long userId)
      Unassign disclaimer from an user.
      Parameters:
      userId - User Id
      See Also:
    • addDisclaimer

      public void addDisclaimer(@Nonnull Long userId, @Nonnull String disclaimerId)
      Assign disclaimer to an user.
      Parameters:
      userId - User Id
      disclaimerId - Disclaimer to be assigned
      See Also:
    • getDelegates

      public List<Long> getDelegates(@Nonnull Long userId)
      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 Id
      delegatedUserId - Delegated user Id to be assigned
      actionEnum - Action to be performed
      See Also:
    • getFeatureEntitlements

      public List<Feature> getFeatureEntitlements(@Nonnull Long userId)
      Get feature entitlements of an user.
      Parameters:
      userId - User Id
      Returns:
      List of feature entitlements of the user.
      See Also:
    • updateFeatureEntitlements

      public void updateFeatureEntitlements(@Nonnull Long userId, @Nonnull List<Feature> features)
      Update feature entitlements of an user.
      Parameters:
      userId - User Id
      features - List of feature entitlements to be updated
      See Also:
    • getStatus

      public UserStatus getStatus(@Nonnull Long userId)
      Get status of an user.
      Parameters:
      userId - User Id
      Returns:
      Status of the user.
      See Also:
    • updateStatus

      public void updateStatus(@Nonnull Long userId, @Nonnull UserStatus status)
      Update the status of an user
      Parameters:
      userId - User Id
      status - Status to be updated to the user
      See Also:
    • listUserFollowers

      public FollowersListResponse listUserFollowers(@Nonnull Long userId)
      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 Id
      pagination - The range and limit for pagination.
      Returns:
      The list of followers of a specific user with the pagination information.
      See Also:
    • listAllUserFollowers

      @API(status=EXPERIMENTAL) public Stream<Long> listAllUserFollowers(@Nonnull Long userId)
      Returns the Stream 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 the Stream of followers of a specific user.
      Parameters:
      userId - User Id
      pagination - The chunkSize and totalSize for pagination.
      Returns:
      The Stream of followers of a specific user.
      See Also:
    • listUsersFollowing

      public FollowingListResponse listUsersFollowing(@Nonnull Long userId)
      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 Id
      pagination - The range and limit for pagination.
      Returns:
      The list of users followed by a specific user with the pagination information.
      See Also:
    • listAllUserFollowing

      @API(status=EXPERIMENTAL) public Stream<Long> listAllUserFollowing(@Nonnull Long userId)
      Returns a Stream 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 a Stream of users followed by a specific user.
      Parameters:
      userId - User Id
      pagination - The chunkSize and totalSize for pagination.
      Returns:
      a Stream of users followed by a specific user with the pagination information.
      See Also:
    • create

      public V2UserDetail create(@Nonnull V2UserCreate payload)
      Creates a new user.
      Parameters:
      payload - User's details to create.
      Returns:
      a V2UserDetail with created user details.
      See Also:
    • update

      public V2UserDetail update(@Nonnull Long userId, @Nonnull V2UserAttributes payload)
      Updates an existing user
      Parameters:
      userId - User Id
      payload - 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 call
      maxItems - The max number of items to retrieve in total
      Returns:
      a lazy stream of audit trail actions
    • suspendUser

      public void suspendUser(@Nonnull Long userId, @Nonnull String reason, @Nonnull Instant until)
      Suspends a user account. Calling this endpoint requires a service account with the User Provisioning role.
      Parameters:
      userId - user id to suspend
      reason - reason why the user has to be suspended
      until - instant till when the user should be suspended
      See Also:
    • unsuspendUser

      public void unsuspendUser(@Nonnull Long userId)
      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: