ACL-System

This commit is contained in:
Paminger
2016-05-02 16:07:25 +02:00
parent 5bd5ac4aad
commit fc6e2de1c9
7 changed files with 217 additions and 42 deletions
+4 -4
View File
@@ -19,8 +19,8 @@ class Person_model extends DB_Model
// Checks if the operation is permitted by the API caller
// All the code should be put inside this if statement
if(isAllowed($this->getAddonID(), 'person'))
{
/*if(isAllowed($this->getAddonID(), 'person'))
{*/
if((isset($code)) && (isset($email)))
{
$result = $this->_getPersonByCodeAndEmail($code, $email);
@@ -33,7 +33,7 @@ class Person_model extends DB_Model
{
$result = $this->_getPersonByID($personId);
}
}
//}
return $result;
}
@@ -826,4 +826,4 @@ class Person_model extends DB_Model
->where("p.zugangscode", $code);
return $this->db->get()->result_array();
}
}
}
+14 -2
View File
@@ -5,7 +5,7 @@ class Prestudent_model extends DB_Model
/**
*
* Constructor
*/
public function __construct()
{
@@ -19,11 +19,23 @@ class Prestudent_model extends DB_Model
*/
public function loadPrestudentPerson($prestudentID)
{
// Check the rights
if (! $this->fhc_db_acl->isBerechtigt('basis/person', 's'))
return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> basis/person', FHC_MODEL_ERROR);
// Prepare SQL-Query
$this->db->select('*')
->from('public.tbl_prestudent')
->join('public.tbl_person', 'person_id')
->where('prestudent_id', $prestudentID);
return $this->db->get()->result_array();
// Do the query
$result = $this->db->get()->result_object();
// Return the result
if ($result)
return $this->_success($result);
else
return $this->_error($this->db->error(), FHC_DB_ERROR);
}