How to use the user id passed in from rest client with jcr instread of liveuser

Hi. I’m developing a rest service to create a documents using jcr. The workflow manager is using liveuser as a user id. Currently liveuser doesn’t have write permissions and I prefer not to give write permissions to liveuser. In stead I want to user a different user that has write permissions. I don’t see any way to set the userid. I tried a few things but no luck. Here are some things I tried:

                servletRequest.setAttribute("user", userId);
                servletRequest.setAttribute("password", userId);
                HstRequestContext requestContext =
                        getRequestContext(servletRequest);

                requestContext.setAttribute( BindingProvider.USERNAME_PROPERTY, userId );
                requestContext.setAttribute( BindingProvider.PASSWORD_PROPERTY, password );
                WorkflowPersistenceManager wpm = (WorkflowPersistenceManager)
                        getPersistenceManager(requestContext);

Any help is appreciated. Thank you.

You will need a persistable session. PLease see:

Thank you for replying. :slight_smile:

Do you mean this? (1st line )

        @Persistable
        @POST
        @Path("/create")
        @Consumes(MediaType.APPLICATION_JSON)
        public void saveDocument(

If so, I already have that, but then what do I do after that to control which user ID get used?

:slight_smile:

That seems correct. Are remembering to do a save?