SOAP Request auf Complex Type umgeschrieben

This commit is contained in:
Karl Burkhart
2011-10-19 14:50:39 +00:00
parent 7ec6c4c911
commit 4458408fa2
3 changed files with 65 additions and 45 deletions
-19
View File
@@ -40,24 +40,6 @@ $SOAPServer->handle();
// WSDL Chache auf aus
ini_set("soap.wsdl_cache_enabled", "0");
function check_user($username, $passwort)
{
if($username=='')
{
$user = get_uid();
if($user=='')
return false;
return $user;
}
else
{
if(!checkldapuser($username,$passwort))
return false;
else
return $username;
}
}
/**
*
* Speichert Notizen in die Datenbank
@@ -130,7 +112,6 @@ function saveNotiz($username, $passwort, $notiz)
*/
function deleteNotiz($username, $passwort, $notiz_id)
{
if(!$user = check_user($username, $passwort))
return new SoapFault("Server", "Invalid Credentials");
+50 -23
View File
@@ -28,6 +28,7 @@ require_once('../config/vilesci.config.inc.php');
require_once('../include/basis_db.class.php');
require_once('../include/projekttask.class.php');
require_once('../include/benutzer.class.php');
require_once('../include/benutzerberechtigung.class.php');
require_once('../include/datum.class.php');
require_once('../include/functions.inc.php');
require_once('../include/mantis.class.php');
@@ -45,22 +46,27 @@ ini_set("soap.wsdl_cache_enabled", "0");
/**
*
* Speichert die vom Webservice übergebenen Parameter in die DB
* @param string $projekttask_id
* @param string $projektphase_id
* @param string $bezeichnung
* @param string $beschreibung
* @param string $aufwand
* @param string $mantis_id
* @param string $user
* @param $username
* @param $passwort
* @param $task Task-Objekt
*/
function saveProjekttask($projekttask_id, $projektphase_id, $bezeichnung, $beschreibung, $aufwand, $mantis_id, $user, $ende, $ressource_id)
function saveProjekttask($username, $passwort, $task)
{
$user = get_uid();
if(!$user = check_user($username, $passwort))
return new SoapFault("Server", "Invalid Credentials");
$rechte = new benutzerberechtigung();
$rechte->getBerechtigungen($user);
if(!$rechte->isBerechtigt('planner', null, 'sui'))
return new SoapFault("Server", "Sie haben keine Berechtigung zum Speichern von Tasks");
$projekttask = new projekttask();
// wenn projekttaskt_id == leer -> neuer task anlegen ohne laden
if($projekttask_id != '')
if($task->projekttask_id != '')
{
if($projekttask->load($projekttask_id))
if($projekttask->load($task->projekttask_id))
{
$projekttask->new = false;
}
@@ -73,15 +79,15 @@ function saveProjekttask($projekttask_id, $projektphase_id, $bezeichnung, $besch
$projekttask->insertvon = $user;
}
$projekttask->projekttask_id=$projekttask_id;
$projekttask->projektphase_id=$projektphase_id;
$projekttask->bezeichnung=$bezeichnung;
$projekttask->beschreibung = $beschreibung;
$projekttask->aufwand = $aufwand;
$projekttask->mantis_id = $mantis_id;
$projekttask->updatevon = $user;
$projekttask->ende = $ende;
$projekttask->ressource_id = $ressource_id;
$projekttask->projekttask_id=$task->projekttask_id;
$projekttask->projektphase_id=$task->projektphase_id;
$projekttask->bezeichnung=$task->bezeichnung;
$projekttask->beschreibung = $task->beschreibung;
$projekttask->aufwand = $task->aufwand;
$projekttask->mantis_id = $task->mantis_id;
$projekttask->updatevon = $task->user;
$projekttask->ende = $task->ende;
$projekttask->ressource_id = $task->ressource_id;
if($projekttask->save())
{
@@ -94,10 +100,21 @@ function saveProjekttask($projekttask_id, $projektphase_id, $bezeichnung, $besch
/**
*
* Löscht den Task mit der vom Webservice übergebenen ID
* @param $username
* @param $passwort
* @param $projekttask_id
*/
function deleteProjekttask($projekttask_id)
function deleteProjekttask($username, $passwort, $projekttask_id)
{
if(!$user = check_user($username, $passwort))
return new SoapFault("Server", "Invalid Credentials");
$rechte = new benutzerberechtigung();
$rechte->getBerechtigungen($user);
if(!$rechte->isBerechtigt('planner', null, 'suid'))
return new SoapFault("Server", "Sie haben keine Berechtigung zum Loeschen von Tasks");
$projekttask = new projekttask();
if($projekttask->delete($projekttask_id))
return "OK";
@@ -112,7 +129,6 @@ function saveMantis($projekttask_id, $mantis_id, $issue_summary, $issue_descript
if($mantis_id!='')
{
//Update
$mantis->issue_id = $mantis_id;
$mantis->issue_summary = $issue_summary;
$mantis->issue_description = $issue_description;
@@ -158,11 +174,22 @@ function saveMantis($projekttask_id, $mantis_id, $issue_summary, $issue_descript
/**
*
* Setzt den Erledigt Status
* @param $username
* @param $passwort
* @param $projekttask_id
* @param $erledigt
*/
function setErledigt($projekttask_id, $erledigt)
function setErledigt($username, $passwort, $projekttask_id, $erledigt)
{
if(!$user = check_user($username, $passwort))
return new SoapFault("Server", "Invalid Credentials");
$rechte = new benutzerberechtigung();
$rechte->getBerechtigungen($user);
if(!$rechte->isBerechtigt('planner', null, 'sui'))
return new SoapFault("Server", "Sie haben keine Berechtigung.");
$projekttask = new projekttask();
if($projekttask->load($projekttask_id))
+15 -3
View File
@@ -5,14 +5,21 @@ echo "<?xml version='1.0' encoding='utf-8' ?>";
?>
<wsdl:definitions name="Projekttask"
targetNamespace="http://localhost/soap/"
targetNamespace="http://www.technikum-wien.at/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://localhost/soap/"
xmlns:tns="http://www.technikum-wien.at/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsd1="http://localhost/soap/projekttask.xsd"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:message name="SaveProjekttaskRequest">
<wsdl:part name="username" type="xsd:string" minOccurs="0"></wsdl:part>
<wsdl:part name="passwort" type="xsd:string" minOccurs="0"></wsdl:part>
<wsdl:part name="task" type="tns:task"></wsdl:part>
</wsdl:message>
<xsd:complexType name="task">
<xsd:all>
<wsdl:part name="projekttask_id" type="xsd:string"></wsdl:part>
<wsdl:part name="projektphase_id" type="xsd:string"></wsdl:part>
<wsdl:part name="bezeichnung" type="xsd:string"></wsdl:part>
@@ -22,13 +29,16 @@ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:part name="user" type="xsd:string"></wsdl:part>
<wsdl:part name="ende" type="xsd:string"></wsdl:part>
<wsdl:part name="ressource_id" type="xsd:string"></wsdl:part>
</wsdl:message>
</xsd:all>
</xsd:complexType>
<wsdl:message name="SaveProjekttaskResponse">
<wsdl:part name="message" type="xsd:string"></wsdl:part>
</wsdl:message>
<wsdl:message name="DeleteProjekttaskRequest">
<wsdl:part name="username" type="xsd:string" minOccurs="0"></wsdl:part>
<wsdl:part name="passwort" type="xsd:string" minOccurs="0"></wsdl:part>
<wsdl:part name="projekttask_id" type="xsd:string"></wsdl:part>
</wsdl:message>
<wsdl:message name="DeleteProjekttaskResponse">
@@ -36,6 +46,8 @@ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
</wsdl:message>
<wsdl:message name="setErledigtRequest">
<wsdl:part name="username" type="xsd:string" minOccurs="0"></wsdl:part>
<wsdl:part name="passwort" type="xsd:string" minOccurs="0"></wsdl:part>
<wsdl:part name="projekttask_id" type="xsd:string"></wsdl:part>
<wsdl:part name="erledigt" type="xsd:boolean"></wsdl:part>
</wsdl:message>