diff --git a/include/person.class.php b/include/person.class.php
index de2ffe68e..58b9b5992 100644
--- a/include/person.class.php
+++ b/include/person.class.php
@@ -144,7 +144,7 @@ class person extends basis_db
return false;
}
}
-
+
/**
*
* Löscht den Datensatz mit der übergebenen person_id
@@ -790,5 +790,5 @@ class person extends basis_db
return true;
}
-}
+ }
?>
diff --git a/soap/index.html b/soap/index.html
index 3c44a1fa5..bad3ad150 100644
--- a/soap/index.html
+++ b/soap/index.html
@@ -8,6 +8,7 @@
Ort / Raum
Studierendendaten
LV-Plan
+ Personen
Sonstiges
diff --git a/soap/person.soap.php b/soap/person.soap.php
new file mode 100755
index 000000000..9bd87c81a
--- /dev/null
+++ b/soap/person.soap.php
@@ -0,0 +1,163 @@
+.
+ */
+/**
+ * Webservice fuer Mitarbeiter
+ *
+ */
+require_once('../config/vilesci.config.inc.php');
+require_once('../include/basis_db.class.php');
+require_once('../include/functions.inc.php');
+require_once('../include/webservicerecht.class.php');
+require_once('../include/person.class.php');
+require_once('../include/benutzer.class.php');
+
+ini_set("soap.wsdl_cache_enabled", "0");
+
+$SOAPServer = new SoapServer(APP_ROOT."/soap/person.wsdl.php?".microtime(true));
+$SOAPServer->addFunction("getPersonFromUID");
+$SOAPServer->addFunction("searchPerson");
+$SOAPServer->handle();
+
+/**
+ *
+ * Funktion getPersonFromUID liefert eine Person zurück
+ * @param uid - uid der gesuchten Person
+ * @param authentifizierung - Array mit Username und Passwort
+ *
+ * Berechtigung:
+ INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/person','getPersonFromUID','vorname');
+ INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/person','getPersonFromUID','nachname');
+ INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/person','getPersonFromUID','titelpre');
+ INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/person','getPersonFromUID','titelpost');
+ INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/person','getPersonFromUID','uid');
+ INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/person','getPersonFromUID','email');
+ INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/person','getPersonFromUID','status');
+
+ */
+function getPersonFromUID($uid, $authentifizierung)
+{
+ $user = $authentifizierung->username;
+ $passwort = $authentifizierung->passwort;
+
+ // User authentifizieren
+ if(!check_user($user, $passwort))
+ return new SoapFault("Server", "Invalid Credentials");
+
+ // darf user überhaupt was von Methode sehen
+ $recht = new webservicerecht();
+ if(!$recht->isUserAuthorized($user, 'getPersonFromUID'))
+ return new SoapFault("Server", "No permission");
+
+ //Personendaten laden
+ $person = new benutzer();
+ if(!$person->load($uid))
+ return new SoapFault("Server", "Error loading Data");
+
+ class foo{};
+
+ $obj = new foo();
+ $obj->vorname = $person->vorname;
+ $obj->nachname = $person->nachname;
+ $obj->titelpre = $person->titelpre;
+ $obj->titelpost = $person->titelpost;
+ $obj->uid = $person->uid;
+ $obj->email = $person->uid.'@'.DOMAIN;
+
+ if(is_null($row->mitarbeiter_uid))
+ {
+ $obj->status = "Mitarbeiter";
+ }
+ else
+ {
+ $obj->status = "Student";
+ }
+
+ // lösche alle Attribute für die user keine Berechtigung hat
+ $obj = $recht->clearResponse($user, 'getPersonFromUID', $obj);
+
+ return $obj;
+}
+
+/**
+ *
+ * Funktion searchPerson liefert eine Person zurück
+ * @param searchItems - Array mit Suchbegriffen
+ * @param authentifizierung - Array mit Username und Passwort
+ *
+ * Berechtigung:
+ INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/person','searchPerson','vorname');
+ INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/person','searchPerson','nachname');
+ INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/person','searchPerson','titelpre');
+ INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/person','searchPerson','titelpost');
+ INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/person','searchPerson','uid');
+ INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/person','searchPerson','email');
+ INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/person','searchPerson','status');
+
+ */
+
+function searchPerson($searchItems, $authentifizierung){
+ $user = $authentifizierung->username;
+ $passwort = $authentifizierung->passwort;
+
+ // User authentifizieren
+ if(!check_user($user, $passwort))
+ return new SoapFault("Server", "Invalid Credentials");
+
+ // darf user überhaupt was von Methode sehen
+ $recht = new webservicerecht();
+ if(!$recht->isUserAuthorized($user, 'searchPerson'))
+ return new SoapFault("Server", "No permission");
+
+ //nach Personen suchen
+ $person = new benutzer();
+ $search = explode(' ',TRIM($searchItems));
+ if(!$person->search($search))
+ return new SoapFault("Server", "Error loading Data");
+
+ class foo{};
+
+ $obj = new foo();
+ $return = array();
+ foreach($person->result as $row)
+ {
+ $obj = new foo();
+ $obj->vorname = $row->vorname;
+ $obj->nachname = $row->nachname;
+ $obj->titelpre = $row->titelpre;
+ $obj->titelpost = $row->titelpost;
+ $obj->uid = $row->uid;
+ $obj->email = $row->uid.'@'.DOMAIN;
+
+ if(is_null($row->mitarbeiter_uid))
+ {
+ $obj->status = "Mitarbeiter";
+ }
+ else
+ {
+ $obj->status = "Student";
+ }
+
+ // lösche alle Attribute für die user keine Berechtigung hat
+ $return[] = $recht->clearResponse($user, 'searchPerson', $obj);
+ }
+
+ return $return;
+}
+?>
diff --git a/soap/person.wsdl.php b/soap/person.wsdl.php
new file mode 100755
index 000000000..c8d2e9b2c
--- /dev/null
+++ b/soap/person.wsdl.php
@@ -0,0 +1,77 @@
+";
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ " />
+
+
+
+
+
+
+
+
+ " />
+
+
+
+
+
+
+
+
+
+
+
+ "/>
+
+
+
\ No newline at end of file
diff --git a/soap/soap_test_person.php b/soap/soap_test_person.php
new file mode 100755
index 000000000..7b97b66dd
--- /dev/null
+++ b/soap/soap_test_person.php
@@ -0,0 +1,252 @@
+ and
+ */
+/**
+ * Test Client fuer Person Webservice
+ */
+require_once('../config/vilesci.config.inc.php');
+require_once('../include/functions.inc.php');
+require_once('../include/basis_db.class.php');
+
+$db = new basis_db();
+$method = (isset($_GET['method'])?$_GET['method']:'getPersonFromUID');
+
+$getuid = get_uid();
+if(!check_lektor($getuid) && !check_student($getuid))
+ die('Sie haben keine Berechtigung für diese Seite');
+?>
+
+
+
+
+
+
+ SOAP TestClient für Personen
+
+
+ Person Webservice
+ Liefert Informationen über Personen
+ Funktionen
+
+
+ Show WSDL
+
+ Testformular
+
+
+
+
+
+ ';
+ }
+ elseif($method=='searchPerson')
+ {
+ echo'
+
';
+ echo '
+
+ ';
+ }
+ echo 'Zurück zur Übersicht
';
+
+echo '';
+class foo {};
+
+if(isset($_REQUEST['submit']) && $_GET['method']=='getPersonFromUID')
+{
+ $client = new SoapClient(APP_ROOT."/soap/person.wsdl.php?".microtime(true));
+
+ try
+ {
+ $authentifizierung = new foo();
+ $authentifizierung->username=$_REQUEST['username'];
+ $authentifizierung->passwort=$_REQUEST['passwort'];
+ $response = $client->getPersonFromUID($_REQUEST['uid'], $authentifizierung);
+
+ var_dump($response);
+ }
+ catch(SoapFault $fault)
+ {
+ echo "SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR;
+ }
+
+
+
+}
+if(isset($_REQUEST['submit']) && $_GET['method']=='searchPerson')
+{
+ $client = new SoapClient(APP_ROOT."/soap/person.wsdl.php?".microtime(true));
+
+ try
+ {
+ $authentifizierung = new foo();
+ $authentifizierung->username=$_REQUEST['username'];
+ $authentifizierung->passwort=$_REQUEST['passwort'];
+ $response = $client->searchPerson($_REQUEST['searchItems'],$authentifizierung);
+
+ var_dump($response);
+ }
+ catch(SoapFault $fault)
+ {
+ echo "SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR;
+ }
+}
+
+echo '
';
+?>