mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
- Removed body tag from footer.php and header.php
- Added permission fs/dms to dump.sql and fhcomplete.php - Added FilesystemLib to read and write from/in filesystem - Added FS_Model to manage filesystem with the same permission system of DB_Model - Added more models to handle the Dms - Modified Dms controller to use the new models
This commit is contained in:
@@ -231,6 +231,8 @@ $config['fhc_acl'] = array
|
||||
'wawi.tbl_rechnungsbetrag' => 'basis/rechnungsbetrag',
|
||||
'wawi.tbl_rechnungstyp' => 'basis/rechnungstyp',
|
||||
'wawi.tbl_zahlungstyp' => 'basis/zahlungstyp',
|
||||
|
||||
DMS_PATH => 'fs/dms',
|
||||
|
||||
'public.tbl_sprache' => 'admin'
|
||||
);
|
||||
|
||||
@@ -23,9 +23,13 @@ class Dms extends APIv1_Controller
|
||||
{
|
||||
parent::__construct();
|
||||
// Load model PersonModel
|
||||
$this->load->model('content/dms_model', 'DmsModel');
|
||||
// Load set the uid of the model to let to check the permissions
|
||||
$this->load->model('content/Dms_model', 'DmsModel');
|
||||
$this->load->model('content/DmsVersion_model', 'DmsVersionModel');
|
||||
$this->load->model('content/DmsFS_model', 'DmsFSModel');
|
||||
// Set the uid of the model to let to check the permissions
|
||||
$this->DmsModel->setUID($this->_getUID());
|
||||
$this->DmsVersionModel->setUID($this->_getUID());
|
||||
$this->DmsFSModel->setUID($this->_getUID());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,9 +45,52 @@ class Dms extends APIv1_Controller
|
||||
$result = $this->_getDms($dms_id, $version);
|
||||
if (is_object($result) && $result->error == EXIT_SUCCESS && is_array($result->retval) && count($result->retval) > 0)
|
||||
{
|
||||
if (($fileContent = $this->_readFile($result->retval[0]->filename)) != false)
|
||||
$resultFS = $this->DmsFSModel->read($result->retval[0]->filename);
|
||||
if (is_object($resultFS) && $resultFS->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result->retval[0]->file_content = $fileContent;
|
||||
$result->retval[0]->file_content = $resultFS->retval;
|
||||
}
|
||||
}
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function postDms()
|
||||
{
|
||||
$dms = $this->_parseData($this->post());
|
||||
|
||||
if ($this->_validate($dms))
|
||||
{
|
||||
$result = null;
|
||||
|
||||
if (isset($dms['dms_id']))
|
||||
{
|
||||
if ($this->_saveFileOnUpdate($dms))
|
||||
{
|
||||
$result = $this->DmsModel->update($dms['dms_id'], $this->DmsModel->filterFields($dms));
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->DmsVersionModel->update(array($dms['dms_id'], $dms['version']), $this->DmsVersionModel->filterFields($dms));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (($filename = $this->_saveFileOnInsert($dms)) !== false)
|
||||
{
|
||||
$result = $this->DmsModel->insert($this->DmsModel->filterFields($dms));
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->DmsVersionModel->insert($this->DmsVersionModel->filterFields($dms, $result->retval, $filename));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,102 +136,6 @@ class Dms extends APIv1_Controller
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function postDms()
|
||||
{
|
||||
$dms = $this->_parseData($this->post());
|
||||
if ($this->_validate($dms))
|
||||
{
|
||||
if (isset($dms['dms_id']))
|
||||
{
|
||||
if ($this->_saveFileOnUpdate($dms))
|
||||
{
|
||||
$result = $this->DmsModel->update($dms['dms_id'], $this->_dmsFieldsArray($dms));
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->DmsModel->updateDmsVersion($dms['dms_id'], $this->_dmsVersionFieldsArray($dms));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (($fileName = $this->_saveFileOnInsert($dms)) !== false)
|
||||
{
|
||||
$result = $this->DmsModel->insert($this->_dmsFieldsArray($dms));
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->DmsModel->insertDmsVersion($this->_dmsVersionFieldsArray($dms, $result->retval, $fileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function _dmsFieldsArray($dms)
|
||||
{
|
||||
$fieldsArray = array('oe_kurzbz', 'dokument_kurzbz', 'kategorie_kurzbz');
|
||||
$returnArray = array();
|
||||
|
||||
foreach ($fieldsArray as $value)
|
||||
{
|
||||
if (isset($dms[$value]))
|
||||
{
|
||||
$returnArray[$value] = $dms[$value];
|
||||
}
|
||||
}
|
||||
|
||||
return $returnArray;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function _dmsVersionFieldsArray($dms, $dms_id = null, $fileName = null)
|
||||
{
|
||||
$fieldsArray = array(
|
||||
'version',
|
||||
'mimetype',
|
||||
'name',
|
||||
'beschreibung',
|
||||
'letzterzugriff',
|
||||
'insertamum',
|
||||
'insertvon',
|
||||
'updateamum',
|
||||
'updatevon'
|
||||
);
|
||||
$returnArray = array();
|
||||
|
||||
foreach ($fieldsArray as $value)
|
||||
{
|
||||
if (isset($dms[$value]))
|
||||
{
|
||||
$returnArray[$value] = $dms[$value];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($dms_id))
|
||||
{
|
||||
$returnArray['dms_id'] = $dms_id;
|
||||
}
|
||||
if (isset($fileName))
|
||||
{
|
||||
$returnArray['filename'] = $fileName;
|
||||
}
|
||||
|
||||
return $returnArray;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -193,19 +144,11 @@ class Dms extends APIv1_Controller
|
||||
if(isset($dms['version']))
|
||||
{
|
||||
$result = $this->_getDms($dms['dms_id'], $dms['version']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $this->_getDms($dms['dms_id']);
|
||||
}
|
||||
|
||||
if (is_object($result) && $result->error == EXIT_SUCCESS && is_array($result->retval) && count($result->retval) > 0)
|
||||
{
|
||||
$fileName = DMS_PATH . $result->retval[0]->filename;
|
||||
|
||||
if (($fileContent = base64_decode($dms['file_content'])))
|
||||
if (is_object($result) && $result->error == EXIT_SUCCESS && is_array($result->retval) && count($result->retval) > 0)
|
||||
{
|
||||
if (file_put_contents($fileName, $fileContent))
|
||||
$result = $this->DmsFSModel->write($result->retval[0]->filename, $dms['file_content']);
|
||||
if (is_object($result) && $result->error == EXIT_SUCCESS)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -220,47 +163,17 @@ class Dms extends APIv1_Controller
|
||||
*/
|
||||
private function _saveFileOnInsert($dms)
|
||||
{
|
||||
$fileName = uniqid() . '.' . pathinfo($dms['name'], PATHINFO_EXTENSION);
|
||||
$FileNamePath = DMS_PATH . $fileName;
|
||||
$filename = uniqid() . '.' . pathinfo($dms['name'], PATHINFO_EXTENSION);
|
||||
|
||||
if (($fileContent = base64_decode($dms['file_content'])))
|
||||
$result = $this->DmsFSModel->write($filename, $dms['file_content']);
|
||||
if (is_object($result) && $result->error == EXIT_SUCCESS)
|
||||
{
|
||||
if ($fileHandle = fopen($FileNamePath, 'w'))
|
||||
{
|
||||
if(fwrite($fileHandle, $fileContent))
|
||||
{
|
||||
fclose($fileHandle);
|
||||
return $fileName;
|
||||
}
|
||||
}
|
||||
return $filename;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function _readFile($fileName)
|
||||
{
|
||||
$fileNamePath = DMS_PATH . $fileName;
|
||||
if (file_exists($fileNamePath))
|
||||
{
|
||||
if ($fileHandle = fopen($fileNamePath, 'r'))
|
||||
{
|
||||
$cTmpHEX = '';
|
||||
while (!feof($fileHandle))
|
||||
{
|
||||
$cTmpHEX .= fread($fileHandle, 8192);
|
||||
}
|
||||
fclose($fileHandle);
|
||||
return base64_encode($cTmpHEX);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private function _validate($dms = NULL)
|
||||
{
|
||||
if (!isset($dms['file_content']) || (isset($dms['file_content']) && $dms['file_content'] == ''))
|
||||
@@ -274,4 +187,4 @@ class Dms extends APIv1_Controller
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
|
||||
class FS_Model extends FHC_Model
|
||||
{
|
||||
protected $filepath; // Path of the file
|
||||
protected $acl; // Name of the permissions array index for FS writing, reading...
|
||||
|
||||
function __construct($filepath = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->library('FilesystemLib');
|
||||
$this->acl = $this->config->item('fhc_acl');
|
||||
$this->filepath = $filepath;
|
||||
}
|
||||
|
||||
/** ---------------------------------------------------------------
|
||||
* Read data from file system
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function read($filename)
|
||||
{
|
||||
// Check Class-Attributes
|
||||
if (is_null($this->filepath))
|
||||
return $this->_error(lang('fhc_'.FHC_ERROR), FHC_MODEL_ERROR);
|
||||
|
||||
// Check method parameters
|
||||
if (is_null($filename))
|
||||
return $this->_error(lang('fhc_'.FHC_ERROR), FHC_MODEL_ERROR);
|
||||
|
||||
// Check rights
|
||||
if (! $this->fhc_db_acl->isBerechtigt($this->acl[$this->filepath], 's'))
|
||||
return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl[$this->filepath], FHC_MODEL_ERROR);
|
||||
|
||||
if (!is_null($data = $this->filesystemlib->read($this->filepath, $filename)))
|
||||
{
|
||||
return $this->_success(base64_encode($data));
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->_error(lang('fhc_'.FHC_ERROR), FHC_MODEL_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/** ---------------------------------------------------------------
|
||||
* Writing data to file system
|
||||
*
|
||||
* @param string $fileContent File content
|
||||
* @return object
|
||||
*/
|
||||
public function write($filename, $content)
|
||||
{
|
||||
// Check Class-Attributes
|
||||
if (is_null($this->filepath))
|
||||
return $this->_error(lang('fhc_'.FHC_ERROR), FHC_MODEL_ERROR);
|
||||
|
||||
// Check method parameters
|
||||
if (is_null($filename))
|
||||
return $this->_error(lang('fhc_'.FHC_ERROR), FHC_MODEL_ERROR);
|
||||
if (is_null($content))
|
||||
return $this->_error(lang('fhc_'.FHC_ERROR), FHC_MODEL_ERROR);
|
||||
|
||||
// Check rights
|
||||
if (! $this->fhc_db_acl->isBerechtigt($this->acl[$this->filepath], 'i'))
|
||||
return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl[$this->filepath], FHC_MODEL_ERROR);
|
||||
|
||||
if ($this->filesystemlib->write($this->filepath, $filename, base64_decode($content)) === true)
|
||||
{
|
||||
return $this->_success(FHC_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->_error(lang('fhc_'.FHC_ERROR), FHC_MODEL_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/** ---------------------------------------------------------------
|
||||
* Append data to a file
|
||||
*
|
||||
* @param array $data File content
|
||||
* @return array
|
||||
*/
|
||||
public function append($filename, $content)
|
||||
{
|
||||
// Check Class-Attributes
|
||||
if (is_null($this->filepath))
|
||||
return $this->_error(lang('fhc_'.FHC_ERROR), FHC_MODEL_ERROR);
|
||||
|
||||
// Check method parameters
|
||||
if (is_null($filename))
|
||||
return $this->_error(lang('fhc_'.FHC_ERROR), FHC_MODEL_ERROR);
|
||||
if (is_null($content))
|
||||
return $this->_error(lang('fhc_'.FHC_ERROR), FHC_MODEL_ERROR);
|
||||
|
||||
// Check rights
|
||||
if (! $this->fhc_db_acl->isBerechtigt($this->acl[$this->filepath], 'i'))
|
||||
return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl[$this->filepath], FHC_MODEL_ERROR);
|
||||
|
||||
if ($this->filesystemlib->append($this->filepath, $filename, base64_decode($content)) === true)
|
||||
{
|
||||
return $this->_success(FHC_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->_error(lang('fhc_'.FHC_ERROR), FHC_MODEL_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/** ---------------------------------------------------------------
|
||||
* Delete data from file system
|
||||
*
|
||||
* @param string $id Primary Key for DELETE
|
||||
* @return array
|
||||
*/
|
||||
public function remove($filename)
|
||||
{
|
||||
// Check Class-Attributes
|
||||
if (is_null($this->filepath))
|
||||
return $this->_error(lang('fhc_'.FHC_ERROR), FHC_MODEL_ERROR);
|
||||
|
||||
// Check method parameters
|
||||
if (is_null($filename))
|
||||
return $this->_error(lang('fhc_'.FHC_ERROR), FHC_MODEL_ERROR);
|
||||
|
||||
// Check rights
|
||||
if (! $this->fhc_db_acl->isBerechtigt($this->acl[$this->filepath], 'd'))
|
||||
return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl[$this->filepath], FHC_MODEL_ERROR);
|
||||
|
||||
if ($this->filesystemlib->remove($this->filepath, $filename) === true)
|
||||
{
|
||||
return $this->_success(FHC_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->_error(lang('fhc_'.FHC_ERROR), FHC_MODEL_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/** ---------------------------------------------------------------
|
||||
* Rename a file
|
||||
*
|
||||
* @param string $id Primary Key for DELETE
|
||||
* @return array
|
||||
*/
|
||||
public function rename($filename, $newFilename)
|
||||
{
|
||||
// Check Class-Attributes
|
||||
if (is_null($this->filepath))
|
||||
return $this->_error(lang('fhc_'.FHC_ERROR), FHC_MODEL_ERROR);
|
||||
|
||||
// Check method parameters
|
||||
if (is_null($filename))
|
||||
return $this->_error(lang('fhc_'.FHC_ERROR), FHC_MODEL_ERROR);
|
||||
if (is_null($newFilename))
|
||||
return $this->_error(lang('fhc_'.FHC_ERROR), FHC_MODEL_ERROR);
|
||||
|
||||
// Check rights
|
||||
if (! $this->fhc_db_acl->isBerechtigt($this->acl[$this->filepath], 'u'))
|
||||
return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl[$this->filepath], FHC_MODEL_ERROR);
|
||||
|
||||
if ($this->filesystemlib->rename($this->filepath, $filename, $this->filepath, $newFilename) === true)
|
||||
{
|
||||
return $this->_success(FHC_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->_error(lang('fhc_'.FHC_ERROR), FHC_MODEL_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
<?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 FilesystemLib
|
||||
{
|
||||
/*
|
||||
*
|
||||
*/
|
||||
public function __construct() {}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
private function checkParameters($filepath, $filename)
|
||||
{
|
||||
if (isset($filepath) && isset($filename) &&
|
||||
$filepath != '' && $filename != '')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
public function read($filepath, $filename)
|
||||
{
|
||||
$result = null;
|
||||
|
||||
if ($this->checkParameters($filepath, $filename))
|
||||
{
|
||||
$resource = $filepath . DIRECTORY_SEPARATOR . $filename;
|
||||
if (file_exists($resource) && $fileHandle = fopen($resource, 'r'))
|
||||
{
|
||||
$result = '';
|
||||
while (!feof($fileHandle))
|
||||
{
|
||||
$result .= fread($fileHandle, 8192);
|
||||
}
|
||||
fclose($fileHandle);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
public function write($filepath, $filename, $content)
|
||||
{
|
||||
$result = null;
|
||||
|
||||
if ($this->checkParameters($filepath, $filename) && isset($content))
|
||||
{
|
||||
$resource = $filepath . DIRECTORY_SEPARATOR . $filename;
|
||||
if (is_writable($filepath) && $fileHandle = fopen($resource, 'w'))
|
||||
{
|
||||
if (fwrite($fileHandle, $content) !== false)
|
||||
{
|
||||
$result = true;
|
||||
}
|
||||
fclose($fileHandle);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
public function append($filepath, $filename, $content)
|
||||
{
|
||||
$result = null;
|
||||
|
||||
if ($this->checkParameters($filepath, $filename) && isset($content))
|
||||
{
|
||||
$resource = $filepath . DIRECTORY_SEPARATOR . $filename;
|
||||
if (is_writable($resource) && $fileHandle = fopen($resource, 'a'))
|
||||
{
|
||||
if (fwrite($fileHandle, $content) !== false)
|
||||
{
|
||||
$result = true;
|
||||
}
|
||||
fclose($fileHandle);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
public function remove($filepath, $filename)
|
||||
{
|
||||
$result = null;
|
||||
|
||||
if ($this->checkParameters($filepath, $filename))
|
||||
{
|
||||
if (is_writable($filepath))
|
||||
{
|
||||
$resource = $filepath . DIRECTORY_SEPARATOR . $filename;
|
||||
$result = unlink($resource);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
public function rename($filepath, $filename, $newFilepath, $newFilename)
|
||||
{
|
||||
$result = null;
|
||||
|
||||
if ($this->checkParameters($filepath, $filename) && $this->checkParameters($newFilepath, $newFilename))
|
||||
{
|
||||
$resource = $filepath . DIRECTORY_SEPARATOR . $filename;
|
||||
if (is_writable($filepath) && is_writable($newFilepath) && file_exists($resource))
|
||||
{
|
||||
$destination = $newFilepath . DIRECTORY_SEPARATOR . $newFilename;
|
||||
$result = rename($resource, $destination);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
class DmsFS_model extends FS_Model
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->filepath = DMS_PATH;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
class DmsVersion_model extends DB_Model
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'campus.tbl_dms_version';
|
||||
$this->pk = array('dms_id', 'version');
|
||||
$this->hasSequence = false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function filterFields($dms, $dms_id = null, $fileName = null)
|
||||
{
|
||||
$fieldsArray = array(
|
||||
'version',
|
||||
'mimetype',
|
||||
'name',
|
||||
'beschreibung',
|
||||
'letzterzugriff',
|
||||
'insertamum',
|
||||
'insertvon',
|
||||
'updateamum',
|
||||
'updatevon'
|
||||
);
|
||||
$returnArray = array();
|
||||
|
||||
foreach ($fieldsArray as $value)
|
||||
{
|
||||
if (isset($dms[$value]))
|
||||
{
|
||||
$returnArray[$value] = $dms[$value];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($dms_id))
|
||||
{
|
||||
$returnArray['dms_id'] = $dms_id;
|
||||
}
|
||||
if (isset($fileName))
|
||||
{
|
||||
$returnArray['filename'] = $fileName;
|
||||
}
|
||||
|
||||
return $returnArray;
|
||||
}
|
||||
}
|
||||
@@ -12,39 +12,22 @@ class Dms_model extends DB_Model
|
||||
$this->pk = 'dms_id';
|
||||
}
|
||||
|
||||
public function insertDmsVersion($data)
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function filterFields($dms)
|
||||
{
|
||||
$tableName = 'campus.tbl_dms_version';
|
||||
$fieldsArray = array('oe_kurzbz', 'dokument_kurzbz', 'kategorie_kurzbz');
|
||||
$returnArray = array();
|
||||
|
||||
// Check rights
|
||||
if (! $this->fhc_db_acl->isBerechtigt($this->acl[$tableName], 'i'))
|
||||
return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl[$tableName], FHC_MODEL_ERROR);
|
||||
|
||||
// DB-INSERT
|
||||
if ($this->db->insert($tableName, $data))
|
||||
return $this->_success($this->db->insert_id());
|
||||
else
|
||||
return $this->_error($this->db->error(), FHC_DB_ERROR);
|
||||
}
|
||||
|
||||
public function updateDmsVersion($id, $data)
|
||||
{
|
||||
$tableName = 'campus.tbl_dms_version';
|
||||
foreach ($fieldsArray as $value)
|
||||
{
|
||||
if (isset($dms[$value]))
|
||||
{
|
||||
$returnArray[$value] = $dms[$value];
|
||||
}
|
||||
}
|
||||
|
||||
// Check Class-Attributes
|
||||
if (is_null($this->pk))
|
||||
return $this->_error(lang('fhc_'.FHC_NOPK), FHC_MODEL_ERROR);
|
||||
|
||||
// Check rights
|
||||
if (! $this->fhc_db_acl->isBerechtigt($this->acl[$tableName], 'u'))
|
||||
return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl[$tableName], FHC_MODEL_ERROR);
|
||||
|
||||
// DB-UPDATE
|
||||
$this->db->where('dms_id', $id);
|
||||
|
||||
if ($this->db->update($tableName, $data))
|
||||
return $this->_success($id);
|
||||
else
|
||||
return $this->_error($this->db->error(), FHC_DB_ERROR);
|
||||
return $returnArray;
|
||||
}
|
||||
}
|
||||
@@ -1,2 +1 @@
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
@@ -57,6 +57,4 @@ if ($tablesort)
|
||||
<link rel="stylesheet" href="<?php echo base_url('vendor/json-forms/dist/css/brutusin-json-forms.min.css'); ?>"/>
|
||||
<script src="<?php echo base_url('vendor/json-forms/dist/js/brutusin-json-forms.min.js'); ?>"></script>
|
||||
<?php endif ?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
</head>
|
||||
@@ -869,6 +869,7 @@ INSERT INTO system.tbl_berechtigung (berechtigung_kurzbz, beschreibung) VALUES('
|
||||
INSERT INTO system.tbl_berechtigung (berechtigung_kurzbz, beschreibung) VALUES('lehre/reservierung', '');
|
||||
INSERT INTO system.tbl_berechtigung (berechtigung_kurzbz, beschreibung) VALUES('lehre/reihungstest', '');
|
||||
INSERT INTO system.tbl_berechtigung (berechtigung_kurzbz, beschreibung) VALUES('wawi/inventar:begrenzt', '');
|
||||
INSERT INTO system.tbl_berechtigung (berechtigung_kurzbz, beschreibung) VALUES('fs/dms', '');
|
||||
|
||||
-- INSERT link between user admin and permissions
|
||||
INSERT INTO system.tbl_rolleberechtigung (berechtigung_kurzbz, rolle_kurzbz, art) VALUES('basis/archiv', 'admin', 'suid');
|
||||
@@ -1092,6 +1093,7 @@ INSERT INTO system.tbl_rolleberechtigung (berechtigung_kurzbz, rolle_kurzbz, art
|
||||
INSERT INTO system.tbl_rolleberechtigung (berechtigung_kurzbz, rolle_kurzbz, art) VALUES('lehre/reservierung', 'admin', 'suid');
|
||||
INSERT INTO system.tbl_rolleberechtigung (berechtigung_kurzbz, rolle_kurzbz, art) VALUES('lehre/reihungstest', 'admin', 'suid');
|
||||
INSERT INTO system.tbl_rolleberechtigung (berechtigung_kurzbz, rolle_kurzbz, art) VALUES('wawi/inventar:begrenzt', 'admin', 'suid');
|
||||
INSERT INTO system.tbl_rolleberechtigung (berechtigung_kurzbz, rolle_kurzbz, art) VALUES('fs/dms', 'admin', 'suid');
|
||||
|
||||
-- EMPTY public.tbl_statistik
|
||||
DELETE FROM public.tbl_statistik;
|
||||
|
||||
Reference in New Issue
Block a user