elwin_1 Posted July 12, 2016 Share Posted July 12, 2016 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 Link to comment Share on other sites More sharing options...
elwin_1 Posted July 13, 2016 Author Share Posted July 13, 2016 Found the source, the user was in the root and the role was in an organizaton. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now