Solved

Custom view issue : Unknown user theme

  • 19 September 2022
  • 12 replies
  • 80 views

Badge +3
  • Steward *
  • 8 replies

Hello,

 

Since we’ve upgraded from 21.10 to 22.04 version, we have issue with every custom views that aren’t displayed, there is an error message instead :

Unknown user theme : 

 

We just need to switch light/dark theme or edit our profile to fix the issue. Maybe there’s some lack of theme initialization on login phase :/

icon

Best answer by Snk 22 September 2022, 11:59

View original

12 replies

Userlevel 5
Badge +12

Can you try to clean browser cache?

Badge +3

Unfortunately, cleaning web browser cache doesn’t help.

Userlevel 5
Badge +12

@Snk which type of authentication do you use and which browser?

Badge +3

We do use SSO authentication through OpenID. Would that be the root cause ?

Userlevel 5
Badge +12

Ok it is a known issue and we made a fix here.

Should be available in next minor version (22.04.5)

Userlevel 2
Badge +2

Hello @Snk , Do you have logs into /var/log/php-fpm/centreon-error.log when you try to display your custom views ?

 

Also when you say 

We just need to switch light/dark theme or edit our profile to fix the issue. Maybe there’s some lack of theme initialization on login phase :/

 

When you logout and login again, did the bug occurs again ? (If yes indeed it could be a bug related to login, but if the bug doesn’t occurs after you have switch I think it’s more a problem during the upgrade).

 

I’ll investigate further

Userlevel 2
Badge +2

Hello again @Snk , 

After investigation I’ve found the root cause. Indeed on the login there is a little error.

 

If you want to patch it before we release this officialy, you can edit the following file:

/usr/share/centreon/src/EventSubscriber/WebSSOEventSubscriber.php

 

on ~l.246 you should see

        $sessionUserInfos = [
'contact_id' => $user->getId(),
'contact_name' => $user->getName(),
'contact_alias' => $user->getAlias(),
'contact_email' => $user->getEmail(),
'contact_lang' => $user->getLang(),
'contact_passwd' => $user->getEncodedPassword(),
'contact_autologin_key' => '',
'contact_admin' => $user->isAdmin() ? '1' : '0',
'default_page' => $user->getDefaultPage(),
'contact_location' => $user->getLocale(),
'show_deprecated_pages' => $user->isUsingDeprecatedPages(),
'reach_api' => $user->hasAccessToApiConfiguration() ? 1 : 0,
'reach_api_rt' => $user->hasAccessToApiRealTime() ? 1 : 0,
];

add the following line 

'contact_theme' => $user->getTheme() ?? 'light'

 

after

'reach_api_rt' => $user->hasAccessToApiRealTime() ? 1 : 0,

 

So the user theme will correctly be instanciate on login.

Badge +3

Hello @Jérémy Jaouen 

 

Thanks for this but it doesn’t fix the issue for us, even after restarting both httpd & php-fpm. I’ve event tried to clean browser cache.

 

I’ve checked in the contact table of the centreon database, every user has “light” theme configured.

Badge +3

For testing purpose I’ve tried :

'contact_theme' => 'light'

 

But it doesn’t work either :/

 

I guess the fix mentionned by @Laurent will fix it for good, I’ll wait for next release (22.04.6 ?)

Badge +3

Ok I’ve fixed the issue by adding the fix in this file aswell :

/usr/share/centreon/src/Core/Security/Application/UseCase/LoginOpenIdSession/LoginOpenIdSession.php

Userlevel 2
Badge +2

Yes thought it was login using apache SSO, my bad. 
A PR has been done and will be release ASAP (I guess in 22.04.6 indeed)

https://github.com/centreon/centreon/pull/11830

Badge +3

Thanks for your feedback, good to know it’ll be fixed in next version (I keep my local change ^^).

Reply