Added permissions array to every controller that extends APIv1_Controller

CheckUserAuth and Test controllers now extends directly the REST_Controller
This commit is contained in:
Paolo
2018-03-28 12:09:54 +02:00
parent e4a254a284
commit 1fcc878cb5
221 changed files with 1728 additions and 1624 deletions
@@ -21,7 +21,7 @@ class Ampel extends APIv1_Controller
*/
public function __construct()
{
parent::__construct();
parent::__construct(array('Ampel' => 'basis/ampel:rw'));
// Load model AmpelModel
$this->load->model('content/ampel_model', 'AmpelModel');
}
@@ -32,11 +32,11 @@ class Ampel extends APIv1_Controller
public function getAmpel()
{
$ampelID = $this->get('ampel_id');
if (isset($ampelID))
{
$result = $this->AmpelModel->load($ampelID);
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -60,7 +60,7 @@ class Ampel extends APIv1_Controller
{
$result = $this->AmpelModel->insert($this->post());
}
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -68,9 +68,9 @@ class Ampel extends APIv1_Controller
$this->response();
}
}
private function _validate($ampel = NULL)
{
return true;
}
}
}
@@ -21,7 +21,7 @@ class Content extends APIv1_Controller
*/
public function __construct()
{
parent::__construct();
parent::__construct(array('Content' => 'basis/content:rw'));
// Load model ContentModel
$this->load->model('content/content_model', 'ContentModel');
}
@@ -32,11 +32,11 @@ class Content extends APIv1_Controller
public function getContent()
{
$contentID = $this->get('content_id');
if (isset($contentID))
{
$result = $this->ContentModel->load($contentID);
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -60,7 +60,7 @@ class Content extends APIv1_Controller
{
$result = $this->ContentModel->insert($this->post());
}
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -68,9 +68,9 @@ class Content extends APIv1_Controller
$this->response();
}
}
private function _validate($content = NULL)
{
return true;
}
}
}
@@ -21,7 +21,7 @@ class Contentchild extends APIv1_Controller
*/
public function __construct()
{
parent::__construct();
parent::__construct(array('Contentchild' => 'basis/contentchild:rw'));
// Load model ContentchildModel
$this->load->model('content/contentchild_model', 'ContentchildModel');
}
@@ -32,11 +32,11 @@ class Contentchild extends APIv1_Controller
public function getContentchild()
{
$contentchildID = $this->get('contentchild_id');
if (isset($contentchildID))
{
$result = $this->ContentchildModel->load($contentchildID);
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -60,7 +60,7 @@ class Contentchild extends APIv1_Controller
{
$result = $this->ContentchildModel->insert($this->post());
}
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -68,9 +68,9 @@ class Contentchild extends APIv1_Controller
$this->response();
}
}
private function _validate($contentchild = NULL)
{
return true;
}
}
}
@@ -21,7 +21,7 @@ class Contentgruppe extends APIv1_Controller
*/
public function __construct()
{
parent::__construct();
parent::__construct(array('Contentgruppe' => 'basis/contentgruppe:rw'));
// Load model ContentgruppeModel
$this->load->model('content/contentgruppe_model', 'ContentgruppeModel');
}
@@ -33,11 +33,11 @@ class Contentgruppe extends APIv1_Controller
{
$gruppe_kurzbz = $this->get('gruppe_kurzbz');
$content_id = $this->get('content_id');
if (isset($gruppe_kurzbz) && isset($content_id))
{
$result = $this->ContentgruppeModel->load(array($gruppe_kurzbz, $content_id));
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -61,7 +61,7 @@ class Contentgruppe extends APIv1_Controller
{
$result = $this->ContentgruppeModel->insert($this->post());
}
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -69,9 +69,9 @@ class Contentgruppe extends APIv1_Controller
$this->response();
}
}
private function _validate($contentgruppe = NULL)
{
return true;
}
}
}
@@ -21,7 +21,7 @@ class Contentlog extends APIv1_Controller
*/
public function __construct()
{
parent::__construct();
parent::__construct(array('Contentlog' => 'basis/contentlog:rw'));
// Load model ContentlogModel
$this->load->model('content/contentlog_model', 'ContentlogModel');
}
@@ -32,11 +32,11 @@ class Contentlog extends APIv1_Controller
public function getContentlog()
{
$contentlogID = $this->get('contentlog_id');
if (isset($contentlogID))
{
$result = $this->ContentlogModel->load($contentlogID);
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -60,7 +60,7 @@ class Contentlog extends APIv1_Controller
{
$result = $this->ContentlogModel->insert($this->post());
}
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -68,9 +68,9 @@ class Contentlog extends APIv1_Controller
$this->response();
}
}
private function _validate($contentlog = NULL)
{
return true;
}
}
}
@@ -21,7 +21,7 @@ class Contentsprache extends APIv1_Controller
*/
public function __construct()
{
parent::__construct();
parent::__construct(array('Contentsprache' => 'basis/contentsprache:rw'));
// Load model ContentspracheModel
$this->load->model('content/contentsprache_model', 'ContentspracheModel');
}
@@ -32,11 +32,11 @@ class Contentsprache extends APIv1_Controller
public function getContentsprache()
{
$contentspracheID = $this->get('contentsprache_id');
if (isset($contentspracheID))
{
$result = $this->ContentspracheModel->load($contentspracheID);
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -60,7 +60,7 @@ class Contentsprache extends APIv1_Controller
{
$result = $this->ContentspracheModel->insert($this->post());
}
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -68,9 +68,9 @@ class Contentsprache extends APIv1_Controller
$this->response();
}
}
private function _validate($contentsprache = NULL)
{
return true;
}
}
}
+22 -22
View File
@@ -17,27 +17,27 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
class Dms extends APIv1_Controller
{
/**
*
*
*/
public function __construct()
{
parent::__construct();
parent::__construct(array('Dms' => 'basis/dms:rw', 'AktenAcceptedDms' => 'basis/dms:r', 'DelDms' => 'basis/dms:w'));
// Load library DmsLib
$this->load->library('DmsLib');
}
/**
*
*
*/
public function getDms()
{
$dms_id = $this->get('dms_id');
$version = $this->get('version');
if (isset($dms_id))
{
$result = $this->dmslib->read($dms_id, $version);
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -45,20 +45,20 @@ class Dms extends APIv1_Controller
$this->response();
}
}
/**
*
*
*/
public function getAktenAcceptedDms()
{
$person_id = $this->get('person_id');
$dokument_kurzbz = $this->get('dokument_kurzbz');
$no_file = $this->get('no_file');
if (isset($person_id))
{
$result = $this->dmslib->getAktenAcceptedDms($person_id, $dokument_kurzbz, $no_file);
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -66,18 +66,18 @@ class Dms extends APIv1_Controller
$this->response();
}
}
/**
*
*
*/
public function postDms()
{
$dms = $this->post();
if ($this->_validatePost($dms))
{
$result = $this->dmslib->save($dms);
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -85,18 +85,18 @@ class Dms extends APIv1_Controller
$this->response();
}
}
/**
*
*
*/
public function postDelDms()
{
$dms = $this->post();
if ($this->_validateDelete($this->post()))
{
$result = $this->dmslib->delete($dms['person_id'], $dms['dms_id']);
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -104,7 +104,7 @@ class Dms extends APIv1_Controller
$this->response();
}
}
private function _validatePost($dms = null)
{
if (!isset($dms))
@@ -119,10 +119,10 @@ class Dms extends APIv1_Controller
{
return false;
}
return true;
}
private function _validateDelete($dms = null)
{
if (!isset($dms))
@@ -137,7 +137,7 @@ class Dms extends APIv1_Controller
{
return false;
}
return true;
}
}
@@ -21,7 +21,7 @@ class Infoscreen extends APIv1_Controller
*/
public function __construct()
{
parent::__construct();
parent::__construct(array('Infoscreen' => 'basis/infoscreen:rw'));
// Load model InfoscreenModel
$this->load->model('content/infoscreen_model', 'InfoscreenModel');
}
@@ -32,11 +32,11 @@ class Infoscreen extends APIv1_Controller
public function getInfoscreen()
{
$infoscreenID = $this->get('infoscreen_id');
if (isset($infoscreenID))
{
$result = $this->InfoscreenModel->load($infoscreenID);
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -60,7 +60,7 @@ class Infoscreen extends APIv1_Controller
{
$result = $this->InfoscreenModel->insert($this->post());
}
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -68,9 +68,9 @@ class Infoscreen extends APIv1_Controller
$this->response();
}
}
private function _validate($infoscreen = NULL)
{
return true;
}
}
}
@@ -21,7 +21,7 @@ class News extends APIv1_Controller
*/
public function __construct()
{
parent::__construct();
parent::__construct(array('News' => 'basis/news:rw'));
// Load model NewsModel
$this->load->model('content/news_model', 'NewsModel');
}
@@ -32,11 +32,11 @@ class News extends APIv1_Controller
public function getNews()
{
$newsID = $this->get('news_id');
if (isset($newsID))
{
$result = $this->NewsModel->load($newsID);
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -60,7 +60,7 @@ class News extends APIv1_Controller
{
$result = $this->NewsModel->insert($this->post());
}
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -68,9 +68,9 @@ class News extends APIv1_Controller
$this->response();
}
}
private function _validate($news = NULL)
{
return true;
}
}
}
@@ -21,7 +21,7 @@ class Template extends APIv1_Controller
*/
public function __construct()
{
parent::__construct();
parent::__construct(array('Template' => 'basis/template:rw'));
// Load model TemplateModel
$this->load->model('content/template_model', 'TemplateModel');
}
@@ -32,11 +32,11 @@ class Template extends APIv1_Controller
public function getTemplate()
{
$template_kurzbz = $this->get('template_kurzbz');
if (isset($template_kurzbz))
{
$result = $this->TemplateModel->load($template_kurzbz);
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -60,7 +60,7 @@ class Template extends APIv1_Controller
{
$result = $this->TemplateModel->insert($this->post());
}
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -68,9 +68,9 @@ class Template extends APIv1_Controller
$this->response();
}
}
private function _validate($template = NULL)
{
return true;
}
}
}
@@ -21,7 +21,7 @@ class Veranstaltung extends APIv1_Controller
*/
public function __construct()
{
parent::__construct();
parent::__construct(array('Veranstaltung' => 'basis/veranstaltung:rw'));
// Load model VeranstaltungModel
$this->load->model('content/veranstaltung_model', 'VeranstaltungModel');
}
@@ -32,11 +32,11 @@ class Veranstaltung extends APIv1_Controller
public function getVeranstaltung()
{
$veranstaltungID = $this->get('veranstaltung_id');
if (isset($veranstaltungID))
{
$result = $this->VeranstaltungModel->load($veranstaltungID);
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -60,7 +60,7 @@ class Veranstaltung extends APIv1_Controller
{
$result = $this->VeranstaltungModel->insert($this->post());
}
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -68,9 +68,9 @@ class Veranstaltung extends APIv1_Controller
$this->response();
}
}
private function _validate($veranstaltung = NULL)
{
return true;
}
}
}
@@ -21,7 +21,7 @@ class Veranstaltungskategorie extends APIv1_Controller
*/
public function __construct()
{
parent::__construct();
parent::__construct(array('Veranstaltungskategorie' => 'basis/veranstaltungskategorie:rw'));
// Load model VeranstaltungskategorieModel
$this->load->model('content/veranstaltungskategorie_model', 'VeranstaltungskategorieModel');
}
@@ -32,11 +32,11 @@ class Veranstaltungskategorie extends APIv1_Controller
public function getVeranstaltungskategorie()
{
$veranstaltungskategorie_kurzbz = $this->get('veranstaltungskategorie_kurzbz');
if (isset($veranstaltungskategorie_kurzbz))
{
$result = $this->VeranstaltungskategorieModel->load($veranstaltungskategorie_kurzbz);
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -60,7 +60,7 @@ class Veranstaltungskategorie extends APIv1_Controller
{
$result = $this->VeranstaltungskategorieModel->insert($this->post());
}
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -68,9 +68,9 @@ class Veranstaltungskategorie extends APIv1_Controller
$this->response();
}
}
private function _validate($veranstaltungskategorie = NULL)
{
return true;
}
}
}