elwin_1
-
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
-
-
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></errorCode>unexpected.error<message></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.RepoRoleThis 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 WebClientWebClient httpclient = new WebClient();var server = "http://local:8080//reportservice";var login = server + "//rest//login";//Set the content type of the requesthttpclient.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";// Send PUT//Set the username and passwordNameValueCollection parametros = new NameValueCollection();parametros.Add("j_username", "superuser");parametros.Add("j_password", "pwd");//Request to loginhttpclient.UploadValues(login, "POST", parametros);//Get session cookiestring session = httpclient.ResponseHeaders.Get("Set-Cookie");//Set session cookie to the next requesthttpclient.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
.NET Rest2 modify user role
in Products
Posted
Found the source, the user was in the root and the role was in an organizaton.