diff --git a/content/projekt/ressource.js.php b/content/projekt/ressource.js.php
index 450e1afcf..e46541d26 100644
--- a/content/projekt/ressource.js.php
+++ b/content/projekt/ressource.js.php
@@ -200,15 +200,19 @@ function saveRessource()
// SOAP-Action
var soapBody = new SOAPObject("saveRessource");
- soapBody.appendChild(new SOAPObject("ressource_id")).val(ressource_id);
- soapBody.appendChild(new SOAPObject("bezeichnung")).val(bezeichnung);
- soapBody.appendChild(new SOAPObject("beschreibung")).val(beschreibung);
- soapBody.appendChild(new SOAPObject("mitarbeiter_uid")).val(mitarbeiter_uid);
- soapBody.appendChild(new SOAPObject("student_uid")).val(student_uid);
- soapBody.appendChild(new SOAPObject("betriebsmittel_id")).val(betriebsmittel_id);
- soapBody.appendChild(new SOAPObject("firma_id")).val(firma_id);
- soapBody.appendChild(new SOAPObject("user")).val(getUsername());
-
+ //soapBody.appendChild(new SOAPObject("username")).val('joe');
+ //soapBody.appendChild(new SOAPObject("passwort")).val('waschl');
+
+ var ressource = new SOAPObject("ressource");
+ ressource.appendChild(new SOAPObject("ressource_id")).val(ressource_id);
+ ressource.appendChild(new SOAPObject("bezeichnung")).val(bezeichnung);
+ ressource.appendChild(new SOAPObject("beschreibung")).val(beschreibung);
+ ressource.appendChild(new SOAPObject("mitarbeiter_uid")).val(mitarbeiter_uid);
+ ressource.appendChild(new SOAPObject("student_uid")).val(student_uid);
+ ressource.appendChild(new SOAPObject("betriebsmittel_id")).val(betriebsmittel_id);
+ ressource.appendChild(new SOAPObject("firma_id")).val(firma_id);
+ soapBody.appendChild(ressource);
+
if(mitarbeiter_uid == '' && student_uid =='' && betriebsmittel_id =='' && firma_id =='')
{
alert('ungueltige ID');
diff --git a/content/projekt/ressource.xml.php b/content/projekt/ressource.xml.php
index 347b8ac63..6fde510ea 100644
--- a/content/projekt/ressource.xml.php
+++ b/content/projekt/ressource.xml.php
@@ -349,21 +349,28 @@ echo '';
//debug(id);
var soapBody = new SOAPObject("saveProjektRessource");
- soapBody.appendChild(new SOAPObject("projekt_ressource_id")).val('');
+ //soapBody.appendChild(new SOAPObject("username")).val('joe');
+ //soapBody.appendChild(new SOAPObject("passwort")).val('waschl');
+
+ var projektRessource = new SOAPObject("projektRessource");
+
+ projektRessource.appendChild(new SOAPObject("projekt_ressource_id")).val('');
if(projekt_kurzbz != '')
{
- soapBody.appendChild(new SOAPObject("projektphase_id")).val('');
- soapBody.appendChild(new SOAPObject("projekt_kurzbz")).val(projekt_kurzbz);
+ projektRessource.appendChild(new SOAPObject("projektphase_id")).val('');
+ projektRessource.appendChild(new SOAPObject("projekt_kurzbz")).val(projekt_kurzbz);
}else if(projektphase_id != '')
{
- soapBody.appendChild(new SOAPObject("projektphase_id")).val(projektphase_id);
- soapBody.appendChild(new SOAPObject("projekt_kurzbz")).val('');
+ projektRessource.appendChild(new SOAPObject("projektphase_id")).val(projektphase_id);
+ projektRessource.appendChild(new SOAPObject("projekt_kurzbz")).val('');
}
- soapBody.appendChild(new SOAPObject("ressource_id")).val(id);
- soapBody.appendChild(new SOAPObject("funktion_kurzbz")).val('');
- soapBody.appendChild(new SOAPObject("beschreibung")).val('');
-
+ projektRessource.appendChild(new SOAPObject("ressource_id")).val(id);
+ projektRessource.appendChild(new SOAPObject("funktion_kurzbz")).val('');
+ projektRessource.appendChild(new SOAPObject("beschreibung")).val('');
+
+ soapBody.appendChild(projektRessource);
+
var sr = new SOAPRequest("saveProjektRessource",soapBody);
SOAPClient.Proxy="soap/ressource_projekt.soap.php?"+gettimestamp();
diff --git a/soap/ressource.soap.php b/soap/ressource.soap.php
index a0b362942..eeb4c1001 100644
--- a/soap/ressource.soap.php
+++ b/soap/ressource.soap.php
@@ -28,6 +28,8 @@ require_once('../config/vilesci.config.inc.php');
require_once('../include/basis_db.class.php');
require_once('../include/ressource.class.php');
require_once('../include/datum.class.php');
+require_once('../include/benutzerberechtigung.class.php');
+require_once('../include/functions.inc.php');
$SOAPServer = new SoapServer(APP_ROOT."/soap/ressource.wsdl.php?".microtime());
$SOAPServer->addFunction("saveRessource");
@@ -39,41 +41,45 @@ ini_set("soap.wsdl_cache_enabled", "0");
/**
*
* Speichert die Ressource
- * @param unknown_type $ressource_id
- * @param unknown_type $bezeichnung
- * @param unknown_type $beschreibung
- * @param unknown_type $mitarbeiter_uid
- * @param unknown_type $student_uid
- * @param unknown_type $betriebsmittel_id
- * @param unknown_type $firma_id
- * @param unknown_type $user
+ * @param $username
+ * @param $passwort
+ * @param $ressource
*/
-function saveRessource($ressource_id, $bezeichnung, $beschreibung, $mitarbeiter_uid, $student_uid, $betriebsmittel_id, $firma_id, $user)
+function saveRessource($username, $passwort, $ressource)
{
- $ressource = new ressource();
+ 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 Ressourcen.");
+
+ $ressourceNew = new ressource();
if($ressource_id!='')
{
- $ressource->load($ressource_id);
- $ressource->new = false;
+ $ressourceNew->load($ressource->ressource_id);
+ $ressourceNew->new = false;
}
else
{
- $ressource->new = true;
- $ressource->insertvon = $user;
+ $ressourceNew->new = true;
+ $ressourceNew->insertvon = $user;
}
- $ressource->ressource_id=$ressource_id;
- $ressource->bezeichnung=$bezeichnung;
- $ressource->beschreibung=$beschreibung;
- $ressource->mitarbeiter_uid = $mitarbeiter_uid;
- $ressource->student_uid = $student_uid;
- $ressource->betriebsmittel_id = $betriebsmittel_id;
- $ressource->firma_id = $firma_id;
- $ressource->updatevon = $user;
+ $ressourceNew->ressource_id=$ressource->ressource_id;
+ $ressourceNew->bezeichnung=$ressource->bezeichnung;
+ $ressourceNew->beschreibung=$ressource->beschreibung;
+ $ressourceNew->mitarbeiter_uid = $ressource->mitarbeiter_uid;
+ $ressourceNew->student_uid = $ressource->student_uid;
+ $ressourceNew->betriebsmittel_id = $ressource->betriebsmittel_id;
+ $ressourceNew->firma_id = $ressource->firma_id;
+ $ressourceNew->updatevon = $user;
- if($ressource->save())
- return $ressource->ressource_id;
+ if($ressourceNew->save())
+ return $ressourceNew->ressource_id;
else
- return new SoapFault("Server", $ressource->errormsg);
+ return new SoapFault("Server", $ressourceNew->errormsg);
}
?>
diff --git a/soap/ressource.wsdl.php b/soap/ressource.wsdl.php
index 869147fbb..a5a4fb58b 100644
--- a/soap/ressource.wsdl.php
+++ b/soap/ressource.wsdl.php
@@ -5,51 +5,58 @@ echo "";
?>
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
- " />
-
-
-
-
-
-
-
-
+
+
+
+ " />
+
+
+
+
+
+
+
+
-
-
- "/>
-
-
+
+
+ "/>
+
+
\ No newline at end of file
diff --git a/soap/ressource_projekt.soap.php b/soap/ressource_projekt.soap.php
index a50370dbc..985df0e8c 100644
--- a/soap/ressource_projekt.soap.php
+++ b/soap/ressource_projekt.soap.php
@@ -28,6 +28,8 @@ require_once('../config/vilesci.config.inc.php');
require_once('../include/basis_db.class.php');
require_once('../include/ressource.class.php');
require_once('../include/datum.class.php');
+require_once('../include/functions.inc.php');
+require_once('../include/benutzerberechtigung.class.php');
$SOAPServer = new SoapServer(APP_ROOT."/soap/ressource_projekt.wsdl.php?".microtime());
$SOAPServer->addFunction("saveProjektRessource");
@@ -39,33 +41,37 @@ ini_set("soap.wsdl_cache_enabled", "0");
/**
*
* Speichert in der Zwischentabelle Ressource - Projekt
- * @param $projekt_ressource_id
- * @param $projektphase_id
- * @param $projekt_kurzbz
- * @param $ressource_id
- * @param $funktion_kurzbz
- * @param $beschreibung
- * @param $user
+ * @param $username
+ * @param $passwort
+ * @param $projektRessource
*/
-
-function saveProjektRessource($projekt_ressource_id, $projektphase_id, $projekt_kurzbz, $ressource_id, $funktion_kurzbz, $beschreibung)
+function saveProjektRessource($username, $passwort, $projektRessource)
{
+ 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 Projekten.");
+
$ressource = new ressource();
- if($projekt_ressource_id!='')
+ if($projektRessource->projekt_ressource_id!='')
{
- $ressource->loadProjektRessource($projekt_ressource_id);
+ $ressource->loadProjektRessource($projektRessource->projekt_ressource_id);
$ressource->new = false;
}
else
{
$ressource->new = true;
}
- $ressource->projekt_ressource_id=$projekt_ressource_id;
- $ressource->projektphase_id=$projektphase_id;
- $ressource->projekt_kurzbz=$projekt_kurzbz;
- $ressource->ressource_id = $ressource_id;
- $ressource->funktion_kurzbz = $funktion_kurzbz;
- $ressource->beschreibung = $beschreibung;
+ $ressource->projekt_ressource_id=$projektRessource->projekt_ressource_id;
+ $ressource->projektphase_id=$projektRessource->projektphase_id;
+ $ressource->projekt_kurzbz=$projektRessource->projekt_kurzbz;
+ $ressource->ressource_id = $projektRessource->ressource_id;
+ $ressource->funktion_kurzbz = $projektRessource->funktion_kurzbz;
+ $ressource->beschreibung = $projektRessource->beschreibung;
if($ressource->saveProjektRessource())
diff --git a/soap/ressource_projekt.wsdl.php b/soap/ressource_projekt.wsdl.php
index acd36fe1a..a234b4c40 100644
--- a/soap/ressource_projekt.wsdl.php
+++ b/soap/ressource_projekt.wsdl.php
@@ -5,21 +5,29 @@ echo "";
?>
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+