Commit 74be6201 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #432 in ZP/z-push from...

Merge pull request #432 in ZP/z-push from feature/ZP-1115-implement-webserviceinfo--about to develop

* commit 'c0d1478d':
  ZP-1115 Added logging.
  ZP-1115 Return the Z-Push version for WebserviceInfo->About().
parent 838c6b44
...@@ -97,6 +97,7 @@ class ZPush { ...@@ -97,6 +97,7 @@ class ZPush {
// Webservice commands // Webservice commands
const COMMAND_WEBSERVICE_DEVICE = -100; const COMMAND_WEBSERVICE_DEVICE = -100;
const COMMAND_WEBSERVICE_USERS = -101; const COMMAND_WEBSERVICE_USERS = -101;
const COMMAND_WEBSERVICE_INFO = -102;
// Latest supported State version // Latest supported State version
const STATE_VERSION = IStateMachine::STATEVERSION_02; const STATE_VERSION = IStateMachine::STATEVERSION_02;
...@@ -145,6 +146,7 @@ class ZPush { ...@@ -145,6 +146,7 @@ class ZPush {
self::COMMAND_WEBSERVICE_DEVICE => array(self::REQUESTHANDLER => "Webservice", self::PLAININPUT, self::NOACTIVESYNCCOMMAND, self::WEBSERVICECOMMAND), self::COMMAND_WEBSERVICE_DEVICE => array(self::REQUESTHANDLER => "Webservice", self::PLAININPUT, self::NOACTIVESYNCCOMMAND, self::WEBSERVICECOMMAND),
self::COMMAND_WEBSERVICE_USERS => array(self::REQUESTHANDLER => "Webservice", self::PLAININPUT, self::NOACTIVESYNCCOMMAND, self::WEBSERVICECOMMAND), self::COMMAND_WEBSERVICE_USERS => array(self::REQUESTHANDLER => "Webservice", self::PLAININPUT, self::NOACTIVESYNCCOMMAND, self::WEBSERVICECOMMAND),
self::COMMAND_WEBSERVICE_INFO => array(self::REQUESTHANDLER => "Webservice", self::PLAININPUT, self::NOACTIVESYNCCOMMAND, self::WEBSERVICECOMMAND),
); );
......
...@@ -642,7 +642,8 @@ class Utils { ...@@ -642,7 +642,8 @@ class Utils {
// Webservice commands // Webservice commands
case ZPush::COMMAND_WEBSERVICE_DEVICE: return 'WebserviceDevice'; case ZPush::COMMAND_WEBSERVICE_DEVICE: return 'WebserviceDevice';
case ZPush::COMMAND_WEBSERVICE_USERS: return 'WebserviceUsers'; case ZPush::COMMAND_WEBSERVICE_USERS: return 'WebserviceUsers';
case ZPush::COMMAND_WEBSERVICE_INFO: return 'WebserviceInfo';
} }
return false; return false;
} }
...@@ -687,6 +688,7 @@ class Utils { ...@@ -687,6 +688,7 @@ class Utils {
// Webservice commands // Webservice commands
case 'WebserviceDevice': return ZPush::COMMAND_WEBSERVICE_DEVICE; case 'WebserviceDevice': return ZPush::COMMAND_WEBSERVICE_DEVICE;
case 'WebserviceUsers': return ZPush::COMMAND_WEBSERVICE_USERS; case 'WebserviceUsers': return ZPush::COMMAND_WEBSERVICE_USERS;
case 'WebserviceInfo': return ZPush::COMMAND_WEBSERVICE_INFO;
} }
return false; return false;
} }
......
...@@ -71,9 +71,13 @@ class Webservice { ...@@ -71,9 +71,13 @@ class Webservice {
include_once('webservicedevice.php'); include_once('webservicedevice.php');
$this->server->setClass("WebserviceDevice"); $this->server->setClass("WebserviceDevice");
} }
elseif ($commandCode == ZPush::COMMAND_WEBSERVICE_INFO) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("Webservice::HandleWebservice('%s'): executing WebserviceInfo service", $commandCode));
include_once('webserviceinfo.php');
$this->server->setClass("WebserviceInfo");
}
// the webservice command is handled by its class // the webservice command is handled by its class
if ($commandCode == ZPush::COMMAND_WEBSERVICE_USERS) { elseif ($commandCode == ZPush::COMMAND_WEBSERVICE_USERS) {
if (!defined("ALLOW_WEBSERVICE_USERS_ACCESS") || ALLOW_WEBSERVICE_USERS_ACCESS !== true) if (!defined("ALLOW_WEBSERVICE_USERS_ACCESS") || ALLOW_WEBSERVICE_USERS_ACCESS !== true)
throw new HTTPReturnCodeException("Access to the WebserviceUsers service is disabled in configuration. Enable setting ALLOW_WEBSERVICE_USERS_ACCESS", 403); throw new HTTPReturnCodeException("Access to the WebserviceUsers service is disabled in configuration. Enable setting ALLOW_WEBSERVICE_USERS_ACCESS", 403);
......
<?php
/***********************************************
* File : webserviceinfo.php
* Project : Z-Push
* Descr : Provides general information for an authenticated
* user.
*
* Created : 17.06.2016
*
* Copyright 2016 Zarafa Deutschland GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation with the following additional
* term according to sec. 7:
*
* According to sec. 7 of the GNU Affero General Public License, version 3,
* the terms of the AGPL are supplemented with the following terms:
*
* "Zarafa" is a registered trademark of Zarafa B.V.
* "Z-Push" is a registered trademark of Zarafa Deutschland GmbH
* The licensing of the Program under the AGPL does not imply a trademark license.
* Therefore any rights, title and interest in our trademarks remain entirely with us.
*
* However, if you propagate an unmodified version of the Program you are
* allowed to use the term "Z-Push" to indicate that you distribute the Program.
* Furthermore you may use our trademarks where it is necessary to indicate
* the intended purpose of a product or service provided you use it in accordance
* with honest practices in industrial or commercial matters.
* If you want to propagate modified versions of the Program under the name "Z-Push",
* you may only do so if you have a written permission by Zarafa Deutschland GmbH
* (to acquire a permission please contact Zarafa at trademark@zarafa.com).
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Consult LICENSE file for details
************************************************/
class WebserviceInfo {
/**
* Returns the Z-Push version.
*
* @access public
* @return string
*/
public function About() {
ZLog::Write(LOGLEVEL_INFO, sprintf("WebserviceInfo->About(): returning Z-Push version '%s'", @constant('ZPUSH_VERSION')));
return @constant('ZPUSH_VERSION');
}
}
?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment