- Added permission basis/phrase to dump.sql

- The function getAuthUID() present in the helper fhcauth_helper.php
now tries to work always with CI session to get the uid
- REST_controller doesn't need anymore to handle the uid
- FHC_Controller and FHC_Model load fhcauth_helper in their constructor,
so any class that extends them now could call the function getAuthUID()
anywhere in the code
- The controllers don't need anymore to pass the uid to the models or to the
libraries
- Library FHC_DB_ACL load fhcauth_helper in its constructor and uses getAuthID()
This commit is contained in:
paolo
2016-06-24 13:22:27 +02:00
parent 58a6da42ae
commit 9a4f5480c4
231 changed files with 412 additions and 636 deletions
+9 -30
View File
@@ -35,8 +35,7 @@ require_once(FCPATH.'include/benutzerberechtigung.class.php');
class FHC_DB_ACL
{
public $bb;
protected $_uid;
protected $bb;
/**
* Auth Username, Password over FH-Complete
@@ -45,37 +44,17 @@ class FHC_DB_ACL
* @param string $password
* @return bool
*/
function __construct($param = null)
function __construct()
{
$this->CI =& get_instance();
$this->CI->load->helper('fhcauth');
$this->bb = new benutzerberechtigung();
if (is_array($param) && isset($param['uid']))
$this->_uid = $param['uid'];
}
function isBerechtigt($berechtigung_kurzbz, $art=null, $oe_kurzbz=null, $kostenstelle_id=null)
function isBerechtigt($berechtigung_kurzbz, $art = null, $oe_kurzbz = null, $kostenstelle_id = null)
{
$this->bb->getBerechtigungen($this->_uid);
return $this->bb->isBerechtigt($berechtigung_kurzbz, $oe_kurzbz=null, $art=null, $kostenstelle_id=null);
$this->bb->getBerechtigungen(getAuthUID());
return $this->bb->isBerechtigt($berechtigung_kurzbz, $oe_kurzbz, $art, $kostenstelle_id);
}
/** ---------------------------------------------------------------
* Set UID
*
* @param string $uid
* @return bool
*/
public function setUID($uid)
{
return $this->_uid = $uid;
}
/** ---------------------------------------------------------------
* get UID
*
* @return string or (bool)false
*/
public function getUID()
{
return $this->_uid;
}
}
}
+5 -17
View File
@@ -1,19 +1,19 @@
<?php
if (! defined('BASEPATH'))
exit('No direct script access allowed');
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Name: Messaging Library for FH-Complete
*
*
*/
class MessageLib
{
private $recipients = array();
public function __construct($params = null)
public function __construct()
{
$this->ci =& get_instance();
$this->ci->config->load('message');
$this->ci->load->model('system/Message_model', 'MessageModel');
@@ -21,22 +21,10 @@ class MessageLib
$this->ci->load->model('system/Recipient_model', 'RecipientModel');
$this->ci->load->model('system/Attachment_model', 'AttachmentModel');
if (is_array($params) && isset($params['uid']))
{
$this->ci->load->library('VorlageLib', array('uid' => $params['uid']));
$this->ci->MessageModel->setUID($params['uid']);
$this->ci->MsgStatusModel->setUID($params['uid']);
$this->ci->RecipientModel->setUID($params['uid']);
$this->ci->AttachmentModel->setUID($params['uid']);
}
else
{
$this->ci->load->library('VorlageLib');
}
$this->ci->load->library('VorlageLib');
//$this->ci->load->helper('language');
$this->ci->lang->load('message');
}
// ------------------------------------------------------------------------
+8 -21
View File
@@ -10,8 +10,7 @@
* @since Version 1.0.0
* @filesource
*/
if (! defined('FCPATH'))
exit('No direct script access allowed');
if (! defined('FCPATH')) exit('No direct script access allowed');
require_once(FCPATH.'include/basis_db.class.php');
require_once(FCPATH.'include/organisationseinheit.class.php');
@@ -36,7 +35,6 @@ require_once(FCPATH.'include/benutzerberechtigung.class.php');
class PermissionLib
{
public $bb;
protected $_uid;
/**
* Auth Username, Password over FH-Complete
@@ -45,16 +43,16 @@ class PermissionLib
* @param string $password
* @return bool
*/
function __construct($param = null)
function __construct()
{
if (is_array($param) && isset($param['uid']))
$this->_uid = $param['uid'];
$this->CI =& get_instance();
$this->CI->load->helper('fhcauth');
}
function isBerechtigt($berechtigung_kurzbz, $art=null, $oe_kurzbz=null, $kostenstelle_id=null)
function isBerechtigt($berechtigung_kurzbz, $art = null, $oe_kurzbz = null, $kostenstelle_id = null)
{
$this->bb->getBerechtigungen($this->_uid);
return $this->bb->isBerechtigt($berechtigung_kurzbz, $oe_kurzbz=null, $art=null, $kostenstelle_id=null);
$this->bb->getBerechtigungen(getAuthUID());
return $this->bb->isBerechtigt($berechtigung_kurzbz, $oe_kurzbz, $art, $kostenstelle_id);
}
function getPermissions($uid)
@@ -64,15 +62,4 @@ class PermissionLib
function isEntitled($berechtigung_kurzbz, $oe_kurzbz=null, $art=null, $kostenstelle_id=null)
{
}
/** ---------------------------------------------------------------
* Set UID
*
* @param string $uid
* @return bool
*/
public function setUID($uid)
{
return $this->_uid = $uid;
}
}
}
+4 -10
View File
@@ -1,33 +1,27 @@
<?php
if (! defined('BASEPATH'))
exit('No direct script access allowed');
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Name: Messaging Library for FH-Complete
*
*
*/
class PhrasesLib
{
/*
*
*/
public function __construct($params = null)
public function __construct()
{
//require_once APPPATH.'config/message.php';
$this->ci =& get_instance();
$this->ci->load->library('parser');
$this->ci->load->model('system/Phrase_model', 'PhraseModel');
$this->ci->load->model('system/Phrase_inhalt_model', 'PhraseInhaltModel');
if (is_array($params) && isset($params['uid']))
{
$this->ci->PhraseModel->setUID($params['uid']);
$this->ci->PhraseInhaltModel->setUID($params['uid']);
}
$this->ci->load->helper('language');
$this->ci->load->helper('Message');
//$this->ci->lang->load('fhcomplete');
-28
View File
@@ -352,11 +352,6 @@ abstract class REST_Controller extends CI_Controller {
self::HTTP_NOT_IMPLEMENTED => 'NOT IMPLEMENTED'
];
/**
*
*/
protected $_uid = NULL;
/**
* Extend this function to apply additional checking early on in the process
*
@@ -1906,25 +1901,6 @@ abstract class REST_Controller extends CI_Controller {
}
}
/**
* TO BE COMMENTED
*/
private function _setUID($username)
{
if (!isset($this->_uid) && isset($username))
{
$this->_uid = $username;
}
}
/**
* @return int ID of the authenticated caller
*/
protected function _getUID()
{
return $this->_uid;
}
/**
* Prepares for basic authentication
*
@@ -1964,10 +1940,6 @@ abstract class REST_Controller extends CI_Controller {
{
$this->_force_login();
}
else // If logged
{
$this->_setUID($username);
}
}
/**
+5 -9
View File
@@ -1,6 +1,6 @@
<?php
if (! defined('BASEPATH'))
exit('No direct script access allowed');
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Name: Messaging Library for FH-Complete
*
@@ -11,21 +11,17 @@ class VorlageLib
{
private $recipients = array();
public function __construct($params = null)
public function __construct()
{
require_once APPPATH.'config/message.php';
$this->ci =& get_instance();
$this->ci->load->library('parser');
$this->ci->load->model('system/Vorlage_model', 'VorlageModel');
$this->ci->load->model('system/Vorlagestudiengang_model', 'VorlageStudiengangModel');
if (is_array($params) && isset($params['uid']))
{
$this->ci->VorlageModel->setUID($params['uid']);
$this->ci->VorlageStudiengangModel->setUID($params['uid']);
}
$this->ci->load->helper('language');
//$this->ci->lang->load('fhcomplete');
}