Commit 7dfa1a34 authored by speedprogs_de's avatar speedprogs_de
Browse files

used frontend username instead of id, added ter service, fixed datetime...

used frontend username instead of id, added ter service, fixed datetime viewhelper, added more methods to soap service

git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/terfe/branches/ter_fe2@52059 735d13b6-9817-0410-8766-e36946ffe9aa
parent b99d1acb
......@@ -80,7 +80,7 @@
/**
* Frontend user
* @var Tx_Extbase_Domain_Model_FrontendUser
* @var string
*/
protected $frontendUser;
......@@ -336,10 +336,10 @@
/**
* Setter for frontendUser
*
* @param Tx_Extbase_Domain_Model_FrontendUser $frontendUser Frontend user
* @param string $frontendUser Frontend user
* @return void
*/
public function setFrontendUser(Tx_Extbase_Domain_Model_FrontendUser $frontendUser) {
public function setFrontendUser($frontendUser) {
$this->frontendUser = $frontendUser;
}
......@@ -347,7 +347,7 @@
/**
* Getter for frontendUser
*
* @return Tx_Extbase_Domain_Model_FrontendUser Frontend user
* @return string Frontend user
*/
public function getFrontendUser() {
return $this->frontendUser;
......
......@@ -238,6 +238,7 @@
'repository' => $extension['repository'],
'review_state' => $extension['reviewstate'],
'file_hash' => $extension['t3xfilemd5'],
'frontend_user' => $extension['ownerusername'],
'relations' => array(),
);
......
......@@ -215,6 +215,7 @@
'repository' => NULL,
'review_state' => NULL,
'file_hash' => (string) $version->t3xfilemd5,
'frontend_user' => (string) $version->ownerusername,
'relations' => array(),
);
......
......@@ -45,9 +45,10 @@
* @param string $wsdlUrl URL of the wsdl
* @param string $username Login with this username
* @param string $password Login with this password
* @return void
* @param boolean $returnExceptions Return exception in case of errors
* @return SoapClient
*/
public function connect($wsdlUrl, $username = '', $password = '') {
public function connect($wsdlUrl, $username = '', $password = '', $returnExceptions = FALSE) {
if (empty($wsdlUrl)) {
throw new Exception('No valid wsdl URL given');
}
......@@ -59,7 +60,7 @@
// Create connection
$this->soapConnection = new SoapClient($wsdlUrl, array(
'trace' => 1,
'exceptions' => 0,
'exceptions' => (int) $returnExceptions,
));
// Get authentication header
......@@ -67,6 +68,50 @@
$headerData = array('username' => $username, 'password' => $password);
$this->authenticationHeader = new SoapHeader('', 'HeaderLogin', (object) $headerData, TRUE);
}
return $this->soapConnection;
}
/**
* Set connection object
*
* @param SoapClient $soapConnection SOAP connection object
* @return void
*/
public function setConnection(SoapClient $soapConnection) {
$this->soapConnection = $soapConnection;
}
/**
* Returns current connection object
*
* @return SoapClient
*/
public function getConnection() {
return $this->soapConnection;
}
/**
* Set authentication header
*
* @param SoapHeader $soapHeader SOAP header
* @return void
*/
public function setAuthenticationHeader(SoapHeader $authenticationHeader) {
$this->authenticationHeader;
}
/**
* Returns current authentication header
*
* @return SoapHeader
*/
public function getAuthenticationHeader() {
return $this->authenticationHeader;
}
......
<?php
/*******************************************************************
* Copyright notice
*
* (c) 2011 Kai Vogel <kai.vogel@speedprogs.de>, Speedprogs.de
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script 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 General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
******************************************************************/
/**
* Service for TER operations
*/
class Tx_TerFe2_Service_Ter {
/**
* @var Tx_TerFe2_Service_Soap
*/
protected $soapService;
/**
* @var array
*/
protected $userData = array();
/**
* Load TER connection
*
* @return void
*/
public function __construct($wsdlUrl, $username, $password) {
$this->soapService = Tx_TerFe2_Service_Soap::connect($wsdlUrl, '', '', TRUE);
$this->userData = array(
'username' => $username,
'password' => $password,
);
}
/**
* Check if an extension key is valid
*
* @param string $extensionKey Extension key
* @return boolean TRUE if extension key is valid
*/
public function checkExtensionKey($extensionKey) {
$result = $this->soapService->checkExtensionKey($this->userData, $extensionKey);
// 10501 = TX_TER_RESULT_EXTENSIONKEYDOESNOTEXIST
return (!empty($result['resultCode']) && $result['resultCode'] === '10501');
}
/**
* Register extension
*
* @param array $extensionData Extension information
* @return boolean TRUE if success
*/
public function registerExtension(array $extensionData) {
$result = $this->soapService->checkExtensionKey($this->userData, $extensionData);
// TODO: Implement a result check
return TRUE;
}
/**
* Assign extension key to an other user
*
* @param string $extensionKey Extension key
* @param string $username New username
* @param string $error Contains the error
* @return boolean TRUE if success
*/
public function assignExtensionKey($extensionKey, $username, &$error = '') {
$result = $this->soapService->modifyExtensionKey($this->userData, array(
'extensionKey' => $extensionKey,
'ownerUsername' => $username,
));
if (empty($result['resultCode'])) {
$error = 'no_result';
return FALSE;
}
// 102 = TX_TER_ERROR_GENERAL_USERNOTFOUND
if ($result['resultCode'] === '102' {
$error = 'user_not_found';
return FALSE;
}
// 10000 = TX_TER_RESULT_GENERAL_OK
return ($result['resultCode'] === '10000');
}
/**
* Remove an extension kex from system
*
* @param string $extensionKey Extension key
* @return boolean TRUE if success
*/
public function deleteExtensionKey($extensionKey) {
$result = $this->soapService->deleteExtensionKey($this->userData, $extensionKey);
// 10000 = TX_TER_RESULT_GENERAL_OK
return (!empty($result['resultCode']) && $result['resultCode'] === '10000');
}
}
?>
\ No newline at end of file
......@@ -31,7 +31,7 @@
/**
* @var string
*/
protected $dateTimeFormat = 'H:i d-m-Y';
protected static $dateTimeFormat = 'H:i d-m-Y';
/**
......@@ -41,7 +41,7 @@
* @return void
*/
public static function setDateTimeFormat($format) {
$this->dateTimeFormat = $format;
self::$dateTimeFormat = $format;
}
......@@ -57,7 +57,7 @@
// Try TYPO3 standard date / time input format
if ($timestamp === FALSE) {
$timestamp = DateTime::createFromFormat($this->dateTimeFormat, $string);
$timestamp = DateTime::createFromFormat(self::$dateTimeFormat, $string);
}
// Try configured date / time input format
......
......@@ -21,6 +21,17 @@ plugin.tx_terfe2 {
# cat=TER Frontend/settings/150; type=string; label=Media root path: Media root path for zip files and images
mediaRootPath = fileadmin/extensionFiles/
terConnection {
# cat=TER Frontend/settings/160; type=string; label=TER WSDL URI: WSDL URI to connect TER server
wsdl = http://typo3.org/wsdl/tx_ter_wsdl.php
# cat=TER Frontend/settings/170; type=string; label=TER Username: Username to connect TER server
username =
# cat=TER Frontend/settings/180; type=string; label=TER Password: Password to connect TER server
password =
}
smallImage {
# cat=TER Frontend/settings/200; type=int+; label=Small image maxW: Maximal width for small images
maxW = 200
......
......@@ -11,6 +11,12 @@ plugin.tx_terfe2 {
dateFormat = {$plugin.tx_terfe2.settings.dateFormat}
mediaRootPath = {$plugin.tx_terfe2.settings.mediaRootPath}
terConnection {
wsdl = {$plugin.tx_terfe2.settings.terConnection.wsdl}
username = {$plugin.tx_terfe2.settings.terConnection.username}
password = {$plugin.tx_terfe2.settings.terConnection.password}
}
smallImage {
maxW = {$plugin.tx_terfe2.settings.smallImage.maxW}
maxH = {$plugin.tx_terfe2.settings.smallImage.maxH}
......
......@@ -42,6 +42,7 @@
'tx_terfe2_service_image' => $extensionClassesPath . 'Service/Image.php',
'tx_terfe2_service_mirror' => $extensionClassesPath . 'Service/Mirror.php',
'tx_terfe2_service_soap' => $extensionClassesPath . 'Service/Soap.php',
'tx_terfe2_service_ter' => $extensionClassesPath . 'Service/Ter.php',
'tx_terfe2_task_abstracttask' => $extensionClassesPath . 'Task/AbstractTask.php',
'tx_terfe2_task_abstractadditionalfieldprovider' => $extensionClassesPath . 'Task/AbstractAdditionalFieldProvider.php',
'tx_terfe2_task_createextensionfilestask' => $extensionClassesPath . 'Task/CreateExtensionFilesTask.php',
......
......@@ -14,7 +14,7 @@ CREATE TABLE tx_terfe2_domain_model_extension (
tags int(11) unsigned DEFAULT '0' NOT NULL,
versions int(11) unsigned DEFAULT '0' NOT NULL,
last_version int(11) unsigned DEFAULT '0' NOT NULL,
frontend_user int(11) unsigned DEFAULT '0' NOT NULL,
frontend_user tinytext,
tstamp int(11) unsigned DEFAULT '0' NOT NULL,
crdate int(11) unsigned DEFAULT '0' NOT NULL,
......
Supports Markdown
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