. * * ------------------------------------------------------------------------ * * This file is used to manage the visibility of package by user. * * ------------------------------------------------------------------------ * * @package FusionInventory * @author David Durieux * @author Alexandre Delaunay * @copyright Copyright (c) 2010-2016 FusionInventory team * @license AGPL License 3.0 or (at your option) any later version * http://www.gnu.org/licenses/agpl-3.0-standalone.html * @link http://www.fusioninventory.org/ * @link https://github.com/fusioninventory/fusioninventory-for-glpi * */ if (!defined('GLPI_ROOT')) { die("Sorry. You can't access directly to this file"); } /** * Manage the visibility of package by user. */ class PluginFusioninventoryDeployPackage_User extends CommonDBRelation { /** * Itemtype for the first part of relation * * @var string */ static public $itemtype_1 = 'PluginFusioninventoryDeployPackage'; /** * id field name for the first part of relation * * @var string */ static public $items_id_1 = 'plugin_fusioninventory_deploypackages_id'; /** * Itemtype for the second part of relation * * @var string */ static public $itemtype_2 = 'User'; /** * id field name for the second part of relation * * @var string */ static public $items_id_2 = 'users_id'; /** * Set we don't check parent right of the second item * * @var integer */ static public $checkItem_2_Rights = self::DONT_CHECK_ITEM_RIGHTS; /** * Logs for the second item are disabled * * @var type */ static public $logs_for_item_2 = false; /** * Get users for a deploypackage * * @global object $DB * @param integer $deploypackages_id ID of the deploypackage * @return array list of users linked to a deploypackage **/ static function getUsers($deploypackages_id) { global $DB; $users = []; $query = "SELECT `glpi_plugin_fusioninventory_deploypackages_users`.* FROM `glpi_plugin_fusioninventory_deploypackages_users` WHERE `plugin_fusioninventory_deploypackages_id` = '$deploypackages_id'"; foreach ($DB->request($query) as $data) { $users[$data['users_id']][] = $data; } return $users; } }