Class BoxUsersManager


  • public class BoxUsersManager
    extends Object
    Provides operations to manage Box users.
    • Constructor Detail

      • BoxUsersManager

        public BoxUsersManager​(com.box.sdk.BoxAPIConnection boxConnection)
        Create users manager to manage the users of Box connection's authenticated user.
        Parameters:
        boxConnection - - Box connection to authenticated user account.
    • Method Detail

      • getCurrentUser

        public com.box.sdk.BoxUser getCurrentUser()
        Get current user.
        Returns:
        The current user.
      • getAllEnterpriseOrExternalUsers

        public List<com.box.sdk.BoxUser.Info> getAllEnterpriseOrExternalUsers​(String filterTerm,
                                                                              String... fields)
        Get any managed users that match the filter term as well as any external users that match the filter term. For managed users it matches any users names or emails that start with the term. For external, it only does full match on email. This method is ideal to use in the case where you have a full email for a user and you don't know if they're managed or external.
        Parameters:
        filterTerm - - The filter term to lookup users by (login for external, login or name for managed); if null all managed users are returned.
        fields - - the fields to retrieve. Leave this out for the standard fields.
        Returns:
        All the enterprise users or enterprise users that matches the filter.
      • createEnterpriseUser

        public com.box.sdk.BoxUser createEnterpriseUser​(String login,
                                                        String name,
                                                        com.box.sdk.CreateUserParams params)
        Provision a new user in an enterprise with additional user information.
        Parameters:
        login - - the email address the user will use to login.
        name - - the name of the user.
        params - - additional user information.
        Returns:
        All the enterprise users or enterprise users that matches the filter.
      • createAppUser

        public com.box.sdk.BoxUser createAppUser​(String name,
                                                 com.box.sdk.CreateUserParams params)
        Provision a new app user in an enterprise with additional user information using Box Developer Edition.
        Parameters:
        name - - the name of the user.
        params - - additional user information.
        Returns:
        All the enterprise users or enterprise users that matches the filter.
      • getUserInfo

        public com.box.sdk.BoxUser.Info getUserInfo​(String userId)
        Get user information.
        Parameters:
        userId - - the id of user.
        Returns:
        The user information.
      • updateUserInfo

        public com.box.sdk.BoxUser updateUserInfo​(String userId,
                                                  com.box.sdk.BoxUser.Info info)
        Update user information.
        Parameters:
        userId - - the id of user to update.
        info - - the updated information
        Returns:
        The updated user.
      • deleteUser

        public void deleteUser​(String userId,
                               boolean notifyUser,
                               boolean force)
        Delete user from an enterprise account.
        Parameters:
        userId - - the id of user to delete.
        notifyUser - - whether or not to send an email notification to the user that their account has been deleted.
        force - - whether or not this user should be deleted even if they still own files.
      • addUserEmailAlias

        public com.box.sdk.EmailAlias addUserEmailAlias​(String userId,
                                                        String email)
        Add a new email alias to user's account.
        Parameters:
        userId - - the id of user.
        email - - the email address to add as an alias.
        Returns:
        The newly created email alias.
      • getUserEmailAlias

        public Collection<com.box.sdk.EmailAlias> getUserEmailAlias​(String userId)
        Get a collection of all the email aliases for user.
        Parameters:
        userId - - the id of user.
        Returns:
        A collection of all the email aliases for user.
      • deleteUserEmailAlias

        public void deleteUserEmailAlias​(String userId,
                                         String emailAliasId)
        Delete an email alias from user's account.
        Parameters:
        userId - - the id of user.
        emailAliasId - - the id of the email alias to delete.
      • moveFolderToUser

        public com.box.sdk.BoxFolder.Info moveFolderToUser​(String userId,
                                                           String sourceUserId)
        Move root folder for specified user to current user.
        Parameters:
        userId - - the id of user.
        sourceUserId - - the user id of the user whose files will be the source for this operation.