Jump to content
Changes to the Jaspersoft community edition download ×

Preserving username in Scheduled Jobs


william_ferguson_au

Recommended Posts

From our WebService (deployed within JasperIntel) I am trying to schedule a report using the SchedulingService. The client connects to the WebService by passing well-known credentials, currently jasperAdmin (we only intend to have a single user configured within JasperIntel and restrict access to it from within our application).

 

When I construct the ReportJob I specify ReportJob#userName to be 'user1' expecting it to be preserved. But when I execute schedulingService#getScheduledJobs the ReportJobSummary returned lists the #username as jasperAdmin not 'user1'.

 

Is there some way for me to get the username of the scheduled job preserved?

 

Likewise for generated report output. I need to have the username of the scheduled job preserved in the generated report.

 

William

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Currently the logged-in user is always saved as the owner of the job. When the job will get executed, the authentication will be performed with respect to the job owner (e.g. if a resource needs to be accessed during the job execution, the job owner is checked to have the permission to read the resource).

 

Therefore the job owner needs to be a user registered in JasperIntelligence. Would this hold for your "user1", or would "jasperAdmin" be the only registered user?

 

Also, in which way are you including the username in the generated report? Is it via the "LoggedInUser" parameter?

 

Regards,

Lucian

Link to comment
Share on other sites

lucianc wrote:

Therefore the job owner needs to be a user registered in JasperIntelligence. Would this hold for your "user1", or would "jasperAdmin" be the only registered user?

 

"jasperAdmin" would be the only registered user and would have full access to all resources.

 

lucianc wrote:

Also, in which way are you including the username in the generated report? Is it via the "LoggedInUser" parameter?

 

To date there have been no requirements for details of the user that requested the report to be embedded in the report output. Though if this became the case I expect that it would be resolved by passing the appropriate paramater to the report itself.

 

We really need the id of the user that we have said is scheduling the report and for whom a report instance is generated to be preserved so that we can query for it. Which is another questiion, how do I query for all scheduled jobs for a particular user?

 

And I really don't want to duplicate our authentication framework within JasperIntel.

 

Is it possible to verify the required resources (according to the authenitcated user "jasperAdmin" when the report is scheduled instead of when it is run? Then all that would need be done is to preserve the value of the #username attribute on the ReportJob when it is scheduled. Ie have the #username stamped by the client to the ScheudlingService instead of somewhere in its bowels.

 

 

William

Link to comment
Share on other sites

  • 6 years later...

I tried this following code:

 

UserAndRoleManagement userAndRoleManagement = new UserAndRoleManagement();

 

WSUser user = new WSUser();

user.setUsername("xyz");

user.setTenantId("organization_1");

user.setEnabled(true);

user.setFullName("XYZ ABC");

WSRole role = new WSRole();

role.setRoleName("ROLE_USER");

role.setTenantId(null);

user.setRoles(new WSRole[] {role});

 

WSUser value = userAndRoleManagement.putUser(user);

 

But i am getting the error :

 

java.lang.NullPointerException

at com.jaspersoft.jasperserver.ws.axis2.authority.UserAndRoleManagement.getService(UserAndRoleManagement.java:72)

at com.jaspersoft.jasperserver.ws.axis2.authority.UserAndRoleManagement.putUser(UserAndRoleManagement.java:48)

 

After searching a lot not getting any solution how to create the object of UserAndRoleManagement.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...