mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-23 18:02:18 +00:00
Removed permission system from models
This commit is contained in:
@@ -17,8 +17,6 @@ class Extensions_model extends DB_Model
|
||||
*/
|
||||
public function getDependencies($dependencies)
|
||||
{
|
||||
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||
|
||||
return $this->execQuery(
|
||||
'SELECT *
|
||||
FROM '.$this->dbTable.'
|
||||
@@ -49,8 +47,6 @@ class Extensions_model extends DB_Model
|
||||
*/
|
||||
public function executeQuery($sql)
|
||||
{
|
||||
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||
|
||||
return $this->execQuery($sql);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,14 +19,6 @@ class Message_model extends DB_Model
|
||||
*/
|
||||
public function getMessagesByPerson($person_id, $oe_kurzbz, $all)
|
||||
{
|
||||
// Checks if the operation is permitted by the API caller
|
||||
if (isError($ent = $this->isEntitled('public.tbl_person', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
if (isError($ent = $this->isEntitled('public.tbl_msg_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
if (isError($ent = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
|
||||
$sql = 'SELECT m.message_id,
|
||||
m.person_id,
|
||||
m.subject,
|
||||
@@ -93,16 +85,6 @@ class Message_model extends DB_Model
|
||||
*/
|
||||
public function getMessagesOfPerson($person_id, $status = null)
|
||||
{
|
||||
// Checks if the operation is permitted by the API caller
|
||||
if (isError($ent = $this->isEntitled('public.tbl_person', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
if (isError($ent = $this->isEntitled('public.tbl_msg_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
if (isError($ent = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
if (isError($ent = $this->isEntitled('public.tbl_msg_recipient', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
|
||||
$sql = 'SELECT m.message_id,
|
||||
m.person_id,
|
||||
m.subject,
|
||||
@@ -129,7 +111,7 @@ class Message_model extends DB_Model
|
||||
s.statusinfo,
|
||||
s.insertamum AS statusamum
|
||||
FROM public.tbl_msg_message m
|
||||
JOIN public.tbl_msg_recipient r ON m.message_id = r.message_id
|
||||
JOIN public.tbl_msg_recipient r ON m.message_id = r.message_id
|
||||
JOIN public.tbl_person se ON (m.person_id = se.person_id)
|
||||
JOIN public.tbl_person re ON (r.person_id = re.person_id)
|
||||
LEFT JOIN (
|
||||
|
||||
@@ -42,11 +42,6 @@ class PersonLog_model extends CI_Model
|
||||
*/
|
||||
public function getLastLog($person_id, $taetigkeit_kurzbz = null, $app = null, $oe_kurzbz = null)
|
||||
{
|
||||
// Check Permissions
|
||||
$this->load->library('PermissionLib');
|
||||
if(!$this->permissionlib->isEntitled('system.tbl_log',PermissionLib::SELECT_RIGHT))
|
||||
show_error('Permission denied - You need Access to system.tbl_log');
|
||||
|
||||
$this->db->order_by('zeitpunkt', 'DESC');
|
||||
$this->db->order_by('log_id', 'DESC');
|
||||
$this->db->limit(1);
|
||||
@@ -72,11 +67,6 @@ class PersonLog_model extends CI_Model
|
||||
*/
|
||||
public function filterLog($person_id, $taetigkeit_kurzbz = null, $app = null, $oe_kurzbz = null)
|
||||
{
|
||||
// Check Permissions
|
||||
$this->load->library('PermissionLib');
|
||||
if(!$this->permissionlib->isEntitled('system.tbl_log',PermissionLib::SELECT_RIGHT))
|
||||
show_error('Permission denied - You need Access to system.tbl_log');
|
||||
|
||||
$this->db->order_by('zeitpunkt', 'DESC');
|
||||
$this->db->order_by('log_id', 'DESC');
|
||||
if (!is_null($taetigkeit_kurzbz))
|
||||
|
||||
@@ -17,12 +17,6 @@ class Phrase_model extends DB_Model
|
||||
*/
|
||||
public function getPhrases($app, $sprache, $phrase = null, $orgeinheit_kurzbz = null, $orgform_kurzbz = null)
|
||||
{
|
||||
// Checks if the operation is permitted by the API caller
|
||||
if (isError($ent = $this->isEntitled('system.tbl_phrase', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
if (isError($ent = $this->isEntitled('system.tbl_phrasentext', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
|
||||
$parametersArray = array('app' => $app, 'sprache' => $sprache);
|
||||
|
||||
$query = 'SELECT phrase,
|
||||
@@ -36,7 +30,7 @@ class Phrase_model extends DB_Model
|
||||
if (isset($phrase))
|
||||
{
|
||||
$parametersArray['phrase'] = $phrase;
|
||||
|
||||
|
||||
if (is_array($phrase))
|
||||
{
|
||||
$query .= ' AND phrase IN ?';
|
||||
@@ -57,7 +51,7 @@ class Phrase_model extends DB_Model
|
||||
$parametersArray['orgform_kurzbz'] = $orgform_kurzbz;
|
||||
$query .= ' AND orgform_kurzbz = ?';
|
||||
}
|
||||
|
||||
|
||||
return $this->execQuery($query, $parametersArray);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,16 +18,6 @@ class Recipient_model extends DB_Model
|
||||
*/
|
||||
public function getMessage($message_id, $person_id)
|
||||
{
|
||||
// Checks if the operation is permitted by the API caller
|
||||
if (isError($ent = $this->isEntitled('public.tbl_person', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
if (isError($ent = $this->isEntitled('public.tbl_kontakt', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
if (isError($ent = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
if (isError($ent = $this->isEntitled('public.tbl_msg_recipient', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
|
||||
$query = 'SELECT mr.message_id,
|
||||
mr.person_id,
|
||||
mm.subject,
|
||||
@@ -55,14 +45,6 @@ class Recipient_model extends DB_Model
|
||||
*/
|
||||
public function getMessageByToken($token)
|
||||
{
|
||||
// Checks if the operation is permitted by the API caller
|
||||
if (isError($ent = $this->isEntitled('public.tbl_msg_recipient', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
if (isError($ent = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
if (isError($ent = $this->isEntitled('public.tbl_msg_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
|
||||
$sql = 'SELECT r.message_id,
|
||||
m.person_id as sender_id,
|
||||
r.person_id as receiver_id,
|
||||
@@ -89,16 +71,6 @@ class Recipient_model extends DB_Model
|
||||
*/
|
||||
public function getMessagesByPerson($person_id, $oe_kurzbz, $all)
|
||||
{
|
||||
// Checks if the operation is permitted by the API caller
|
||||
if (isError($ent = $this->isEntitled('public.tbl_msg_recipient', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
if (isError($ent = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
if (isError($ent = $this->isEntitled('public.tbl_person', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
if (isError($ent = $this->isEntitled('public.tbl_msg_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
|
||||
$sql = 'SELECT DISTINCT ON (r.message_id) r.message_id,
|
||||
m.person_id,
|
||||
m.subject,
|
||||
@@ -166,21 +138,6 @@ class Recipient_model extends DB_Model
|
||||
*/
|
||||
public function getMessagesByUID($uid, $oe_kurzbz, $all)
|
||||
{
|
||||
// Checks if the operation is permitted by the API caller
|
||||
// TODO: Define the special right for reading own messages 'basis/message:own'
|
||||
// if same user
|
||||
if ($uid === getAuthUID())
|
||||
{
|
||||
if (isError($ent = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
}
|
||||
// if different user, for reading messages from other users
|
||||
else
|
||||
{
|
||||
if (isError($ent = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
}
|
||||
|
||||
// get Data
|
||||
$sql = 'SELECT DISTINCT ON (r.message_id) r.message_id,
|
||||
m.person_id,
|
||||
@@ -249,14 +206,6 @@ class Recipient_model extends DB_Model
|
||||
*/
|
||||
public function getMessages($kontaktType, $sent, $limit = null, $message_id = null)
|
||||
{
|
||||
// Checks if the operation is permitted by the API caller
|
||||
if (isError($ent = $this->isEntitled('public.tbl_msg_recipient', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
if (isError($ent = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
if (isError($ent = $this->isEntitled('public.tbl_kontakt', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
|
||||
$query = 'SELECT mm.message_id,
|
||||
ks.kontakt as sender,
|
||||
kr.kontakt as receiver,
|
||||
@@ -321,12 +270,6 @@ class Recipient_model extends DB_Model
|
||||
*/
|
||||
public function getCountUnreadMessages($person_id, $oe_kurzbz)
|
||||
{
|
||||
// Checks if the operation is permitted by the API caller
|
||||
if (isError($ent = $this->isEntitled('public.tbl_msg_recipient', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
if (isError($ent = $this->isEntitled('public.tbl_msg_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
|
||||
$sql = 'SELECT COUNT(r.message_id) AS unreadMessages
|
||||
FROM public.tbl_msg_recipient r
|
||||
JOIN public.tbl_msg_status s ON (r.message_id = s.message_id AND r.person_id = s.person_id)
|
||||
|
||||
@@ -17,11 +17,8 @@ class Vorlage_model extends DB_Model
|
||||
*/
|
||||
public function getMimeTypes()
|
||||
{
|
||||
// Checks rights
|
||||
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||
|
||||
$query = 'SELECT DISTINCT mimetype FROM public.tbl_vorlage ORDER BY mimetype';
|
||||
|
||||
|
||||
return $this->execQuery($query);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,6 @@ class Vorlagedokument_model extends DB_Model
|
||||
*/
|
||||
public function loadDokumenteFromVorlagestudiengang($vorlagestudiengang_id)
|
||||
{
|
||||
// Checks rights
|
||||
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||
|
||||
$qry = 'SELECT vorlagedokument_id,
|
||||
sort,
|
||||
vorlagestudiengang_id,
|
||||
@@ -29,7 +26,7 @@ class Vorlagedokument_model extends DB_Model
|
||||
JOIN public.tbl_dokument USING(dokument_kurzbz)
|
||||
WHERE vorlagestudiengang_id = ?
|
||||
ORDER BY sort ASC';
|
||||
|
||||
|
||||
return $this->execQuery($qry, array($vorlagestudiengang_id));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user