V92 angular portal: Where do the application theme preferences get stored ?

Hi, 

In the v92 angular portal, we're going to supress the option of user interface settings (under the logged user) and leave only one corporate theme. We would like to know where this setting get stored per user, so we could update it in the database with a fixed value.

Thanks!

Parents
  • Thanks.

    I'll need another approach then, as the values (theme, filters, ...) are encoded into only one field. Hence, my idea of replacing in the database makes no sense.

    Also I've noticed that there's a record in this table for each login, no matter if they belong to the same user under different authentication schemes:

    Identity: juancar

    • Logged using identity/role based method, generates one record in DialogUserConfiguration (juancar).
    • Logged using Google oAuth generates another record in DialogUserConfiguration (juancarlos@eprinsa.es). 

    So the config for the same user varies, but the actual logged user is the same (in terms of database permissions). 

    Another thing to consider.

    Thanks again!

  • I would like to do something similar, i created a brand new corporate theme and i would like to made it default to every user, this can be done using the configuration item ServerLevelConfig/DefaultHtmlTheme in Administration Portal but so far im having inconsistent results, i can see that the change is stored in CCC.CompositionApi.global.json file but i would expect is also stored in database, any idea where this custom config is stored in database ?   

  • If you change the configuration setting as global change, the JSON file file be uploaded to the database and distributed via AutoUpdate.

    The file is stored in the table QBMFileRevision.

  • i can see the file stored in DB and in IIS site folder but users only get the custom theme after manually selecting it from user interface settings in portal

  • Hello Hector,

    From my understanding the config key 'ServerLevelConfig/DefaultHtmlTheme' is picked-up by the portal APIServer when configed:
    'bin\CCC.CompositionApi.global.json' contains
    {"Scopes":[{"AppliesTo":"imx","Ignore":false,"Data":{"ServerLevelConfig/DefaultHtmlTheme":"eui-dark-theme"...

    The following end-point will publish this setting:.../apiserverdev/imx/config
    {... "DefaultHtmlTheme": "eui-dark-theme",...}

    If an user configures his own personal default theme 'User Interface Settings' this takes precedence over
    the server level default. This is saved in ConfigurationData@DialogUserConfiguration

    	SELECT u.Ident_QBMXUser
    		,CONVERT(VARCHAR(MAX), CAST('' AS XML).value('xs:base64Binary(sql:column("ConfigurationData"))', 'VARBINARY(MAX)')) AS DialogUserConfiguration
    	FROM DialogUserConfiguration
    	JOIN QBMXUser u ON u.UID_QBMXUser = DialogUserConfiguration.UID_QBMXUser
    	WHERE UID_DialogProduct IN (
    			SELECT UID_DialogProduct
    			FROM QBMProduct
    			WHERE Ident_Product = 'WebDesigner'
    			)
    
    Or
    
    Imports Newtonsoft.Json
    
    Public Function CCC_GetUserConfiguration(
    	ByVal uidQBMXUser As String) As String
    	
    	Dim uidDialogProduct As String = Session.Source().GetSingleValue(Of String)(Query _
    			.From(Table.QBMProduct) _
    			.Where(Session.SqlFormatter.Comparison(Table.QBMProduct.Ident_Product, "WebDesigner",
    					ValType.String, CompareOperator.Equal, FormatterOptions.None)) _
    			.Select(Table.QBMProduct.UID_DialogProduct))
    	
    	Dim userConfiguration As DialogUserConfiguration = Nothing
    	If Not Session.Source.TryGet(Of DialogUserConfiguration)(
    			New DbObjectKey(Table.DialogUserConfiguration, New String() {uidDialogProduct, uidQBMXUser}),
    			EntityLoadType.Interactive, userConfiguration) Then Exit Function
    
    	Return TryDeserializeConfigurationData(userConfiguration.Entity)
    End Function
    
    Private Function TryDeserializeConfigurationData(ByVal e As IEntity) As String
    	Dim bytes As Byte() = e.GetValue(Of Byte())("ConfigurationData")
    	
    	Dim configurationSettings As New List(Of ConfigurationSetting)
    	configurationSettings = JsonConvert.DeserializeObject(Of List(Of ConfigurationSetting))(Encoding.UTF8.GetString(bytes))
    	
    	Dim configOverview = New StringBuilder()
    	For Each setting In configurationSettings
    		configOverview.AppendLine($"{setting.Key} = {setting.Value}")
    	Next		
    	
    	Return configOverview.ToString()
    End Function
    
    Public Class ConfigurationSetting
    	Public Property Key As String
    	Public Property Value As String
    End Class

    LastLookupDate = [{"Context":"UserProcess","Date":"2024-08-29T07:18:23.1620208Z"}]
    ProfileSettings = {"TimeZoneId":"","PreferredAppThemes":"eui-light-theme"}
    QerProfileSettings = {}

    Some aditional info about the DialogUserConfiguration entries:
    Lost bookmarks after change of authentication method

Reply
  • Hello Hector,

    From my understanding the config key 'ServerLevelConfig/DefaultHtmlTheme' is picked-up by the portal APIServer when configed:
    'bin\CCC.CompositionApi.global.json' contains
    {"Scopes":[{"AppliesTo":"imx","Ignore":false,"Data":{"ServerLevelConfig/DefaultHtmlTheme":"eui-dark-theme"...

    The following end-point will publish this setting:.../apiserverdev/imx/config
    {... "DefaultHtmlTheme": "eui-dark-theme",...}

    If an user configures his own personal default theme 'User Interface Settings' this takes precedence over
    the server level default. This is saved in ConfigurationData@DialogUserConfiguration

    	SELECT u.Ident_QBMXUser
    		,CONVERT(VARCHAR(MAX), CAST('' AS XML).value('xs:base64Binary(sql:column("ConfigurationData"))', 'VARBINARY(MAX)')) AS DialogUserConfiguration
    	FROM DialogUserConfiguration
    	JOIN QBMXUser u ON u.UID_QBMXUser = DialogUserConfiguration.UID_QBMXUser
    	WHERE UID_DialogProduct IN (
    			SELECT UID_DialogProduct
    			FROM QBMProduct
    			WHERE Ident_Product = 'WebDesigner'
    			)
    
    Or
    
    Imports Newtonsoft.Json
    
    Public Function CCC_GetUserConfiguration(
    	ByVal uidQBMXUser As String) As String
    	
    	Dim uidDialogProduct As String = Session.Source().GetSingleValue(Of String)(Query _
    			.From(Table.QBMProduct) _
    			.Where(Session.SqlFormatter.Comparison(Table.QBMProduct.Ident_Product, "WebDesigner",
    					ValType.String, CompareOperator.Equal, FormatterOptions.None)) _
    			.Select(Table.QBMProduct.UID_DialogProduct))
    	
    	Dim userConfiguration As DialogUserConfiguration = Nothing
    	If Not Session.Source.TryGet(Of DialogUserConfiguration)(
    			New DbObjectKey(Table.DialogUserConfiguration, New String() {uidDialogProduct, uidQBMXUser}),
    			EntityLoadType.Interactive, userConfiguration) Then Exit Function
    
    	Return TryDeserializeConfigurationData(userConfiguration.Entity)
    End Function
    
    Private Function TryDeserializeConfigurationData(ByVal e As IEntity) As String
    	Dim bytes As Byte() = e.GetValue(Of Byte())("ConfigurationData")
    	
    	Dim configurationSettings As New List(Of ConfigurationSetting)
    	configurationSettings = JsonConvert.DeserializeObject(Of List(Of ConfigurationSetting))(Encoding.UTF8.GetString(bytes))
    	
    	Dim configOverview = New StringBuilder()
    	For Each setting In configurationSettings
    		configOverview.AppendLine($"{setting.Key} = {setting.Value}")
    	Next		
    	
    	Return configOverview.ToString()
    End Function
    
    Public Class ConfigurationSetting
    	Public Property Key As String
    	Public Property Value As String
    End Class

    LastLookupDate = [{"Context":"UserProcess","Date":"2024-08-29T07:18:23.1620208Z"}]
    ProfileSettings = {"TimeZoneId":"","PreferredAppThemes":"eui-light-theme"}
    QerProfileSettings = {}

    Some aditional info about the DialogUserConfiguration entries:
    Lost bookmarks after change of authentication method

Children
  • Hello Niels ! thank you very much for the detailed answer !

    I can find such configuration encoded in Base64 in the DialogUserConfiguration table but only for users that have manually selected the custom theme in "User Interface Settings" in Portal (and it works),

    I'll try to describe my issue here:

    • I install a custom yellow theme using software loader
    • Configure that custom yellow  theme in Administration Portal so it should be default to every user in WebPortal
    • The custom yellow theme appears in the "User Interface Settigns" list in profile settings
    • Users manually selecting the custom theme in "User Interface Settigns" get the correct yellow theme
    • Users entering the Portal without selecting the custom theme in "User Interface Settigns" get the 1IM default blue theme 
  • Just to take the "custom theme" out of the equation for now.
    What happens when you select the "dark theme" as the server default?

    So now:

    • Users entering the Portal without selecting the custom theme in "User Interface Settigns" should get the dark theme