Support "is_writable" API object attribute - calculates if row is accessible for write or not.

XMLWordPrintable

    • Type: New Feature Request
    • Resolution: Unresolved
    • Priority: Minor
    • None
    • Affects Version/s: 2.1.0
    • Component/s: API (A)
    • None

      Implementation example:

      CZBXAPI.php:

      
      

      /**

      • Add writable status field to result.
        *
      • @param array $result
      • @param array $options
        */
        protected function addWritableInfo($result, $options) {
        if (empty($options['is_writable'])) { return $result; }

      $pk = $this->pk($this->tableName);

      $objs = $this->get(array(
      $pk.'s' => zbx_objectValues($result, $pk),
      'editable' => true
      ));
      $objs = zbx_toHash($objs, $pk);

      foreach ($result as $id => $value)

      { $result[$id]['is_writable'] = isset($objs[$id]); }

      return $result;
      }

      
      

      Example usage:
      CTrigger->get()

      
      

      $result = $this->addWritableInfo($result, $options);

      
      

            Assignee:
            Eduards Samersovs (Inactive)
            Reporter:
            Eduards Samersovs (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated: