logo

Warning: The forum is now for consultation only. Please use GitHub Discussions to post any questions or comments.


Welcome Guest ! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Ott  
#1 Posted : Thursday, May 13, 2021 8:31:10 PM(UTC)
Ott

Rank: Member

Groups: Registered
Joined: 6/9/2017(UTC)
Posts: 29
Canada

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
epf  
#2 Posted : Tuesday, May 18, 2021 1:39:28 PM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

Thanks: 14 times
Was thanked: 205 time(s) in 198 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).
Ott  
#3 Posted : Tuesday, May 18, 2021 1:57:11 PM(UTC)
Ott

Rank: Member

Groups: Registered
Joined: 6/9/2017(UTC)
Posts: 29
Canada

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
epf  
#4 Posted : Tuesday, May 18, 2021 2:21:02 PM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

Thanks: 14 times
Was thanked: 205 time(s) in 198 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...

Ott  
#5 Posted : Tuesday, May 18, 2021 2:26:49 PM(UTC)
Ott

Rank: Member

Groups: Registered
Joined: 6/9/2017(UTC)
Posts: 29
Canada

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?
epf  
#6 Posted : Tuesday, May 18, 2021 2:37:38 PM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

Thanks: 14 times
Was thanked: 205 time(s) in 198 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

Ott  
#7 Posted : Tuesday, May 18, 2021 3:21:32 PM(UTC)
Ott

Rank: Member

Groups: Registered
Joined: 6/9/2017(UTC)
Posts: 29
Canada

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
epf  
#8 Posted : Wednesday, May 19, 2021 9:17:24 AM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

Thanks: 14 times
Was thanked: 205 time(s) in 198 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).
Ott  
#9 Posted : Wednesday, May 19, 2021 7:01:48 PM(UTC)
Ott

Rank: Member

Groups: Registered
Joined: 6/9/2017(UTC)
Posts: 29
Canada

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

Users browsing this topic
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.