Jump to content
We've recently updated our Privacy Statement, available here ×

elwin_1

Members
  • Posts

    2
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Posts posted by elwin_1

  1. Hi,

    Jaspersoft server 6.1.

    I'm stuck on the modify part of the user, I can login via Rest but not able to change the roles, error 404. If I try via rest client I get a nasty error (

    <errorDescriptor>

    <errorCode>
    unexpected.error
    </errorCode>
    <message>
    object references an unsaved transient instance - save the transient instance before flushing: com.jaspersoft.jasperserver.api.metadata.user.domain.impl.hibernate.RepoRole; nested exception is org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.jaspersoft.jasperserver.api.metadata.user.domain.impl.hibernate.RepoRole
    </message>)

    This is the .NET code:

     

    using System;
    using System.Collections.Generic;
    using System.Collections.Specialized;
    using System.IO;
    using System.Linq;
    using System.Net;
    using System.Text;
    using System.Threading.Tasks;
    using System.Xml;
     
    namespace JasperUsersync
    {
        class Program
        {
            static void Main(string[] args)
            {
                // Setup WebClient 
                WebClient httpclient = new WebClient();
              var server = "http://local:8080//reportservice";
                var login = server + "//rest//login";
     
                //Set the content type of the request
               httpclient.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
      
     
                // Send PUT
     
                  //Set the username and password
                NameValueCollection parametros = new NameValueCollection();
                parametros.Add("j_username", "superuser");
                parametros.Add("j_password", "pwd");
     
                //Request to login
                httpclient.UploadValues(login, "POST", parametros);
     
                //Get session cookie
                string session = httpclient.ResponseHeaders.Get("Set-Cookie");
     
                //Set session cookie to the next request
                httpclient.Headers.Add("Cookie", session);
               string userURL = ("http://local:8080//reportservice//rest_v2//permissions//organizations//myorg//users//Testadmin");
          
     
                string json = "{"enabled":true, "roles": [{"name":"ROLE_USER"}, {"name":"CSK_ROLE_PROJECT_MANAGEMENT"} ]}";
                 
                 httpclient.Headers[HttpRequestHeader.ContentType] = "application/json";
     
                 string response = httpclient.UploadString(userURL, "PUT", json);
         
     
            }
      
     
    }
     
    What is the clue ???
     
    kind regards,
     
    Elwin
     
×
×
  • Create New...