Disable database connection editing in Designer

Stimulsoft Reports.JAVA discussion
Post Reply
hmredeis
Posts: 5
Joined: Tue Sep 03, 2024 8:54 am

Disable database connection editing in Designer

Post by hmredeis »

When I create a new report, by default I already add a standard connection to the database so that users can query and assemble the report.

But the database access details (connection string) are visible in the Designer and allow users to view the host name, username and password. I would like to prevent users from having access to these details in the Designer in some way.

Is it possible to disable the “Edit” button or hide the connection string?

I tried this approach but the "Edit" button still visible and enabled (I tried to set "DenyEdit" in every available option):

Code: Select all

        final StiRestrictions restrictions = new StiRestrictions();
        restrictions.Add("DB IS", StiDataType.DataSource, StiRestrictionTypes.DenyEdit);
        restrictions.Add("DB IS", StiDataType.DataRelation, StiRestrictionTypes.DenyEdit);
        restrictions.Add("DB IS", StiDataType.BusinessObject, StiRestrictionTypes.DenyEdit);
        restrictions.Add("DB IS", StiDataType.DataColumn, StiRestrictionTypes.DenyEdit);
        restrictions.Add("DB IS", StiDataType.Database, StiRestrictionTypes.DenyEdit);
        restrictions.Add("DB IS", StiDataType.Variable, StiRestrictionTypes.DenyEdit);
        restrictions.Add("DB IS", StiDataType.Total, StiRestrictionTypes.DenyEdit);
        restrictions.Add("DB IS", StiDataType.Resource, StiRestrictionTypes.DenyEdit);

        report.getDictionary().setRestrictions(restrictions);
But when rendering the report the button still enabled: https://imgur.com/a/o5UK6Ee

This is how the report is being created:

Code: Select all

        final StiReport report = new StiReport();
        report.setReportName(input.getName());

        StiPage page = new StiPage(report);
        report.getPages().add(page);
        page.setName(StiNameCreation.createName(report, StiNameCreation.generateName(page)));

        final StiDatabaseCollection databases = new StiDatabaseCollection();
        final StiPostgreSQLDatabase isDB = new StiPostgreSQLDatabase();
        isDB.setName("DB IS");
        isDB.setConnectionString(isConnectionString);
        databases.add(isDB);

        final StiDictionary dictionary = new StiDictionary(report);
        dictionary.setDatabases(databases);

        report.setDictionary(dictionary);
Lech Kulikowski
Posts: 7331
Joined: Tue Mar 20, 2018 5:34 am

Re: Disable database connection editing in Designer

Post by Lech Kulikowski »

Hello,

We require more time to investigate the issue thoroughly. Rest assured, we will keep you informed about the outcome as soon as possible.

Thank you.
hmredeis
Posts: 5
Joined: Tue Sep 03, 2024 8:54 am

Re: Disable database connection editing in Designer

Post by hmredeis »

Thank you. I really appreciate.
Vadim
Posts: 409
Joined: Tue Apr 23, 2013 11:23 am

Re: Disable database connection editing in Designer

Post by Vadim »

Hello

Please use StiWebDesignerOptions options.getDictionary().setPermissionDataConnections(StiDesignerPermissions.View);
Vadim
Posts: 409
Joined: Tue Apr 23, 2013 11:23 am

Re: Disable database connection editing in Designer

Post by Vadim »

Hello

Please use StiWebDesignerOptions options.getDictionary().setPermissionDataConnections(StiDesignerPermissions.View);
hmredeis
Posts: 5
Joined: Tue Sep 03, 2024 8:54 am

Re: Disable database connection editing in Designer

Post by hmredeis »

Thanks @Vadim. It worked and will solve my problems for now. Let me just ask one question. This will prevent edit and remove all the datasources. Nowadays no way to apply this restriction only for a single Data Connection, right?
Vadim
Posts: 409
Joined: Tue Apr 23, 2013 11:23 am

Re: Disable database connection editing in Designer

Post by Vadim »

Hello

Yes, it applies to all connection. Only this way.
Post Reply