Le 21/07/2011 12:55, Damien Touraine a écrit :
Hi,
Is there a way to know the rights for the current user on another entity than the current one ? For instance, we are inside the "A" entity, and we want to know if the current user has rights for write networking inside entity "B".

I can use :

$currentEntity = $_SESSION["glpiactive_entity"]; // That should be equal the "A id"
changeActiveEntities("B id");
$allowed = haveRights('networking', 'w');
changeActiveEntities($currentEntity); // Go back to "A" entity
...

But I think it should be to rough.


Hi,

What is the real usage of this checks ?
Check to know if you can add / update an item ?

For an item checking the right add on a specific entity
$item->can(-1,'w',array('entities_id'=>$entities_id));
you can add others params if needed in third argument.

Regards

Julien





KR
    Damien Touraine



_______________________________________________
Glpi-dev mailing list
Glpi-dev@gna.org
https://mail.gna.org/listinfo/glpi-dev

Reply via email to