OCSInventory-NG / OCSInventory-Docker-Image

Docker image for OCSInventory Server
GNU General Public License v3.0
77 stars 90 forks source link

[BUG] Custom User Profiles not migrated when upgrading to 2.12 #105

Closed Minikea closed 6 months ago

Minikea commented 11 months ago

OCS Inventory version Version : DOCKER version 2.12 [https://github.com/OCSInventory-NG/OCSInventory-Docker-Image/tree/master/2.12]

Describe the bug Custom User Profiles have been wiped during migration from 2.11 to 2.12 resulting in error 500 when user with a custom profile tries to connect.

To Reproduce Steps to reproduce the behavior:

  1. in 2.11 create a custom profile
  2. assign a user to that profile
  3. migrate DB to 2.12
  4. See error : can't login

Expected behavior Custom User Profiles should be migrated

Log file (optional) on login :

ocsinventory-server    | [Wed Aug 02 10:32:43.490701 2023] [php:error] [pid 611] [client 172.24.0.1:42650] PHP Fatal error:  Uncaught TypeError: XMLUrlsSerializer::serialize(): Argument OCSInventory-NG/OCSInventory-ocsreports#1 ($urls) must be of type Urls, bool given, called in /usr/share/ocsinventory-reports/ocsreports/require/config/include.php on line 57 and defined in /usr/share/ocsinventory-reports/ocsreports/require/config/XMLUrlsSerializer.php:29\nStack trace:\n#0 /usr/share/ocsinventory-reports/ocsreports/require/config/include.php(57): XMLUrlsSerializer->serialize()\n#1 /usr/share/ocsinventory-reports/ocsreports/require/config/include.php(46): migrate_urls_2_2()\n#2 /usr/share/ocsinventory-reports/ocsreports/backend/identity/methode/local.php(48): migrate_config_2_2()\n#3 /usr/share/ocsinventory-reports/ocsreports/backend/identity/identity.php(32): require_once('...')\n#4 /usr/share/ocsinventory-reports/ocsreports/require/header.php(330): require_once('...')\n#5 /usr/share/ocsinventory-reports/ocsreports/index.php(44): require('...')\n#6 {main}\n  thrown in /usr/share/ocsinventory-reports/ocsreports/require/config/XMLUrlsSerializer.php on line 29, referer: https://ocsreports.example.com/ocsreports/
ocsinventory-server    | 172.24.0.1 - - [02/Aug/2023:10:32:43 +0200] "POST /ocsreports/ HTTP/1.1" 500 324 "https://ocsreports.example.com/ocsreports/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 OPR/100.0.0.0"
charleneauger commented 9 months ago

Hi @Minikea ,

Thank you for your report. :-) We have added this fix to our roadmap.

I'm transferring your issue to the correct repo.

Best regards, Charlene

wiltonsr commented 8 months ago

Hi, @Minikea

This problem happens, because User Profiles are XML files saved at /usr/share/ocsinventory-reports/ocsreports/config/profiles.

You could fix the problem in your current environment by simply creating a volume mapped to the previous path mentioned.

Anyway, I will provide a PR to this problem.