derricksmith / phpsaml

GLPI Plugin - SAML integration using the Onelogin SAML Library
MIT License
32 stars 24 forks source link

Configuration doesn't get saved when clicking on "Update" button #115

Open SmoZy92 opened 2 years ago

SmoZy92 commented 2 years ago

Hello,

I am facing an issue when trying to modify the config. Indeed, every time I press the "update" button it doesn't save the config and redirects me to the home page.

I have used the 1.3.0, 1.2.0 as well as 1.2.1 version but none of them seems to work.

Tried all the recommended troubleshoots (inserted manually a row on db directly, etc.) in the #101 issue but none of them worked.

OS: Debian 11 PHP: 7.4 GLPI: 10.0.5 GLPI installed in the /var/www/html/glpi dir

is it normal that the 1.2.1 fix doesn't really fix it ?

Thank you in advance

derricksmith commented 1 year ago

Did you remove the database table between versions? If starting fresh with 1.2.1, the issue should be resolved. Can you provide mysql output for the commands below?

show columns from glpi_plugin_phpsaml_configs select * from glpi_plugin_phpsaml_configs

SmoZy92 commented 1 year ago

Thank you for the reply @derricksmith !

Yes I removed the tables between versions, and I tried first with the 1.2.1 however.

Here is the output of the command show columns from glpi_plugin_phpsaml_configs

image

and the output of the select * from glpi_plugin_phpsaml_configs

image

DonutsNL commented 1 year ago

Hi Smo,

I have tried to replicate this problem without success. Used old restored installs, updated installs and fresh installs.

The latest version works without any issue on both Linux and Windows. Can you share the glpi error log entries (if any) that are generated when pressing the update button. You can find the log (if you didn't change the location) at GLPI_ROOT -> files -> _logs -> php-errors.log.

Hopefully that will provide us with some insight.

Rgrds,

SmoZy92 commented 1 year ago

Hello @DonutsNL, thanks for the reply,

I found some strange warning logs from the php-errors file

image

[2022-11-28 09:19:27] glpiphplog.WARNING:   *** PHP User Warning (512): plugin_version_phpsaml-1.2.1 method must be defined! in /var/www/html/glpi/src/Plugin.php at line 1601
  Backtrace :
  src/Plugin.php:1601                                trigger_error()
  src/Plugin.php:1639                                Plugin::getInfo()
  src/Plugin.php:669                                 Plugin->getInformationsFromDirectory()
  src/Plugin.php:503                                 Plugin->getNewInfoAndDirBasedOnOldName()
  src/Plugin.php:472                                 Plugin->checkPluginState()
  front/marketplace.php:43                           Plugin->checkStates()

[2022-11-28 09:19:27] glpiphplog.WARNING:   *** PHP User Warning (512): Unable to load plugin "phpsaml" information. in /var/www/html/glpi/src/Plugin.php at line 516
  Backtrace :
  src/Plugin.php:516                                 trigger_error()
  src/Plugin.php:472                                 Plugin->checkPluginState()
  front/marketplace.php:43                           Plugin->checkStates()

[2022-11-28 09:19:27] glpiphplog.WARNING:   *** PHP User Warning (512): plugin_version_phpsaml-1.2.1 method must be defined! in /var/www/html/glpi/src/Plugin.php at line 1601
  Backtrace :
  src/Plugin.php:1601                                trigger_error()
  src/Plugin.php:1639                                Plugin::getInfo()
  src/Plugin.php:492                                 Plugin->getInformationsFromDirectory()
  src/Plugin.php:472                                 Plugin->checkPluginState()
  front/marketplace.php:43                           Plugin->checkStates()

[2022-11-28 09:19:34] glpiphplog.WARNING:   *** PHP User Warning (512): plugin_version_phpsaml-1.2.1 method must be defined! in /var/www/html/glpi/src/Plugin.php at line 1601
  Backtrace :
  src/Plugin.php:1601                                trigger_error()
  src/Plugin.php:1639                                Plugin::getInfo()
  src/Plugin.php:492                                 Plugin->getInformationsFromDirectory()
  src/Plugin.php:472                                 Plugin->checkPluginState()
  front/marketplace.php:43                           Plugin->checkStates()

[2022-11-28 09:21:07] glpiphplog.WARNING:   *** PHP User Warning (512): Usage of "utf8_unicode_ci" charset/collation detected, should be "utf8mb4_unicode_ci" in /var/www/html/glpi/src/DBmysql.php at                                      line 2003
  Backtrace :
  src/DBmysql.php:2003                               trigger_error()
  src/DBmysql.php:361                                DBmysql->checkForDeprecatedTableOptions()
  plugins/phpsaml/hook.php:73                        DBmysql->query()
  src/Plugin.php:787                                 plugin_phpsaml_install()
  :                                                  Plugin->install()
  src/Marketplace/Controller.php:545                 call_user_func()
  src/Marketplace/Controller.php:435                 Glpi\Marketplace\Controller->setPluginState()
  ajax/marketplace.php:82                            Glpi\Marketplace\Controller->installPlugin()

[2022-11-28 09:21:07] glpiphplog.WARNING:   *** PHP User Warning (512): Usage of signed integers in primary or foreign keys is discouraged, please use unsigned integers instead in `glpi_plugin_phpsam                                     l_configs`.`id`. in /var/www/html/glpi/src/DBmysql.php at line 2041
  Backtrace :
  src/DBmysql.php:2041                               trigger_error()
  src/DBmysql.php:361                                DBmysql->checkForDeprecatedTableOptions()
  plugins/phpsaml/hook.php:73                        DBmysql->query()
  src/Plugin.php:787                                 plugin_phpsaml_install()
  :                                                  Plugin->install()
  src/Marketplace/Controller.php:545                 call_user_func()
  src/Marketplace/Controller.php:435                 Glpi\Marketplace\Controller->setPluginState()
  ajax/marketplace.php:82                            Glpi\Marketplace\Controller->installPlugin()
SilvaFernando commented 1 year ago

For solve this i needed unistall plugin, remove tables and install, after this i don't have more this bug.

DonutsNL commented 1 year ago

Yeah i am refactoring the setup page. I am changing the logic and added allot more validations. This is to allow and to make sure either an human readable and understandable error is generated and allow the user fix the issue using a repost with corrected values, even if the database is corrupted. Also added checks to validate all configuration fields are present in the database or fire a warning if it finds more or less.

derricksmith commented 1 year ago

Yeah i am refactoring the setup page. I am changing the logic and added allot more validations. This is to allow and to make sure either an human readable and understandable error is generated and allow the user fix the issue using a repost with corrected values, even if the database is corrupted. Also added checks to validate all configuration fields are present in the database or fire a warning if it finds more or less.

@DonutsNL you are on the ball! Sorry I've been away from this project for a bit. Lots going on personally and at work. I hope to dedicate some time over the next few weeks to address pull requests.