mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 08:22:17 +00:00
- 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:
@@ -1,56 +1,23 @@
|
||||
<?php
|
||||
if (! defined('BASEPATH'))
|
||||
exit('No direct script access allowed');
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class FHC_Model extends CI_Model
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper('language');
|
||||
|
||||
$this->lang->load('fhc_model');
|
||||
$this->lang->load('fhcomplete');
|
||||
|
||||
$this->load->helper('language');
|
||||
$this->load->helper('Message');
|
||||
$this->load->helper('fhcauth');
|
||||
|
||||
$uid = null;
|
||||
|
||||
// Get UID from CI session
|
||||
if(isset($_SESSION['uid']))
|
||||
$uid = $this->session->uid;
|
||||
// Get UID from the environment (HTTP authentication via authentication.class.php)
|
||||
elseif(isset($_SERVER['PHP_AUTH_USER']))
|
||||
$uid = $_SERVER['PHP_AUTH_USER'];
|
||||
|
||||
// After getting UID for the first time, it saves it in CI session
|
||||
if (isset($uid) && !isset($this->session->uid))
|
||||
{
|
||||
$this->session->uid = $uid;
|
||||
}
|
||||
|
||||
$this->load->library('FHC_DB_ACL', array('uid' => $uid));
|
||||
$this->load->library('FHC_DB_ACL');
|
||||
}
|
||||
|
||||
/** ---------------------------------------------------------------
|
||||
* Set UID
|
||||
*
|
||||
* @param string $uid
|
||||
* @return bool
|
||||
*/
|
||||
public function setUID($uid)
|
||||
{
|
||||
return $this->fhc_db_acl->setUID($uid);
|
||||
}
|
||||
|
||||
/** ---------------------------------------------------------------
|
||||
* get UID
|
||||
*
|
||||
* @return string or (bool)false
|
||||
*/
|
||||
public function getUID()
|
||||
{
|
||||
return $this->fhc_db_acl->getUID();
|
||||
}
|
||||
|
||||
/** ---------------------------------------------------------------
|
||||
* Success
|
||||
*
|
||||
@@ -71,4 +38,4 @@ class FHC_Model extends CI_Model
|
||||
{
|
||||
return error($retval, $message);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user