don't need to define the config, it will have already been done. Include auth.php instead of functions.php as the code has been moved
parent
a789fc88aa
commit
513708b11c
|
@ -76,6 +76,8 @@ class AppController extends Controller {
|
||||||
$zmOptAuth = $config['Config']['Value'];
|
$zmOptAuth = $config['Config']['Value'];
|
||||||
|
|
||||||
if ( $zmOptAuth == '1' ) {
|
if ( $zmOptAuth == '1' ) {
|
||||||
|
require_once "../../../includes/auth.php";
|
||||||
|
|
||||||
$this->loadModel('User');
|
$this->loadModel('User');
|
||||||
if ( isset($_REQUEST['user']) and isset($_REQUEST['pass']) ) {
|
if ( isset($_REQUEST['user']) and isset($_REQUEST['pass']) ) {
|
||||||
$user = $this->User->find('first', array ('conditions' => array (
|
$user = $this->User->find('first', array ('conditions' => array (
|
||||||
|
@ -92,19 +94,6 @@ class AppController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset($_REQUEST['auth']) ) {
|
if ( isset($_REQUEST['auth']) ) {
|
||||||
require_once "../../../includes/functions.php";
|
|
||||||
|
|
||||||
// Define some defines required by getAuthUser in functions.php
|
|
||||||
$defines = array('ZM_AUTH_HASH_IPS', 'ZM_AUTH_HASH_SECRET', 'ZM_AUTH_RELAY', 'ZM_OPT_USE_AUTH');
|
|
||||||
$configQuery = array(
|
|
||||||
'conditions' => array('OR' => array('Name' => $defines)),
|
|
||||||
'fields' => array('Name', 'Value')
|
|
||||||
);
|
|
||||||
$config = $this->Config->find('list', $configQuery);
|
|
||||||
|
|
||||||
foreach ($defines as $define) {
|
|
||||||
define($define, $config[$define]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$user = getAuthUser($_REQUEST['auth']);
|
$user = getAuthUser($_REQUEST['auth']);
|
||||||
if ( ! $user ) {
|
if ( ! $user ) {
|
||||||
|
@ -134,9 +123,8 @@ class AppController extends Controller {
|
||||||
$this->Session->Write('controlPermission',$userMonitors['User']['Control']);
|
$this->Session->Write('controlPermission',$userMonitors['User']['Control']);
|
||||||
$this->Session->Write('systemPermission',$userMonitors['User']['System']);
|
$this->Session->Write('systemPermission',$userMonitors['User']['System']);
|
||||||
$this->Session->Write('monitorPermission',$userMonitors['User']['Monitors']);
|
$this->Session->Write('monitorPermission',$userMonitors['User']['Monitors']);
|
||||||
}
|
} else {
|
||||||
else // if auth is not on, you can do everything
|
// if auth is not on, you can do everything
|
||||||
{
|
|
||||||
//$userMonitors = $this->User->find('first', $options);
|
//$userMonitors = $this->User->find('first', $options);
|
||||||
$this->Session->Write('allowedMonitors','');
|
$this->Session->Write('allowedMonitors','');
|
||||||
$this->Session->Write('streamPermission','View');
|
$this->Session->Write('streamPermission','View');
|
||||||
|
|
Loading…
Reference in New Issue