Page 1 of 1

OKMDocument - set author?

PostPosted:Thu Apr 04, 2013 6:41 am
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));
?>

Re: OKMDocument - set author?

PostPosted:Sat Apr 06, 2013 10:13 am
by jllort
The author is directly taken by the ws user logged. Has no effect change it.

Re: OKMDocument - set author?

PostPosted:Mon Apr 08, 2013 6:24 pm
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.