diff --git a/lib/api/ktcmis/services/CMISNavigationService.inc.php b/lib/api/ktcmis/services/CMISNavigationService.inc.php index e29e2b8..60610e7 100644 --- a/lib/api/ktcmis/services/CMISNavigationService.inc.php +++ b/lib/api/ktcmis/services/CMISNavigationService.inc.php @@ -127,8 +127,7 @@ class CMISNavigationService { // if this is not a folder, cannot get children $folderId = CMISUtil::decodeObjectId($folderId, $type); // NOTE this will quite possibly break the webservices - if ($type != 'Folder') - { + if ($type != 'Folder') { return $children; } diff --git a/webservice/atompub/cmis/KT_cmis_atom_server.services.inc.php b/webservice/atompub/cmis/KT_cmis_atom_server.services.inc.php index 40f7571..6f56e6c 100644 --- a/webservice/atompub/cmis/KT_cmis_atom_server.services.inc.php +++ b/webservice/atompub/cmis/KT_cmis_atom_server.services.inc.php @@ -64,7 +64,7 @@ class KT_cmis_atom_service_folder extends KT_cmis_atom_service { // node request e.g.: node/F2 if (urldecode($this->params[0]) == 'Root Folder') { - $folderId = CMISUtil::encodeObjectId('Folder', 1); + $folderId = CMISUtil::encodeObjectId(FOLDER, 1); $folderName = urldecode($this->params[0]); } else if ($this->params[0] == 'path') diff --git a/webservice/atompub/cmis/KT_cmis_atom_service_helper.inc.php b/webservice/atompub/cmis/KT_cmis_atom_service_helper.inc.php index 8303282..3746bfd 100644 --- a/webservice/atompub/cmis/KT_cmis_atom_service_helper.inc.php +++ b/webservice/atompub/cmis/KT_cmis_atom_service_helper.inc.php @@ -531,8 +531,16 @@ class KT_cmis_atom_service_helper { { if(!isset(self::$ktapi)) { - self::$ktapi = new KTAPI(); - self::$ktapi->get_active_session(session_id()); + self::$ktapi = new KTAPI(); + $active = self::$ktapi->get_active_session(session_id()); + + if (PEAR::isError($active)) + { + // invoke auth code, session must be restarted + if(!KT_atom_HTTPauth::isLoggedIn()) { + KT_atom_HTTPauth::login('KnowledgeTree DMS', 'You must authenticate to enter this realm'); + } + } } return self::$ktapi; } diff --git a/webservice/atompub/cmis/index.php b/webservice/atompub/cmis/index.php index 325265f..4bdb7ce 100644 --- a/webservice/atompub/cmis/index.php +++ b/webservice/atompub/cmis/index.php @@ -46,12 +46,20 @@ $accessProtocol = (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on')) ? 'h define('KT_APP_BASE_URI', $accessProtocol . '://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/?/'); define('KT_APP_SYSTEM_URI', $accessProtocol . '://'.$_SERVER['HTTP_HOST']); define('KT_ATOM_LIB_FOLDER', '../../classes/atompub/'); - define('CMIS_APP_BASE_URI', trim(KT_APP_BASE_URI, '/')); define('CMIS_APP_SYSTEM_URI', KT_APP_SYSTEM_URI); define('CMIS_ATOM_LIB_FOLDER', trim(KT_ATOM_LIB_FOLDER, '/') . '/cmis/'); /** + * Check Realm Authentication + */ +require_once(KT_ATOM_LIB_FOLDER.'KT_atom_HTTPauth.inc.php'); + +if(!KT_atom_HTTPauth::isLoggedIn()) { + KT_atom_HTTPauth::login('KnowledgeTree DMS', 'You must authenticate to enter this realm'); +} + +/** * Includes */ include_once(KT_ATOM_LIB_FOLDER.'XMLns2array.inc.php'); @@ -62,17 +70,9 @@ include_once(CMIS_ATOM_LIB_FOLDER.'KT_cmis_atom_responseFeed.inc.php'); //Con include_once(CMIS_ATOM_LIB_FOLDER.'KT_cmis_atom_serviceDoc.inc.php'); //Containing the servicedoc class allowing easy ServiceDocument generation include_once(CMIS_ATOM_LIB_FOLDER.'KT_cmis_atom_service.inc.php'); //Containing the servicedoc class allowing easy ServiceDocument generation +// services include_once('KT_cmis_atom_server.services.inc.php'); -/** - * Check Realm Authentication - */ -require_once(KT_ATOM_LIB_FOLDER.'KT_atom_HTTPauth.inc.php'); - -if(!KT_atom_HTTPauth::isLoggedIn()) { - KT_atom_HTTPauth::login('KnowledgeTree DMS', 'You must authenticate to enter this realm'); -} - //Start the AtomPubProtocol Routing Engine $APP = new KT_cmis_atom_server();