Removed permission system from models

This commit is contained in:
Paolo
2018-03-29 12:13:08 +02:00
parent 0906f5bc85
commit d9b80b790d
16 changed files with 43 additions and 241 deletions
+14 -26
View File
@@ -11,15 +11,12 @@ class Akte_model extends DB_Model
$this->dbTable = 'public.tbl_akte';
$this->pk = 'akte_id';
}
/**
* getAkten
*/
public function getAkten($person_id, $dokument_kurzbz = null, $stg_kz = null, $prestudent_id = null)
{
// Checks if the operation is permitted by the API caller
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
$query = 'SELECT akte_id,
person_id,
dokument_kurzbz,
@@ -41,15 +38,15 @@ class Akte_model extends DB_Model
CASE WHEN inhalt is not null THEN true ELSE false END as inhalt_vorhanden
FROM public.tbl_akte
WHERE person_id = ?';
$parametersArray = array($person_id);
if (!is_null($dokument_kurzbz))
{
$query .= ' AND dokument_kurzbz = ?';
array_push($parametersArray, $dokument_kurzbz);
}
if (!is_null($stg_kz) && !is_null($prestudent_id))
{
$query .= ' AND dokument_kurzbz NOT IN (
@@ -65,9 +62,9 @@ class Akte_model extends DB_Model
)';
array_push($parametersArray, $stg_kz, $prestudent_id);
}
$query .= ' ORDER BY erstelltam';
return $this->execQuery($query, $parametersArray);
}
@@ -76,9 +73,6 @@ class Akte_model extends DB_Model
*/
public function getAktenAccepted($person_id, $dokument_kurzbz = null)
{
// Checks if the operation is permitted by the API caller
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
$query = 'SELECT a.akte_id,
a.person_id,
a.dokument_kurzbz,
@@ -103,17 +97,17 @@ class Akte_model extends DB_Model
INNER JOIN public.tbl_prestudent p USING(person_id)
LEFT JOIN public.tbl_dokumentprestudent dp USING(prestudent_id, dokument_kurzbz)
WHERE a.person_id = ?';
$parametersArray = array($person_id);
if (!empty($dokument_kurzbz))
{
$query .= ' AND a.dokument_kurzbz = ?';
array_push($parametersArray, $dokument_kurzbz);
}
$query .= ' GROUP BY a.akte_id ORDER BY a.erstelltam';
return $this->execQuery($query, $parametersArray);
}
@@ -122,10 +116,6 @@ class Akte_model extends DB_Model
*/
public function getAktenAcceptedDms($person_id, $dokument_kurzbz = null)
{
// Checks if the operation is permitted by the API caller
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
if (isError($ent = $this->isEntitled('campus.tbl_dms', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
$query = 'SELECT a.akte_id,
a.person_id,
a.dokument_kurzbz,
@@ -160,17 +150,17 @@ class Akte_model extends DB_Model
INNER JOIN (SELECT dms_id, MAX(version) AS version FROM campus.tbl_dms_version GROUP BY dms_id) dvv ON (d.dms_id = dvv.dms_id)
INNER JOIN campus.tbl_dms_version dv ON (dv.dms_id = dvv.dms_id AND dv.version = dvv.version)
WHERE a.person_id = ?';
$parametersArray = array($person_id);
if (!empty($dokument_kurzbz))
{
$query .= ' AND a.dokument_kurzbz = ?';
array_push($parametersArray, $dokument_kurzbz);
}
$query .= ' GROUP BY a.akte_id, d.dms_id, dv.dms_id, dv.version ORDER BY a.erstelltam';
return $this->execQuery($query, $parametersArray);
}
@@ -183,8 +173,6 @@ class Akte_model extends DB_Model
*/
public function getAktenWithDokInfo($person_id, $dokument_kurzbz = null, $nachgereicht = null)
{
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
$this->addSelect('public.tbl_akte.*, bezeichnung_mehrsprachig, dokumentbeschreibung_mehrsprachig, public.tbl_dokument.bezeichnung as dokument_bezeichnung, bis.tbl_nation.*, ausstellungsdetails');
$this->addJoin('public.tbl_dokument', 'dokument_kurzbz');
$this->addJoin('bis.tbl_nation', 'ausstellungsnation = nation_code', 'LEFT');
@@ -11,17 +11,14 @@ class Dokumentprestudent_model extends DB_Model
$this->dbTable = 'public.tbl_dokumentprestudent';
$this->pk = array('prestudent_id', 'dokument_kurzbz');
}
/**
* setAccepted
*/
public function setAccepted($prestudent_id, $studiengang_kz)
{
if (isError($ent = $this->isEntitled('public.tbl_dokumentprestudent', PermissionLib::INSERT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
return $ent;
$result = null;
if (is_numeric($prestudent_id) && is_numeric($studiengang_kz))
{
$query = 'INSERT INTO public.tbl_dokumentprestudent (dokument_kurzbz, prestudent_id, insertamum) (
@@ -37,23 +34,20 @@ class Dokumentprestudent_model extends DB_Model
AND p.prestudent_id = ?
AND ds.studiengang_kz = ?
)';
$result = $this->execQuery($query, array($prestudent_id, $studiengang_kz));
}
return $result;
}
/**
* setAcceptedDocuments
*/
public function setAcceptedDocuments($prestudent_id, $dokument_kurzbz)
{
if (isError($ent = $this->isEntitled('public.tbl_dokumentprestudent', PermissionLib::INSERT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
return $ent;
$result = null;
if (is_numeric($prestudent_id) && is_array($dokument_kurzbz) && count($dokument_kurzbz) > 0)
{
$query = 'INSERT INTO public.tbl_dokumentprestudent (dokument_kurzbz, prestudent_id, insertamum) (
@@ -68,10 +62,10 @@ class Dokumentprestudent_model extends DB_Model
WHERE prestudent_id = ?
)
)';
$result = $this->execQuery($query, array($prestudent_id, $dokument_kurzbz, $prestudent_id));
}
return $result;
}
}
@@ -11,19 +11,16 @@ class Dokumentstudiengang_model extends DB_Model
$this->dbTable = 'public.tbl_dokumentstudiengang';
$this->pk = array('studiengang_kz', 'dokument_kurzbz');
}
/**
* getDokumentstudiengangByStudiengang_kz
*/
public function getDokumentstudiengangByStudiengang_kz($studiengang_kz, $onlinebewerbung = null, $pflicht = null, $nachreichbar = null)
{
// Checks if the operation is permitted by the API caller
if (isError($ent = $this->isEntitled('public.tbl_dokument', 's', FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
$this->addJoin('public.tbl_dokument', 'dokument_kurzbz');
$parameterArray = array('studiengang_kz' => $studiengang_kz);
if( isset($onlinebewerbung))
{
$parameterArray['onlinebewerbung'] = $onlinebewerbung;
@@ -33,12 +30,12 @@ class Dokumentstudiengang_model extends DB_Model
{
$parameterArray['pflicht'] = $pflicht;
}
if( isset($nachreichbar))
{
$parameterArray['nachreichbar'] = $nachreichbar;
}
return $this->loadWhere($parameterArray);
}
}
@@ -17,12 +17,6 @@ class Prestudent_model extends DB_Model
*/
public function getLastStatuses($person_id, $studiensemester_kurzbz = null, $studiengang_kz = null, $status_kurzbz = null)
{
// Checks if the operation is permitted by the API caller
if (isError($ent = $this->isEntitled('public.tbl_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
if (isError($ent = $this->isEntitled('public.tbl_prestudent', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
if (isError($ent = $this->isEntitled('public.tbl_prestudentstatus', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
return $ent;
$query = 'SELECT *
FROM public.tbl_prestudent p
JOIN (
@@ -87,8 +81,6 @@ class Prestudent_model extends DB_Model
$studiengang = null, $studiensemester = null, $gruppe = null, $reihungstest = null, $stufe = null
)
{
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
$this->addSelect(
'p.person_id,
prestudent_id,
@@ -18,12 +18,6 @@ class Prestudentstatus_model extends DB_Model
*/
public function getLastStatus($prestudent_id, $studiensemester_kurzbz = '', $status_kurzbz = '')
{
// Checks if the operation is permitted by the API caller
if (isError($ent = $this->isEntitled('public.tbl_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
if (isError($ent = $this->isEntitled('lehre.tbl_studienplan', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
if (isError($ent = $this->isEntitled('public.tbl_prestudentstatus', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
return $ent;
$query = 'SELECT tbl_prestudentstatus.*,
bezeichnung AS studienplan_bezeichnung,
tbl_studienplan.orgform_kurzbz as orgform,
@@ -59,8 +53,6 @@ class Prestudentstatus_model extends DB_Model
*/
public function updateStufe($prestudentIdArray, $stufe)
{
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
return $this->execQuery(
'UPDATE public.tbl_prestudentstatus
SET rt_stufe = ?
@@ -85,10 +77,6 @@ class Prestudentstatus_model extends DB_Model
*/
public function getStatusByFilter($prestudent_id, $status_kurzbz = '', $ausbildungssemester = '', $studiensemester_kurzbz = '')
{
// Checks if the operation is permitted by the API caller
if (isError($ent = $this->isEntitled('public.tbl_prestudentstatus', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
return $ent;
$query = '
SELECT
tbl_prestudentstatus.*