You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2013-05-09 11:52:47

geoalbi
Member
From: Romania
Registered: 2012-12-18
Posts: 182

Moving entity node clears values in ancestors_cache column

I previously reported one of the symptoms of this here: http://www.glpi-project.org/forum/viewt … p?id=32322

Problem:
Moving an entity node clears values in glpi_entities, ancestors_cache column for the moved entities.

Symptoms:
1. the one reported in the link above;
2. user can not change entity to one in the moved node if the profile rights are assigned recursive at the parent node.

Workaround:
Database update.
First, select:

select * from glpi_entities;

Note that the ancestors_cache for all the moved entities are cleared (set to NULL)
Note the parent entities tree, write down the entities IDs.
Update each moved entity by setting the ancestors_cache right
Example:
This fixes the entity with the parents: 0, 1, 4 (IDs should be provided in the correct order):

update glpi_entities set ancestors_cache = '{"0":"0","1":"1","4":"4"}' where id = 5

Last edited by geoalbi (2013-05-10 15:38:57)

Offline

#2 2013-05-14 12:04:09

MoYo
GLPI - Lead
From: Poitiers
Registered: 2004-09-13
Posts: 14,513
Website

Re: Moving entity node clears values in ancestors_cache column

ancestors_cache will be updated on next acces to it through : getAncestorsOf('glpi_entities', $ID)


MoYo - Julien Dombre - Association INDEPNET
Contribute to GLPI :    Support     Contribute     References     Freshmeat

Offline

#3 2013-05-21 16:09:08

geoalbi
Member
From: Romania
Registered: 2012-12-18
Posts: 182

Re: Moving entity node clears values in ancestors_cache column

MoYo wrote:

ancestors_cache will be updated on next acces to it through : getAncestorsOf('glpi_entities', $ID)

I don't understand when: I put a var_dump ($query) and die() in getAncestorsOf clicked a lot in the entities menu and it is never called.

I tried to figure out, but I don't get it:

When an entity is created:
- the new entity is created with ancestors_cache and sons_cache NULL;
- ancestors_cache and sons_cache for all the other entities are updated;

Moving an entity sets ancestors_cache to NULL for all child entities of the moved one.

If I got this right, regenerateTreeUnderID() in commontreedropdown.class.php should regenerate the ancestors_cache, but it always sets it to NULL. Example of the querry generated:

"UPDATE `glpi_entities` SET `completename`='test > subtest', `ancestors_cache` = NULL, `level` = '2' WHERE `id`= '8'"

I don't know how to better explain this (other than learning PHP and fixing it myself), but not being able to select an entity where the user has authorization inherited recursively is a critical issue.

I have a setup where departments are entities and technicians are supposed to create tickets within each entity. Once an entity tree was moved, the technicians are no longer able to select the subentities under that tree. They can see them, but not select them.

Last edited by geoalbi (2013-05-21 16:49:17)

Offline

Board footer

Powered by FluxBB