From 4458408fa20afdb6b265098b5fa7345688a4d545 Mon Sep 17 00:00:00 2001 From: Karl Burkhart Date: Wed, 19 Oct 2011 14:50:39 +0000 Subject: [PATCH] SOAP Request auf Complex Type umgeschrieben --- soap/notiz.soap.php | 19 ---------- soap/projekttask.soap.php | 73 +++++++++++++++++++++++++++------------ soap/projekttask.wsdl.php | 18 ++++++++-- 3 files changed, 65 insertions(+), 45 deletions(-) diff --git a/soap/notiz.soap.php b/soap/notiz.soap.php index effb3b18b..5e137652f 100755 --- a/soap/notiz.soap.php +++ b/soap/notiz.soap.php @@ -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"); diff --git a/soap/projekttask.soap.php b/soap/projekttask.soap.php index 13f8e14db..9fd344c80 100644 --- a/soap/projekttask.soap.php +++ b/soap/projekttask.soap.php @@ -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)) diff --git a/soap/projekttask.wsdl.php b/soap/projekttask.wsdl.php index 346d01207..731d059f8 100644 --- a/soap/projekttask.wsdl.php +++ b/soap/projekttask.wsdl.php @@ -5,14 +5,21 @@ echo ""; ?> + + + + + + + @@ -22,13 +29,16 @@ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> - + + + + @@ -36,6 +46,8 @@ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> + +