• OKMDocument - set author?

  • Do you want to create a native client or integrate with third party applications: webservices are the solution.
Do you want to create a native client or integrate with third party applications: webservices are the solution.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #22282  by dejanfc
 
Hi

Just wondering if it's possible to set author when uploading a new document via WS. According to the php sample on wiki There's a way to set the author, but when I execute the script it returns the uploader as author. Idea behind this is to use a system uploader account that would only set the name of Author, permissions and everything else that comes along with the file upload can stay as they are, as this would only be used for keeping track of user activity.

OKM version: 6.2.1

Php sample that I used:

(I set the author as)
Code: Select all
'author' => 'username_that_I_send_as_string'
Code: Select all
<?php
  // Register WSDL
  $OKMAuth = new SoapClient('http://localhost:8080/OpenKM/services/OKMAuth?wsdl');
  $OKMDocument = new SoapClient('http://localhost:8080/OpenKM/services/OKMDocument?wsdl');
  $file = '/etc/hosts';
 
  // Login
  $loginResp = $OKMAuth->login(array('user' => 'okmAdmin', 'password' => 'admin'));
  $token = $loginResp->return;
  echo "Token: ".$token."<br>";
 
  // Create document
  $doc = array('path' => '/okm:root/hosts.txt', 'mimeType' => null,
    'actualVersion' => null, 'author' => null, 'checkedOut' => false,
    'created' => null, 'keywords' => 'nada', 'language' => null,
    'lastModified' => null, 'lockInfo' => null, 'locked' => false,
    'permissions' => 0, 'size' => 0, 'subscribed' => false, 'uuid' => null,
    'convertibleToPdf' => false, 'convertibleToSwf' => false,
    'compactable' => false, 'training' => false, 'convertibleToDxf' => false);
 
  $createResp = $OKMDocument->create(array('token' => $token, 'doc' => $doc, 'content' => file_get_contents($file)));
  $newDoc = $createResp->return;
  echo "[DOCUMENT] Path: ".$newDoc->path.", Author: ".$newDoc->author.", Size: ".$newDoc->actualVersion->size."<br>";
 
  // Logout
  $OKMAuth->logout(array('token' => $token));
?>
 #22303  by jllort
 
The author is directly taken by the ws user logged. Has no effect change it.
 #22338  by pavila
 
If you want to a change a document author you need to attach the database, but may cause inconsistency problems in information stored in several tables. In short: I don't recommend it.

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.