Rank: Member
Groups: Registered
Joined: 6/9/2017(UTC) Posts: 29 Thanks: 1 times
|
Hi,
I'm using the Web Report Designer to create and run reports. The Web Server is configured to use the Database Authentication and the custom security script was modified to successfully connect users with their own credentials when they launch the Web Server. I confirmed that the users connect with their own accounts by looking at the sessions in the Oracle database.
I also created a script under 'Report Execution Init Script' in the Server Manager to run the report as the user logged in the Web Report Designer.
When users are running reports, the report execution is done by connecting to the database using the Repo user entered in the connection defined in the Server Manager. I also set the field 'Is Default' to False in the General setting of the Server Manager.
Looking at the sessions in the database, I can see a new session getting created for the Web user, then a new session gets created for the Repo user. I confirmed that the report is running under the Repo user by looking at the select statements for that session.
I'm using the following to get the Web user connected in 'Report Execution Init Script':
string connectString = "Provider=OraOLEDB.Oracle.1;Persist Security Info=True;Data Source=TESTDB; DbConnection connection = Helper.DbConnectionFromConnectionString(ConnectionType.OleDb, Helper.GetOleDbConnectionString(connectString, report.SecurityContext.WebUserName, report.SecurityContext.WebPassword)); connection.Open();
It looks like I'm missing something, but can't seem to put my finger on it.
Your assistance would be appreciated. Yves
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
To modify the user name and password of the connections, I would try this in the Report Execution Init Script: Code: foreach (var s in report.Sources) {
s.Connection.UserName = report.SecurityContext.WebUserName;
s.Connection.ClearPassword = report.SecurityContext.WebPassword;
}
this will change in all sources defined in the report (you may adapt it if you have several sources).
|
|
|
|
Rank: Member
Groups: Registered
Joined: 6/9/2017(UTC) Posts: 29 Thanks: 1 times
|
I don't see how and where this would fit in the Report Execution Init Script.
How should the following be re-written to incorporate what you suggested?
DbConnection connection = Helper.DbConnectionFromConnectionString(ConnectionType.OleDb, Helper.GetOleDbConnectionString(connectString, report.SecurityContext.WebUserName, report.SecurityContext.WebPassword)); connection.Open();
By the way, there is only one source defined in the Repo and in the reports.
Yves
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
perhaps I do not understand but: string connectString = "Provider=OraOLEDB.Oracle.1;Persist Security Info=True;Data Source=TESTDB; DbConnection connection = Helper.DbConnectionFromConnectionString(ConnectionType.OleDb, Helper.GetOleDbConnectionString(connectString, report.SecurityContext.WebUserName, report.SecurityContext.WebPassword)); connection.Open();
the connection you have instantiated will not be used to execute the report...
|
|
|
|
Rank: Member
Groups: Registered
Joined: 6/9/2017(UTC) Posts: 29 Thanks: 1 times
|
What should I use instead to get the report to connect/execute as the user currently connected to the Web Report Designer?
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
Sorry, I did not understood that it was in the Web Report Designer... In this cas it is different. Edited by user Tuesday, May 18, 2021 2:39:49 PM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Member
Groups: Registered
Joined: 6/9/2017(UTC) Posts: 29 Thanks: 1 times
|
No problem.
Do you have any suggestions about how I should go about connecting the current Web Report Designer user when he/she runs the report?
Yves
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
I made a quick try, by setting the following script in Report Execution Init Script: Code:@{
Report report = Model;
ReportExecutionLog log = report;
if (report.SecurityContext != null) {
log.LogMessage("Setting password for '{0}'", report.SecurityContext.WebUserName);
foreach (var s in report.Sources) {
s.Connection.UserName = report.SecurityContext.WebUserName;
s.Connection.ClearPassword = report.SecurityContext.WebPassword;
}
}
}
and it works fine with the Web Report Designer (new report or execution of an existing report).
|
|
|
|
Rank: Member
Groups: Registered
Joined: 6/9/2017(UTC) Posts: 29 Thanks: 1 times
|
Thanks for the script, I used it as the Report Execution Init Script in the Seal Server Configuration and it ran the report as user logged into the Web Report Designer.
However, the script connected the user using the default connection defined in the repository. I had to make a few modifications in order to pass the right connection string.
Yves
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.