Bug Report T742223
Visible to All Users

Dashboards - XAF doesn't allow storing credentials in Dashboard's XML content

created 6 years ago

Hi Devexpress,

Although I see so many threads mentioned about this, I am also struggling into how to store a credential in Dashboard xml, using XAF

this is my implementation in Module.Win:

C#
public class DashboardDesignerController : ObjectViewController<ObjectView, IDashboardData> { protected override void OnActivated() { base.OnActivated(); WinShowDashboardDesignerController showDashboardDesignerController = Frame.GetController<WinShowDashboardDesignerController>(); if (showDashboardDesignerController != null) showDashboardDesignerController.DashboardDesignerManager.DashboardDesignerCreated += DashboardDesignerManager_DashboardDesignerCreated; } private void DashboardDesignerManager_DashboardDesignerCreated(object sender, DashboardDesignerShownEventArgs e) { //this part... e.DashboardDesigner.DataSourceWizard.ShowConnectionsFromAppConfig = false; e.DashboardDesigner.DataSourceWizard.SqlWizardSettings.DatabaseCredentialsSavingBehavior = DevExpress.DataAccess.Wizard.SensitiveInfoSavingBehavior.Always; } protected override void OnDeactivated() { WinShowDashboardDesignerController showDashboardDesignerController = Frame.GetController<WinShowDashboardDesignerController>(); if (showDashboardDesignerController != null) showDashboardDesignerController.DashboardDesignerManager.DashboardDesignerCreated -= DashboardDesignerManager_DashboardDesignerCreated; base.OnDeactivated(); } }

But I get this after saved to the database:

SQL
select content from dashboarddata
XML
<Connection Name="localhost_mydbname_Connection" FromAppConfig="true" />

I set the breakpoint at DashboardDesignerManager_DashboardDesignerCreated(), and it seems to be fired correctly during press new button.
and those properties are set correctly. However, the db content is not.

Please suggest what should be fixed.
Thanks

Show previous comments (1)
Andrey K (DevExpress Support) 6 years ago

    Hello,

    Thank you for your patience. We found the cause of this behavior and will discuss it further. We will update this thread once we have any news. For now, use the following DashboardDesignerManager descendant:

    C#
    using DevExpress.ExpressApp; using DevExpress.Persistent.Base; using DevExpress.ExpressApp.Dashboards.Win; using DevExpress.DashboardCommon; namespace dxT742223.Module.Win.Controllers { public class DashboardDesignerManagerEx : DashboardDesignerManager { public DashboardDesignerManagerEx(XafApplication application) : base(application) { } protected override void ProcessDashboardBeforeSaving(Dashboard dashboard) { //base.ProcessDashboardBeforeSaving(dashboard); } } public class DashboardDesignerController : ObjectViewController<ObjectView, IDashboardData> { protected override void OnActivated() { base.OnActivated(); WinShowDashboardDesignerController showDashboardDesignerController = Frame.GetController<WinShowDashboardDesignerController>(); if(showDashboardDesignerController != null){ showDashboardDesignerController.DashboardDesignerManager = new DashboardDesignerManagerEx(Application); showDashboardDesignerController.DashboardDesignerManager.DashboardDesignerCreated += DashboardDesignerManager_DashboardDesignerCreated; } } private void DashboardDesignerManager_DashboardDesignerCreated(object sender, DashboardDesignerShownEventArgs e) { //this part... e.DashboardDesigner.DataSourceWizard.ShowConnectionsFromAppConfig = false; e.DashboardDesigner.DataSourceWizard.SqlWizardSettings.DatabaseCredentialsSavingBehavior = DevExpress.DataAccess.Wizard.SensitiveInfoSavingBehavior.Always; } protected override void OnDeactivated() { WinShowDashboardDesignerController showDashboardDesignerController = Frame.GetController<WinShowDashboardDesignerController>(); if(showDashboardDesignerController != null) showDashboardDesignerController.DashboardDesignerManager.DashboardDesignerCreated -= DashboardDesignerManager_DashboardDesignerCreated; base.OnDeactivated(); } } }

    Thanks,
    Andrey

      Hi Andrey,

      It is working as expected.

      Should I use this as a permanent solution, or wait for any updates?

      thanks

      Andrey K (DevExpress Support) 6 years ago

        Hello,

        Thank you for keeping us informed. You can use this temporary solution now. Once we have any updates, we will notify you here.

        Andrey

        Answers approved by DevExpress Support

        created 6 years ago (modified a year ago)

        We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

        Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

        Additional information:

        To allow storing credentials in a database, set the SqlWizardSettings.DatabaseCredentialsSavingBehavior property to a corresponding value. To access a SqlWizardSettings instance, use the following constructor.

        C#
        using DevExpress.ExpressApp; using DevExpress.Persistent.Base; using DevExpress.ExpressApp.Dashboards.Win; namespace dxT742223.Module.Win.Controllers { public class DashboardDesignerController : ObjectViewController<ObjectView, IDashboardData> { protected override void OnActivated() { base.OnActivated(); WinShowDashboardDesignerController showDashboardDesignerController = Frame.GetController<WinShowDashboardDesignerController>(); if(showDashboardDesignerController != null){ showDashboardDesignerController.DashboardDesignerManager.DashboardDesignerCreated += DashboardDesignerManager_DashboardDesignerCreated; } } private void DashboardDesignerManager_DashboardDesignerCreated(object sender, DashboardDesignerShownEventArgs e) { e.DashboardDesigner.DataSourceWizard.SqlWizardSettings.DatabaseCredentialsSavingBehavior = DevExpress.DataAccess.Wizard.SensitiveInfoSavingBehavior.Always; } protected override void OnDeactivated() { WinShowDashboardDesignerController showDashboardDesignerController = Frame.GetController<WinShowDashboardDesignerController>(); if(showDashboardDesignerController != null) showDashboardDesignerController.DashboardDesignerManager.DashboardDesignerCreated -= DashboardDesignerManager_DashboardDesignerCreated; base.OnDeactivated(); } } }
          Comments (1)
          Andrey K (DevExpress Support) 6 years ago

            Hello,

            I added the info about how to save credentials in a database to the answer. Please refer to it and let me know if you have any further questions.

            Thanks,
            Andrey

            Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

            Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.