Commit d7a4690e5b8a9d4e01fbdaa7265ba9956cf5b916

Authored by kevin_fourie
1 parent bc9e8d33

Merged in from DEV trunk...

WSA-67
"Add error code for unknown document type"
Fixed.

Committed By: Conrad Vermeulen
Reviewed By: Martin Kirsten

WSA-96
"Adding a document via web service should default to default document type if it does not exist. This is compatible with previous DWI operations"
Fixed.

Committed By: Conrad Vermeulen
Reviewed By: Megan Watson

KTS-2648
"KT granted access to all databases"
Fixed. Applied suggested change from Kenny Horan. Thanks!

Committed By: Kevin Fourie
Reviewed By: Conrad Vermeulen

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@8046 c91229c3-7414-0410-bfa2-8a42b809f60b
ktapi/KTAPIDocument.inc.php
@@ -1611,7 +1611,7 @@ class KTAPI_Document extends KTAPI_FolderItem @@ -1611,7 +1611,7 @@ class KTAPI_Document extends KTAPI_FolderItem
1611 $detail['workflow_state']=$workflowstate; 1611 $detail['workflow_state']=$workflowstate;
1612 1612
1613 // get the full path 1613 // get the full path
1614 - $detail['full_path'] = $this->ktapi_folder->get_full_path() . '/' . $this->get_title(); 1614 + $detail['full_path'] = '/' . $this->document->getFullPath();
1615 1615
1616 // get mime info 1616 // get mime info
1617 $mimetypeid = $document->getMimeTypeID(); 1617 $mimetypeid = $document->getMimeTypeID();
ktapi/KTAPIFolder.inc.php
@@ -210,8 +210,8 @@ class KTAPI_Folder extends KTAPI_FolderItem @@ -210,8 +210,8 @@ class KTAPI_Folder extends KTAPI_FolderItem
210 210
211 function get_full_path() 211 function get_full_path()
212 { 212 {
213 - $path = $this->folder->getFullPath() . '/' . $this->folder->getName();  
214 - if (substr($path,0,1) == '/') $path = substr($path,1); 213 + $path = $this->folder->getFullPath();
  214 + if (empty($path)) $path = '/';
215 215
216 return $path; 216 return $path;
217 } 217 }
@@ -604,7 +604,7 @@ class KTAPI_Folder extends KTAPI_FolderItem @@ -604,7 +604,7 @@ class KTAPI_Folder extends KTAPI_FolderItem
604 } 604 }
605 else 605 else
606 { 606 {
607 - return new PEAR_Error('The document type could not be resolved or is disabled: ' . $documenttype); 607 + return new KTAPI_DocumentTypeError('The document type could not be resolved or is disabled: ' . $documenttype);
608 } 608 }
609 } 609 }
610 610
ktapi/ktapi.inc.php
@@ -70,7 +70,7 @@ class KTAPI_FolderItem @@ -70,7 +70,7 @@ class KTAPI_FolderItem
70 70
71 class KTAPI_Error extends PEAR_Error 71 class KTAPI_Error extends PEAR_Error
72 { 72 {
73 - function KTAPI_Error($msg, $obj) 73 + function KTAPI_Error($msg, $obj = null)
74 { 74 {
75 if (PEAR::isError($obj)) 75 if (PEAR::isError($obj))
76 { 76 {
@@ -83,6 +83,8 @@ class KTAPI_Error extends PEAR_Error @@ -83,6 +83,8 @@ class KTAPI_Error extends PEAR_Error
83 } 83 }
84 } 84 }
85 85
  86 +class KTAPI_DocumentTypeError extends KTAPI_Error {}
  87 +
86 class KTAPI 88 class KTAPI
87 { 89 {
88 /** 90 /**
ktwebservice/webservice.php
@@ -1951,7 +1951,8 @@ class KTWebService @@ -1951,7 +1951,8 @@ class KTWebService
1951 $document = &$folder->add_document($title, $filename, $documenttype, $tempfilename); 1951 $document = &$folder->add_document($title, $filename, $documenttype, $tempfilename);
1952 if (PEAR::isError($document)) 1952 if (PEAR::isError($document))
1953 { 1953 {
1954 - $response = KTWebService::_status(KTWS_ERR_INVALID_DOCUMENT,$document); 1954 + $status = is_a($document, 'KTAPI_DocumentTypeError')?KTWS_ERR_INVALID_DOCUMENT_TYPE:KTWS_ERR_INVALID_DOCUMENT;
  1955 + $response = KTWebService::_status($status, $document);
1955 $this->debug("add_document - cannot add document - " . $document->getMessage(), $session_id); 1956 $this->debug("add_document - cannot add document - " . $document->getMessage(), $session_id);
1956 return new SOAP_Value('return',"{urn:$this->namespace}kt_document_detail", $response); 1957 return new SOAP_Value('return',"{urn:$this->namespace}kt_document_detail", $response);
1957 } 1958 }
@@ -2130,7 +2131,8 @@ class KTWebService @@ -2130,7 +2131,8 @@ class KTWebService
2130 $document = &$folder->add_document($title, $filename, $documenttype, $tempfilename); 2131 $document = &$folder->add_document($title, $filename, $documenttype, $tempfilename);
2131 if (PEAR::isError($document)) 2132 if (PEAR::isError($document))
2132 { 2133 {
2133 - $response = KTWebService::_status(KTWS_ERR_INVALID_DOCUMENT,$document); 2134 + $status = is_a($document, 'KTAPI_DocumentTypeError')?KTWS_ERR_INVALID_DOCUMENT_TYPE:KTWS_ERR_INVALID_DOCUMENT;
  2135 + $response = KTWebService::_status($status,$document);
2134 2136
2135 $this->debug("add_small_document - cannot add document - " . $document->getMessage(), $session_id); 2137 $this->debug("add_small_document - cannot add document - " . $document->getMessage(), $session_id);
2136 return new SOAP_Value('return',"{urn:$this->namespace}kt_document_detail", $response); 2138 return new SOAP_Value('return',"{urn:$this->namespace}kt_document_detail", $response);
sql/mysql/install/user.sql
@@ -34,6 +34,6 @@ @@ -34,6 +34,6 @@
34 -- 34 --
35 35
36 -- default dms user 36 -- default dms user
37 -GRANT SELECT, INSERT, UPDATE, DELETE ON * TO dms@localhost IDENTIFIED BY 'djw9281js'; 37 +GRANT SELECT, INSERT, UPDATE, DELETE ON dms.* TO dms@localhost IDENTIFIED BY 'djw9281js';
38 -- admin dms user 38 -- admin dms user
39 -GRANT ALL PRIVILEGES ON * TO dmsadmin@localhost IDENTIFIED BY 'js9281djw'; 39 +GRANT ALL PRIVILEGES ON dms.* TO dmsadmin@localhost IDENTIFIED BY 'js9281djw';