当前位置: 首页>>代码示例>>PHP>>正文


PHP Session::haveAccessToEntity方法代码示例

本文整理汇总了PHP中Session::haveAccessToEntity方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::haveAccessToEntity方法的具体用法?PHP Session::haveAccessToEntity怎么用?PHP Session::haveAccessToEntity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Session的用法示例。


在下文中一共展示了Session::haveAccessToEntity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: canCreateItem

 /**
  * Is the current user have right to create the current change ?
  *
  * @return boolean
  **/
 function canCreateItem()
 {
     if (!Session::haveAccessToEntity($this->getEntityID())) {
         return false;
     }
     return Session::haveRight(self::$rightname, CREATE);
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:12,代码来源:project.class.php

示例2: canCreateItem

 function canCreateItem()
 {
     if ($this->isPrivate() && $this->fields['users_id'] != Session::getLoginUserID()) {
         return false;
     }
     if (!$this->isPrivate() && !Session::haveAccessToEntity($this->getEntityID())) {
         return false;
     }
     return self::checkRightOnModel($this->fields['id']);
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:10,代码来源:model.class.php

示例3: methodInject

 static function methodInject($params, $protocol)
 {
     if (isset($params['help'])) {
         return array('uri' => 'string,mandatory', 'base64' => 'string,optional', 'additional' => 'array,optional', 'models_id' => 'integer, mandatory', 'entities_id' => 'integer,mandatory', 'mandatory' => 'array,optional', 'uri' => 'uri,mandatory', 'help' => 'bool,optional');
     }
     $model = new PluginDatainjectionModel();
     //-----------------------------------------------------------------
     //-------------------------- Check parameters ---------------------
     //-----------------------------------------------------------------
     if (!isset($_SESSION['glpiID'])) {
         return PluginWebservicesMethodCommon::Error($protocol, WEBSERVICES_ERROR_NOTAUTHENTICATED);
     }
     if (!isset($params['uri']) && !isset($params['base64'])) {
         return PluginWebservicesMethodCommon::Error($protocol, WEBSERVICES_ERROR_MISSINGPARAMETER, '', 'uri or base64');
     }
     if (!isset($params['models_id'])) {
         return PluginWebservicesMethodCommon::Error($protocol, WEBSERVICES_ERROR_MISSINGPARAMETER, 'models_id');
     }
     if (!$model->getFromDB($params['models_id'])) {
         return PluginWebservicesMethodCommon::Error($protocol, WEBSERVICES_ERROR_NOTFOUND, __('Model unknown', 'datainjection'));
     }
     if (!$model->can($params['models_id'], 'r')) {
         return PluginWebservicesMethodCommon::Error($protocol, WEBSERVICES_ERROR_NOTALLOWED, __('You cannot access this model', 'datainjection'));
     }
     if ($model->fields['step'] < PluginDatainjectionModel::READY_TO_USE_STEP) {
         return PluginWebservicesMethodCommon::Error($protocol, WEBSERVICES_ERROR_NOTALLOWED, __('You cannot access this model', 'datainjection'));
     }
     //Check entity
     if (!isset($params['entities_id'])) {
         return PluginWebservicesMethodCommon::Error($protocol, WEBSERVICES_ERROR_MISSINGPARAMETER, 'entities_id');
     }
     $entities_id = $params['entities_id'];
     if ($entities_id > 0) {
         $entity = new Entity();
         if (!$entity->getFromDB($entities_id)) {
             return PluginWebservicesMethodCommon::Error($protocol, WEBSERVICES_ERROR_NOTFOUND, __('Entity unknown', 'datainjection'));
         }
         if (!Session::haveAccessToEntity($entities_id)) {
             return PluginWebservicesMethodCommon::Error($protocol, WEBSERVICES_ERROR_NOTALLOWED, __('You cannot access this entity', 'datainjection'));
         }
     }
     //Mandatory fields
     $additional_infos = array();
     if (isset($params['additional']) && is_array($params['additional'])) {
         $additional_infos = $params['additional'];
     }
     //Upload CSV file
     $document_name = basename($params['uri']);
     $filename = tempnam(PLUGIN_DATAINJECTION_UPLOAD_DIR, 'PWS');
     $response = PluginWebservicesMethodCommon::uploadDocument($params, $protocol, $filename, $document_name);
     if (PluginWebservicesMethodCommon::isError($protocol, $response)) {
         return $response;
     }
     //Uploade successful : now perform import !
     $options = array('file_encoding' => PluginDatainjectionBackend::ENCODING_AUTO, 'webservice' => true, 'original_filename' => $params['uri'], 'unique_filename' => $filename, 'mode' => PluginDatainjectionModel::PROCESS, 'delete_file' => false, 'protocol' => $protocol);
     //The Webservice protocol used
     $results = array();
     $response = $model->processUploadedFile($options);
     if (!PluginWebservicesMethodCommon::isError($protocol, $response)) {
         $engine = new PluginDatainjectionEngine($model, $additional_infos, $params['entities_id']);
         //Remove first line if header is present
         $first = true;
         foreach ($model->injectionData->getDatas() as $id => $data) {
             if ($first && $model->getSpecificModel()->isHeaderPresent()) {
                 $first = false;
             } else {
                 $results[] = $engine->injectLine($data[0], $id);
             }
         }
         $model->cleanData();
         return $results;
     }
     return $response;
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:74,代码来源:webservice.class.php

示例4: pre_deleteItem

 function pre_deleteItem()
 {
     global $DB;
     $entities = Profile_User::getUserEntities($this->fields["id"]);
     $view_all = Session::isViewAllEntities();
     // Have right on all entities ?
     $all = true;
     if (!$view_all) {
         foreach ($entities as $ent) {
             if (!Session::haveAccessToEntity($ent)) {
                 $all = false;
             }
         }
     }
     if ($all) {
         // Mark as deleted
         return true;
     }
     // only delete profile
     foreach ($entities as $ent) {
         if (Session::haveAccessToEntity($ent)) {
             $all = false;
             $query = "DELETE\n                      FROM `glpi_profiles_users`\n                      WHERE `users_id` = '" . $this->fields["id"] . "'\n                            AND `entities_id` = '{$ent}'";
             $DB->query($query);
         }
         return false;
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:28,代码来源:user.class.php

示例5: showForm

 function showForm($ID, $options = array())
 {
     global $DB, $CFG_GLPI;
     $default_values = self::getDefaultValues();
     // Get default values from posted values on reload form
     // On get because of tabs
     // we use REQUEST because method differ with layout (lefttab : GET, vsplit: POST)
     if (!isset($options['template_preview'])) {
         if (isset($_REQUEST)) {
             $values = Html::cleanPostForTextArea($_REQUEST);
         }
     }
     // Restore saved value or override with page parameter
     $saved = $this->restoreInput();
     foreach ($default_values as $name => $value) {
         if (!isset($values[$name])) {
             if (isset($saved[$name])) {
                 $values[$name] = $saved[$name];
             } else {
                 $values[$name] = $value;
             }
         }
     }
     if (isset($values['content'])) {
         // Clean new lines to be fix encoding
         $order = array('\\r', '\\n', "\\");
         $replace = array("", "", "");
         $values['content'] = str_replace($order, $replace, $values['content']);
     }
     if (isset($values['name'])) {
         $values['name'] = str_replace("\\", "", $values['name']);
     }
     if (!$ID) {
         // Override defaut values from projecttask if needed
         if (isset($options['_projecttasks_id'])) {
             $pt = new ProjectTask();
             if ($pt->getFromDB($options['_projecttasks_id'])) {
                 $values['name'] = $pt->getField('name');
                 $values['content'] = $pt->getField('name');
             }
         }
     }
     // Check category / type validity
     if ($values['itilcategories_id']) {
         $cat = new ITILCategory();
         if ($cat->getFromDB($values['itilcategories_id'])) {
             switch ($values['type']) {
                 case self::INCIDENT_TYPE:
                     if (!$cat->getField('is_incident')) {
                         $values['itilcategories_id'] = 0;
                     }
                     break;
                 case self::DEMAND_TYPE:
                     if (!$cat->getField('is_request')) {
                         $values['itilcategories_id'] = 0;
                     }
                     break;
                 default:
                     break;
             }
         }
     }
     // Default check
     if ($ID > 0) {
         $this->check($ID, READ);
     } else {
         // Create item
         $this->check(-1, CREATE, $values);
     }
     if (!$ID) {
         $this->userentities = array();
         if ($values["_users_id_requester"]) {
             //Get all the user's entities
             $all_entities = Profile_User::getUserEntities($values["_users_id_requester"], true, true);
             //For each user's entity, check if the technician which creates the ticket have access to it
             foreach ($all_entities as $tmp => $ID_entity) {
                 if (Session::haveAccessToEntity($ID_entity)) {
                     $this->userentities[] = $ID_entity;
                 }
             }
         }
         $this->countentitiesforuser = count($this->userentities);
         if ($this->countentitiesforuser > 0 && !in_array($this->fields["entities_id"], $this->userentities)) {
             // If entity is not in the list of user's entities,
             // then use as default value the first value of the user's entites list
             $this->fields["entities_id"] = $this->userentities[0];
             // Pass to values
             $values['entities_id'] = $this->userentities[0];
         }
     }
     if ($values['type'] <= 0) {
         $values['type'] = Entity::getUsedConfig('tickettype', $values['entities_id'], '', Ticket::INCIDENT_TYPE);
     }
     if (!isset($options['template_preview'])) {
         $options['template_preview'] = 0;
     }
     // Load ticket template if available :
     if ($ID) {
         $tt = $this->getTicketTemplateToUse($options['template_preview'], $this->fields['type'], $this->fields['itilcategories_id'], $this->fields['entities_id']);
     } else {
//.........这里部分代码省略.........
开发者ID:glpi-project,项目名称:glpi,代码行数:101,代码来源:ticket.class.php

示例6: canCreateItem

 function canCreateItem()
 {
     $user = new User();
     return $user->can($this->fields['users_id'], READ) && Profile::currentUserHaveMoreRightThan(array($this->fields['profiles_id'] => $this->fields['profiles_id'])) && Session::haveAccessToEntity($this->fields['entities_id']);
 }
开发者ID:Ixertec,项目名称:glpi,代码行数:5,代码来源:profile_user.class.php

示例7: showNotificationOptions

 static function showNotificationOptions(Entity $entity)
 {
     $con_spotted = false;
     $ID = $entity->getField('id');
     if (!$entity->can($ID, 'r')) {
         return false;
     }
     // Notification right applied
     $canedit = Session::haveRight('notification', 'w') && Session::haveAccessToEntity($ID);
     // Get data
     $entitynotification = new PluginAdditionalalertsOcsAlert();
     if (!$entitynotification->getFromDBbyEntity($ID)) {
         $entitynotification->getEmpty();
     }
     if ($canedit) {
         echo "<form method='post' name=form action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
     }
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr class='tab_bg_1'><td>" . __('New imported computers from OCS-NG', 'additionalalerts') . "</td><td>";
     $default_value = $entitynotification->fields['use_newocs_alert'];
     Alert::dropdownYesNo(array('name' => "use_newocs_alert", 'value' => $default_value, 'inherit_global' => 1));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td >" . __('OCS-NG Synchronization alerts', 'additionalalerts') . "</td><td>";
     Alert::dropdownIntegerNever('delay_ocs', $entitynotification->fields["delay_ocs"], array('max' => 99, 'inherit_global' => 1));
     echo "&nbsp;" . _n('Day', 'Days', 2) . "</td>";
     echo "</tr>";
     if ($canedit) {
         echo "<tr>";
         echo "<td class='tab_bg_2 center' colspan='4'>";
         echo "<input type='hidden' name='entities_id' value='{$ID}'>";
         if ($entitynotification->fields["id"]) {
             echo "<input type='hidden' name='id' value=\"" . $entitynotification->fields["id"] . "\">";
             echo "<input type='submit' name='update' value=\"" . _sx('button', 'Save') . "\" class='submit' >";
         } else {
             echo "<input type='submit' name='add' value=\"" . _sx('button', 'Save') . "\" class='submit' >";
         }
         echo "</td></tr>";
         echo "</table>";
         Html::closeForm();
     } else {
         echo "</table>";
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:43,代码来源:ocsalert.class.php

示例8: displayReservationDay

 /**
  * Display for reservation
  *
  * @param $ID     ID a the reservation item (empty to show all)
  * @param $date   date to display
  **/
 static function displayReservationDay($ID, $date)
 {
     global $DB;
     if (!empty($ID)) {
         self::displayReservationsForAnItem($ID, $date);
     } else {
         $debut = $date . " 00:00:00";
         $fin = $date . " 23:59:59";
         $query = "SELECT DISTINCT `glpi_reservationitems`.`id`\n                   FROM `glpi_reservationitems`\n                   INNER JOIN `glpi_reservations`\n                     ON (`glpi_reservationitems`.`id` = `glpi_reservations`.`reservationitems_id`)\n                   WHERE `is_active` = '1'\n                         AND '" . $debut . "' < `end`\n                         AND '" . $fin . "' > `begin`\n                   ORDER BY `begin`";
         $result = $DB->query($query);
         if ($DB->numrows($result) > 0) {
             $m = new ReservationItem();
             while ($data = $DB->fetch_assoc($result)) {
                 $m->getFromDB($data['id']);
                 if (!($item = getItemForItemtype($m->fields["itemtype"]))) {
                     continue;
                 }
                 if ($item->getFromDB($m->fields["items_id"]) && Session::haveAccessToEntity($item->fields["entities_id"])) {
                     $typename = $item->getTypeName();
                     if ($m->fields["itemtype"] == 'Peripheral') {
                         if (isset($item->fields["peripheraltypes_id"]) && $item->fields["peripheraltypes_id"] != 0) {
                             $typename = Dropdown::getDropdownName("glpi_peripheraltypes", $item->fields["peripheraltypes_id"]);
                         }
                     }
                     list($annee, $mois, $jour) = explode("-", $date);
                     echo "<tr class='tab_bg_1'><td>";
                     echo "<a href='reservation.php?reservationitems_id=" . $data['id'] . "&amp;mois_courant={$mois}&amp;annee_courante={$annee}'>" . sprintf(__('%1$s - %2$s'), $typename, $item->getName()) . "</a></td></tr>\n";
                     echo "<tr><td>";
                     self::displayReservationsForAnItem($data['id'], $date);
                     echo "</td></tr>\n";
                 }
             }
         }
     }
 }
开发者ID:btry,项目名称:glpi,代码行数:41,代码来源:reservation.class.php

示例9: showForUser

 /**  Show groups of a user
  *
  * @param $user   User object
  **/
 static function showForUser(User $user)
 {
     global $CFG_GLPI;
     $ID = $user->fields['id'];
     if (!Group::canView() || !$user->can($ID, READ)) {
         return false;
     }
     $canedit = $user->can($ID, UPDATE);
     $rand = mt_rand();
     $groups = self::getUserGroups($ID);
     $used = array();
     if (!empty($groups)) {
         foreach ($groups as $data) {
             $used[$data["id"]] = $data["id"];
         }
     }
     if ($canedit) {
         echo "<div class='firstbloc'>";
         echo "<form name='groupuser_form{$rand}' id='groupuser_form{$rand}' method='post'";
         echo " action='" . Toolbox::getItemTypeFormURL('User') . "'>";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr class='tab_bg_1'><th colspan='6'>" . __('Associate to a group') . "</th></tr>";
         echo "<tr class='tab_bg_2'><td class='center'>";
         echo "<input type='hidden' name='users_id' value='{$ID}'>";
         // All entities "edited user" have access
         $strict_entities = Profile_User::getUserEntities($ID, true);
         // Keep only entities "connected user" have access
         foreach ($strict_entities as $key => $val) {
             if (!Session::haveAccessToEntity($val)) {
                 unset($strict_entities[$key]);
             }
         }
         $nb = countElementsInTableForEntity("glpi_groups", $strict_entities, '`is_usergroup`');
         if ($nb > count($used)) {
             Group::dropdown(array('entity' => $strict_entities, 'used' => $used, 'condition' => '`is_usergroup`'));
             echo "</td><td>" . __('Manager') . "</td><td>";
             Dropdown::showYesNo('is_manager');
             echo "</td><td>" . __('Delegatee') . "</td><td>";
             Dropdown::showYesNo('is_userdelegate');
             echo "</td><td class='tab_bg_2 center'>";
             echo "<input type='submit' name='addgroup' value=\"" . _sx('button', 'Add') . "\"\n                   class='submit'>";
         } else {
             _e('None');
         }
         echo "</td></tr>";
         echo "</table>";
         Html::closeForm();
         echo "</div>";
     }
     echo "<div class='spaced'>";
     if ($canedit && count($used)) {
         $rand = mt_rand();
         Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
         echo "<input type='hidden' name='users_id' value='" . $user->fields['id'] . "'>";
         $massiveactionparams = array('num_displayed' => count($used), 'container' => 'mass' . __CLASS__ . $rand);
         Html::showMassiveActions($massiveactionparams);
     }
     echo "<table class='tab_cadre_fixehov table-striped table-hover'>";
     $header_begin = "<tr>";
     $header_top = '';
     $header_bottom = '';
     $header_end = '';
     if ($canedit && count($used)) {
         $header_begin .= "<th width='10'>";
         $header_top .= Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
         $header_bottom .= Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
         $header_end .= "</th>";
     }
     $header_end .= "<th>" . Group::getTypeName(1) . "</th>";
     $header_end .= "<th>" . __('Dynamic') . "</th>";
     $header_end .= "<th>" . __('Manager') . "</th>";
     $header_end .= "<th>" . __('Delegatee') . "</th></tr>";
     echo $header_begin . $header_top . $header_end;
     $group = new Group();
     if (!empty($groups)) {
         Session::initNavigateListItems('Group', sprintf(__('%1$s = %2$s'), User::getTypeName(1), $user->getName()));
         foreach ($groups as $data) {
             if (!$group->getFromDB($data["id"])) {
                 continue;
             }
             Session::addToNavigateListItems('Group', $data["id"]);
             echo "<tr class='tab_bg_1'>";
             if ($canedit && count($used)) {
                 echo "<td width='10'>";
                 Html::showMassiveActionCheckBox(__CLASS__, $data["linkID"]);
                 echo "</td>";
             }
             $link = $data["completename"];
             if ($_SESSION["glpiis_ids_visible"]) {
                 $link = sprintf(__('%1$s (%2$s)'), $link, $data["id"]);
             }
             $href = "<a href='" . $CFG_GLPI["root_doc"] . "/front/group.form.php?id=" . $data["id"] . "'>" . $link . "</a>";
             if ($data["is_dynamic"]) {
                 $href = sprintf(__('%1$s (%2$s)'), $href, "<span class='b'>" . __('D') . "</span>");
             }
             echo "<td>" . $group->getLink() . "</td>";
//.........这里部分代码省略.........
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:101,代码来源:group_user.class.php

示例10: showNotificationOptions

 static function showNotificationOptions(Entity $entity)
 {
     $con_spotted = false;
     $ID = $entity->getField('id');
     if (!$entity->can($ID, 'r')) {
         return false;
     }
     // Notification right applied
     $canedit = Session::haveRight('notification', 'w') && Session::haveAccessToEntity($ID);
     // Get data
     $entitynotification = new PluginAdditionalalertsInfocomAlert();
     if (!$entitynotification->getFromDBbyEntity($ID)) {
         $entitynotification->getEmpty();
     }
     if ($canedit) {
         echo "<form method='post' name=form action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
     }
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='2'>" . __('Alarms options') . "</th></tr>";
     echo "<tr class='tab_bg_1'><td>" . PluginAdditionalalertsInfocomAlert::getTypeName(2) . "</td><td>";
     $default_value = $entitynotification->fields['use_infocom_alert'];
     Alert::dropdownYesNo(array('name' => "use_infocom_alert", 'value' => $default_value, 'inherit_global' => 1));
     echo "</td></tr>";
     if ($canedit) {
         echo "<tr>";
         echo "<td class='tab_bg_2 center' colspan='4'>";
         echo "<input type='hidden' name='entities_id' value='{$ID}'>";
         if ($entitynotification->fields["id"]) {
             echo "<input type='hidden' name='id' value=\"" . $entitynotification->fields["id"] . "\">";
             echo "<input type='submit' name='update' value=\"" . _sx('button', 'Save') . "\" class='submit' >";
         } else {
             echo "<input type='submit' name='add' value=\"" . _sx('button', 'Save') . "\" class='submit' >";
         }
         echo "</td></tr>";
         echo "</table>";
         Html::closeForm();
     } else {
         echo "</table>";
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:40,代码来源:infocomalert.class.php

示例11: showNotesForm

 /**
  *  show notes for item
  *
  * @return nothing
  **/
 function showNotesForm()
 {
     if (!Session::haveRight("notes", "r")) {
         return false;
     }
     if (!$this->isField('notepad') || !isset($this->fields[static::getIndexName()])) {
         return false;
     }
     //getFromDB
     $canedit = Session::haveRight("notes", "w") && (!$this->isEntityAssign() || Session::haveAccessToEntity($this->getEntityID()));
     $target = $this->getFormURL();
     if ($canedit) {
         echo "<form name='form' method='post' action='" . $target . "'>";
     }
     echo "<div class='center'>";
     echo "<table class='tab_cadre_fixe' >";
     echo "<tr><th>" . __('Notes') . "</th></tr>";
     echo "<tr><td class='tab_bg_1 center middle'>";
     echo "<textarea class='textarea_notes' cols='100' rows='35' name='notepad'>" . $this->getField('notepad') . "</textarea></td></tr>";
     echo "<tr><td class='tab_bg_2 center'>";
     echo "<input type='hidden' name='id' value='" . $this->fields['id'] . "'>";
     // for all objects without id as primary key
     if (static::getIndexName() != 'id') {
         echo "<input type='hidden' name='" . static::getIndexName() . "' value='" . $this->fields[static::getIndexName()] . "'>";
     }
     if ($canedit) {
         echo "<input type='submit' name='update' value=\"" . _sx('button', 'Save') . "\" class='submit'>";
     }
     echo "</td></tr>";
     echo "</table></div>";
     if ($canedit) {
         Html::closeForm();
     }
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:39,代码来源:commondbtm.class.php

示例12: canDeleteItem

 /**
  * Is the current user have right to delete the current problem ?
  *
  * @since version 0.84
  *
  * @return boolean
  **/
 function canDeleteItem()
 {
     if (!Session::haveAccessToEntity($this->getEntityID())) {
         return false;
     }
     return Session::haveRight('delete_problem', '1');
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:14,代码来源:problem.class.php

示例13: canUpdateItem

 function canUpdateItem()
 {
     return $this->fields['users_id'] == Session::getLoginUserID() || !$this->fields['is_private'] && Session::haveRight('bookmark_public', 'w') && Session::haveAccessToEntity($this->fields['entities_id']);
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:4,代码来源:bookmark.class.php

示例14: transferComputer

 /**
  * Do automatic transfer if option is enable
  *
  * @param $line_links array : data from glpi_plugin_ocsinventoryng_ocslinks table
  * @param $line_ocs array : data from ocs tables
  *
  * @return nothing
  **/
 static function transferComputer($line_links, $line_ocs)
 {
     global $DB, $PluginOcsinventoryngDBocs, $CFG_GLPI;
     // Get all rules for the current plugin_ocsinventoryng_ocsservers_id
     $rule = new RuleImportEntityCollection();
     $data = array();
     $data = $rule->processAllRules(array('ocsservers_id' => $line_links["plugin_ocsinventoryng_ocsservers_id"], '_source' => 'ocsinventoryng'), array(), array('ocsid' => $line_links["ocsid"]));
     // If entity is changing move items to the new entities_id
     if (isset($data['entities_id']) && $data['entities_id'] != $line_links['entities_id']) {
         if (!isCommandLine() && !Session::haveAccessToEntity($data['entities_id'])) {
             Html::displayRightError();
         }
         $transfer = new Transfer();
         $transfer->getFromDB($CFG_GLPI['transfers_id_auto']);
         $item_to_transfer = array("Computer" => array($line_links['computers_id'] => $line_links['computers_id']));
         $transfer->moveItems($item_to_transfer, $data['entities_id'], $transfer->fields);
     }
     //If location is update by a rule
     self::updateLocation($line_links, $data);
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:28,代码来源:ocsserver.class.php

示例15: checkEntity

 /**
  * Check if have right on this entity
  *
  * @param $recursive   boolean    set true to accept recursive items of ancestors
  *                                of active entities (View case for example) (default false)
  * @since version 0.85
  *
  * @return booleen
  **/
 function checkEntity($recursive = false)
 {
     // Is an item assign to an entity
     if ($this->isEntityAssign()) {
         // Can be recursive check
         if ($recursive && $this->maybeRecursive()) {
             return Session::haveAccessToEntity($this->getEntityID(), $this->isRecursive());
         }
         //  else : No recursive item         // Have access to entity
         return Session::haveAccessToEntity($this->getEntityID());
     }
     // else : Global item
     return true;
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:23,代码来源:commondbtm.class.php


注:本文中的Session::haveAccessToEntity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。