ericferon / glpi-archimap

GLPI plugin for drawing architecture maps (based on draw.io)
GNU General Public License v2.0
19 stars 10 forks source link

Fails to install on 10.0.0 - The action you have requested is not allowed #59

Closed derry43 closed 2 years ago

derry43 commented 2 years ago

Plugin version: 3.2.6 GLPI version: 10.0.0 PHP version: 7.4

Manual installation via plugins folder on 10.0.0 (with existing config, so upgrade of plugin) produces a single error during install "The action you have requested is not allowed" from page front/plugin.form.php.

Related log file entries below.

[2022-04-21 18:51:57] glpiphplog.WARNING:   *** PHP Warning (2): Cannot modify header information - headers already sent by (output started at C:\inetpub\wwwroot\glpi10x\src\Application\ErrorHandler.php:533) in C:\inetpub\wwwroot\glpi10x\src\Html.php at line 1187
  Backtrace :
  src\Html.php:1187                                  header()
  src\Html.php:1746                                  Html::includeHeader()
  front\plugin.php:43                                Html::header()

[2022-04-21 18:51:57] glpiphplog.WARNING:   *** PHP Warning (2): Cannot modify header information - headers already sent by (output started at C:\inetpub\wwwroot\glpi10x\src\Application\ErrorHandler.php:533) in C:\inetpub\wwwroot\glpi10x\src\Html.php at line 1189
  Backtrace :
  src\Html.php:1189                                  header()
  src\Html.php:1746                                  Html::includeHeader()
  front\plugin.php:43                                Html::header()

[2022-04-21 18:51:57] glpiphplog.WARNING:   *** PHP Warning (2): Cannot modify header information - headers already sent by (output started at C:\inetpub\wwwroot\glpi10x\src\Application\ErrorHandler.php:533) in C:\inetpub\wwwroot\glpi10x\src\Html.php at line 2207
  Backtrace :
  src\Html.php:2207                                  header()
  src\Html.php:1192                                  Html::header_nocache()
  src\Html.php:1746                                  Html::includeHeader()
  front\plugin.php:43                                Html::header()

[2022-04-21 18:51:57] glpiphplog.WARNING:   *** PHP Warning (2): Cannot modify header information - headers already sent by (output started at C:\inetpub\wwwroot\glpi10x\src\Application\ErrorHandler.php:533) in C:\inetpub\wwwroot\glpi10x\src\Html.php at line 2208
  Backtrace :
  src\Html.php:2208                                  header()
  src\Html.php:1192                                  Html::header_nocache()
  src\Html.php:1746                                  Html::includeHeader()
  front\plugin.php:43                                Html::header()

[2022-04-21 18:52:11] glpiphplog.NOTICE:   *** PHP Notice (8): Undefined variable: CFG_GLPI in C:\inetpub\wwwroot\glpi10x\inc\includes.php at line 155
  Backtrace :
  plugins\archimap\scripts\copystylestodb.php:35     include()
  plugins\archimap\hook.php:78                       include()
  src\Plugin.php:773                                 plugin_archimap_install()
  front\plugin.form.php:49                           Plugin->install()

[2022-04-21 18:52:11] glpiphplog.NOTICE:   *** PHP Notice (8): Trying to access array offset on value of type null in C:\inetpub\wwwroot\glpi10x\inc\includes.php at line 155
  Backtrace :
  plugins\archimap\scripts\copystylestodb.php:35     include()
  plugins\archimap\hook.php:78                       include()
  src\Plugin.php:773                                 plugin_archimap_install()
  front\plugin.form.php:49                           Plugin->install()
derry43 commented 2 years ago

The issue is related to how this plugin handles CSRF, see https://github.com/glpi-project/glpi/issues/1133, had to set the constant GLPI_USE_CSRF_CHECK to 0 during install of archimap plugin (as well as implementing below changes) to allow installation.

Also tracked down a couple of issues (related to the above errors, but not to the installation problem).

Line 28 in plugins\archimap\hook.php was

   global $DB;

but should be

   global $DB, $CFG_GLPI;

Line 177 in plugins\archimap\hook.php was

   if (Session::haveRight("plugin_archimap_open_ticket", "1")) {

but should be

   if (Session::haveRight("plugin_archimap_open_ticket", READ)) {
ericferon commented 2 years ago

Thank you for the remarks and suggestions. Solved in v3.2.7. K.r,