fix x gruppi
This commit is contained in:
@@ -61,6 +61,23 @@ In una nuova installazione del plugin, i campi "API username" e "API password" n
|
||||
1. **`Server.php::showFormFields()`** — Sostituito `$canUpdate` con `$canEdit`: per nuovi server (`$ID <= 0`) usa `CREATE`, per server esistenti usa `UPDATE`.
|
||||
2. **`Profile.php::installRights()`** — In assenza di sessione attiva (CLI), cerca il profilo "Super-Admin" tramite query diretta e gli assegna tutti i diritti.
|
||||
|
||||
## Bugfix: Unknown column 'users_id' — Group::getDataItems() SQL error
|
||||
|
||||
### Problema
|
||||
Su server produttivo, `Group::showItems()` generava un errore MySQL 1054 (Unknown column 'users_id') quando GLPI iterava sugli itemtype registrati con `linkgroup_types => true`. La query includeva:
|
||||
```sql
|
||||
WHERE ((... ) OR (`users_id` IN (SELECT `users_id` FROM `glpi_groups_users` WHERE `groups_id` IN ('7483'))))
|
||||
```
|
||||
La colonna `users_id` non esisteva nella tabella `glpi_plugin_urbackup_servers`.
|
||||
|
||||
### Causa
|
||||
`Server` è registrato in `setup.php:57` con `linkgroup_types => true`, il che fa sì che GLPI lo includa nelle query di `Group::getDataItems()`. Il metodo aggiunge automaticamente una condizione `users_id IN (...)` assumendo che ogni itemtype abbia tale colonna.
|
||||
|
||||
### Fix
|
||||
1. **`install/mysql/plugin_urbackup-empty.sql`** — Aggiunta colonna `users_id INT UNSIGNED NOT NULL DEFAULT 0` dopo `locations_id` + indice
|
||||
2. **`install/install.php`** — Aggiunto `$migration->addField('users_id', ...)` e `$migration->addKey('users_id')` nella migrazione del server
|
||||
3. **`src/Server.php`** — Aggiunto search option `id=8` per `User::getTable()` + auto-set di `users_id` da `$_SESSION['glpiID']` in `prepareInputForAdd()`
|
||||
|
||||
## Versione
|
||||
- 0.7.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user