mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
Merge branch 'ci' of https://github.com/FH-Complete/FHC-Core into ci
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* FH-Complete
|
||||
*
|
||||
* @package FHC-API
|
||||
* @author FHC-Team
|
||||
* @copyright Copyright (c) 2016, fhcomplete.org
|
||||
* @license GPLv3
|
||||
* @link http://fhcomplete.org
|
||||
* @since Version 1.0
|
||||
* @filesource
|
||||
*/
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class CheckUserAuth extends APIv1_Controller
|
||||
{
|
||||
/**
|
||||
* Course API constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('CheckUserAuth_model', 'CheckUserAuthModel');
|
||||
}
|
||||
|
||||
public function getCheckByUsernamePassword()
|
||||
{
|
||||
$username = $this->get("username");
|
||||
$password = $this->get("password");
|
||||
|
||||
if (isset($username) && isset($password))
|
||||
{
|
||||
$result = $this->CheckUserAuthModel->checkByUsernamePassword($username, $password);
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,28 @@ class Akte extends APIv1_Controller
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function getAkten()
|
||||
{
|
||||
$person_id = $this->get('person_id');
|
||||
$dokument_kurzbz = $this->get('dokument_kurzbz');
|
||||
$stg_kz = $this->get('stg_kz');
|
||||
$prestudent_id = $this->get('prestudent_id');
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$result = $this->AkteModel->getAkten($person_id, $dokument_kurzbz, $stg_kz, $prestudent_id);
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
|
||||
@@ -53,6 +53,22 @@ class Kontakt extends APIv1_Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function getOnlyKontakt()
|
||||
{
|
||||
$kontakt_id = $this->get("kontakt_id");
|
||||
|
||||
if (isset($kontakt_id))
|
||||
{
|
||||
$result = $this->KontaktModel->loadWhere(array('kontakt_id' => $kontakt_id));
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
public function getKontaktByPersonID()
|
||||
{
|
||||
$person_id = $this->get("person_id");
|
||||
|
||||
@@ -26,8 +26,16 @@ require_once FCPATH.'include/AddonAuthentication.php';
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
class FHC_Auth
|
||||
class FHC_Auth extends authentication
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Auth Username, Password over FH-Complete
|
||||
*
|
||||
@@ -37,8 +45,7 @@ class FHC_Auth
|
||||
*/
|
||||
public function basicAuthentication($username, $password)
|
||||
{
|
||||
$auth = new authentication();
|
||||
if ($auth->checkpassword($username, $password))
|
||||
if ($this->checkpassword($username, $password))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -49,6 +56,9 @@ class FHC_Auth
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* TO BE UPDATED
|
||||
*
|
||||
* Get the md5 hashed password by the addon username
|
||||
*
|
||||
* @param string $username addon username
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
class CheckUserAuth_model extends FHC_Model
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->library('fhc_auth');
|
||||
}
|
||||
|
||||
public function checkByUsernamePassword($username, $password)
|
||||
{
|
||||
return $this->_success($this->fhc_auth->checkpassword($username, $password));
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
class Akte_model extends DB_Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@@ -11,4 +11,77 @@ class Akte_model extends DB_Model
|
||||
$this->dbTable = 'public.tbl_akte';
|
||||
$this->pk = 'akte_id';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
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 (! $this->fhc_db_acl->isBerechtigt($this->acl['public.tbl_akte'], 's'))
|
||||
return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl['public.tbl_akte'], FHC_MODEL_ERROR);
|
||||
|
||||
if (! $this->fhc_db_acl->isBerechtigt($this->acl['public.tbl_dokument'], 's'))
|
||||
return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl['public.tbl_dokument'], FHC_MODEL_ERROR);
|
||||
|
||||
if (! $this->fhc_db_acl->isBerechtigt($this->acl['public.tbl_dokumentstudiengang'], 's'))
|
||||
return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl['public.tbl_dokumentstudiengang'], FHC_MODEL_ERROR);
|
||||
|
||||
if (! $this->fhc_db_acl->isBerechtigt($this->acl['public.tbl_dokumentprestudent'], 's'))
|
||||
return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl['public.tbl_dokumentprestudent'], FHC_MODEL_ERROR);
|
||||
|
||||
$query = 'SELECT akte_id,
|
||||
person_id,
|
||||
dokument_kurzbz,
|
||||
mimetype,
|
||||
erstelltam,
|
||||
gedruckt,
|
||||
titel_intern,
|
||||
anmerkung_intern,
|
||||
titel, bezeichnung,
|
||||
updateamum,
|
||||
insertamum,
|
||||
updatevon,
|
||||
insertvon,
|
||||
uid,
|
||||
dms_id,
|
||||
anmerkung,
|
||||
nachgereicht,
|
||||
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 (
|
||||
SELECT dokument_kurzbz
|
||||
FROM public.tbl_dokument JOIN public.tbl_dokumentstudiengang USING (dokument_kurzbz)
|
||||
WHERE studiengang_kz = ?
|
||||
)
|
||||
AND dokument_kurzbz NOT IN (\'Zeugnis\')
|
||||
AND dokument_kurzbz NOT IN (
|
||||
SELECT dokument_kurzbz
|
||||
FROM public.tbl_dokumentprestudent JOIN public.tbl_dokument USING (dokument_kurzbz)
|
||||
WHERE prestudent_id = ?
|
||||
)';
|
||||
array_push($parametersArray, $stg_kz, $prestudent_id);
|
||||
}
|
||||
|
||||
$query .= ' ORDER BY erstelltam';
|
||||
|
||||
$result = $this->db->query($query, $parametersArray);
|
||||
|
||||
if (is_object($result))
|
||||
return $this->_success($result->result());
|
||||
else
|
||||
return $this->_error($this->db->error(), FHC_DB_ERROR);
|
||||
}
|
||||
}
|
||||
+25
-1
@@ -121,4 +121,28 @@ trait db_extra
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
|
||||
public function db_num_fields($result=null)
|
||||
{
|
||||
if(is_null($result))
|
||||
return pg_num_fields($this->db_result);
|
||||
else
|
||||
return pg_num_fields($result);
|
||||
}
|
||||
|
||||
public function convert_html_chars($value)
|
||||
{
|
||||
return htmlspecialchars($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Liefert den Feldnamen mit index i
|
||||
*/
|
||||
public function db_field_name($result=null, $i)
|
||||
{
|
||||
if(is_null($result))
|
||||
return pg_field_name($this->db_result, $i);
|
||||
else
|
||||
return pg_field_name($result, $i);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user