mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
- Added new permission to access to tbl_addresse table using basis/adresse
- Added adresse controller and model
This commit is contained in:
@@ -17,6 +17,7 @@ $config['fhc_acl'] = array
|
||||
'lehre.tbl_studienordnung' => 'basis/studienordnung',
|
||||
'lehre.vw_studienplan' => 'basis/vw_studienplan',
|
||||
|
||||
'public.tbl_adresse' => 'basis/adresse',
|
||||
'public.tbl_person' => 'basis/person',
|
||||
'public.tbl_kontakt' => 'basis/kontakt',
|
||||
'public.tbl_benutzer' => 'basis/benutzer',
|
||||
@@ -26,4 +27,4 @@ $config['fhc_acl'] = array
|
||||
'public.tbl_sprache' => 'admin',
|
||||
'public.tbl_msg_thread' => 'admin',
|
||||
'public.tbl_msg_message' => 'admin'
|
||||
);
|
||||
);
|
||||
@@ -0,0 +1,70 @@
|
||||
<?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
|
||||
*/
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
defined('BASEPATH') || exit('No direct script access allowed');
|
||||
|
||||
class Adresse extends APIv1_Controller
|
||||
{
|
||||
/**
|
||||
* Person API constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
// Load model PersonModel
|
||||
$this->load->model('person/adresse_model', 'AdresseModel');
|
||||
// Load set the uid of the model to let to check the permissions
|
||||
$this->AdresseModel->setUID($this->_getUID());
|
||||
}
|
||||
|
||||
public function getAdresse()
|
||||
{
|
||||
$personID = $this->get("person_id");
|
||||
|
||||
if(isset($personID))
|
||||
{
|
||||
$result = $this->AdresseModel->loadWhere(array('person_id' => $personID));
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
public function postAdresse()
|
||||
{
|
||||
$post = $this->post();
|
||||
|
||||
if(is_array($post))
|
||||
{
|
||||
if(isset($post['adresse_id']))
|
||||
{
|
||||
$result = $this->AdresseModel->update($post['adresse_id'], $post);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $this->AdresseModel->insert($post);
|
||||
}
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user