mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
- Removed permission system from DB_Model and FHC_Model
- Removed method _isEntitled from DB_Model - Removed method isEntitled from DHC_Model
This commit is contained in:
@@ -60,9 +60,6 @@ class DB_Model extends FHC_Model
|
||||
// Check class properties
|
||||
if (is_null($this->dbTable)) return error(FHC_MODEL_ERROR, FHC_NODBTABLE);
|
||||
|
||||
// Checks rights
|
||||
if (isError($ent = $this->_isEntitled(PermissionLib::INSERT_RIGHT))) return $ent;
|
||||
|
||||
// If this table has UDF and the validation of them is ok
|
||||
if (isError($validate = $this->_manageUDFs($data, $this->dbTable))) return $validate;
|
||||
|
||||
@@ -110,9 +107,6 @@ class DB_Model extends FHC_Model
|
||||
if (is_null($this->pk)) return error(FHC_MODEL_ERROR, FHC_NOPK);
|
||||
if (is_null($this->dbTable)) return error(FHC_MODEL_ERROR, FHC_NODBTABLE);
|
||||
|
||||
// Checks rights
|
||||
if (isError($ent = $this->_isEntitled(PermissionLib::UPDATE_RIGHT))) return $ent;
|
||||
|
||||
// If this table has UDF and the validation of them is ok
|
||||
if (isError($validate = $this->_manageUDFs($data, $this->dbTable, $id))) return $validate;
|
||||
|
||||
@@ -156,9 +150,6 @@ class DB_Model extends FHC_Model
|
||||
if (is_null($this->dbTable)) return error(FHC_MODEL_ERROR, FHC_NODBTABLE);
|
||||
if (is_null($this->pk)) return error(FHC_MODEL_ERROR, FHC_NOPK);
|
||||
|
||||
// Checks rights
|
||||
if (isError($ent = $this->_isEntitled(PermissionLib::DELETE_RIGHT))) return $ent;
|
||||
|
||||
$tmpId = $id;
|
||||
|
||||
// Check for composite Primary Key
|
||||
@@ -197,9 +188,6 @@ class DB_Model extends FHC_Model
|
||||
if (is_null($this->pk)) return error(FHC_MODEL_ERROR, FHC_NOPK);
|
||||
if (is_null($this->dbTable)) return error(FHC_MODEL_ERROR, FHC_NODBTABLE);
|
||||
|
||||
// Checks rights
|
||||
if (isError($ent = $this->_isEntitled(PermissionLib::SELECT_RIGHT))) return $ent;
|
||||
|
||||
$tmpId = $id;
|
||||
|
||||
// Check for composite Primary Key
|
||||
@@ -236,9 +224,6 @@ class DB_Model extends FHC_Model
|
||||
// Check class properties
|
||||
if (is_null($this->dbTable)) return error(FHC_MODEL_ERROR, FHC_NODBTABLE);
|
||||
|
||||
// Checks rights
|
||||
if (isError($ent = $this->_isEntitled(PermissionLib::SELECT_RIGHT))) return $ent;
|
||||
|
||||
// Execute query
|
||||
if ($result = $this->db->get_where($this->dbTable, $where))
|
||||
{
|
||||
@@ -267,9 +252,6 @@ class DB_Model extends FHC_Model
|
||||
// Check class properties
|
||||
if (is_null($this->dbTable)) return error(FHC_MODEL_ERROR, FHC_NODBTABLE);
|
||||
|
||||
// Checks rights
|
||||
if (isError($ent = $this->_isEntitled(PermissionLib::SELECT_RIGHT))) return $ent;
|
||||
|
||||
// List of tables on which it will work
|
||||
$tables = array_merge(array($mainTable), $sideTables);
|
||||
// Array that will contain the number of columns of each table
|
||||
@@ -813,25 +795,6 @@ class DB_Model extends FHC_Model
|
||||
return array_combine($idexes, $values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the caller is entitled to perform this operation with this right
|
||||
*/
|
||||
private function _isEntitled($permission)
|
||||
{
|
||||
$ent = success(true);
|
||||
|
||||
$ent = $this->isEntitled($this->dbTable, $permission, FHC_NORIGHT, FHC_MODEL_ERROR);
|
||||
// If true is not returned, then an error has occurred
|
||||
if (isError($ent))
|
||||
{
|
||||
// Before returning the object containing the error, reset the build query
|
||||
// This is for preventing that other parts of the query will be built before of the next execution
|
||||
$this->resetQuery();
|
||||
}
|
||||
|
||||
return $ent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper method for UDFLib->manageUDFs
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user