* adjust for check priv.
This commit is contained in:
+35
-28
@@ -360,7 +360,7 @@ class commonModel extends model
|
||||
{
|
||||
echo js::locate($denyLink);
|
||||
}
|
||||
die;
|
||||
helper::end();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2194,36 +2194,43 @@ EOD;
|
||||
*/
|
||||
public function checkPriv()
|
||||
{
|
||||
$module = $this->app->getModuleName();
|
||||
$method = $this->app->getMethodName();
|
||||
if($this->app->isFlow)
|
||||
try
|
||||
{
|
||||
$module = $this->app->rawModule;
|
||||
$method = $this->app->rawMethod;
|
||||
$module = $this->app->getModuleName();
|
||||
$method = $this->app->getMethodName();
|
||||
if($this->app->isFlow)
|
||||
{
|
||||
$module = $this->app->rawModule;
|
||||
$method = $this->app->rawMethod;
|
||||
}
|
||||
|
||||
$beforeValidMethods = array(
|
||||
'user' => array('deny', 'logout'),
|
||||
'my' => array('changepassword'),
|
||||
'message' => array('ajaxgetmessage'),
|
||||
);
|
||||
if(!empty($this->app->user->modifyPassword) and (!isset($beforeValidMethods[$module]) or !in_array($method, $beforeValidMethods[$module]))) return print(js::locate(helper::createLink('my', 'changepassword', '', '', true)));
|
||||
if($this->isOpenMethod($module, $method)) return true;
|
||||
if(!$this->loadModel('user')->isLogon() and $this->server->php_auth_user) $this->user->identifyByPhpAuth();
|
||||
if(!$this->loadModel('user')->isLogon() and $this->cookie->za) $this->user->identifyByCookie();
|
||||
|
||||
if(isset($this->app->user))
|
||||
{
|
||||
if(in_array($module, $this->config->programPriv->waterfall) and $this->app->tab == 'project') return true;
|
||||
|
||||
$this->app->user = $this->session->user;
|
||||
if(!commonModel::hasPriv($module, $method)) $this->deny($module, $method);
|
||||
}
|
||||
else
|
||||
{
|
||||
$referer = helper::safe64Encode($this->app->getURI(true));
|
||||
print(js::locate(helper::createLink('user', 'login', "referer=$referer")));
|
||||
helper::end();
|
||||
}
|
||||
}
|
||||
|
||||
$beforeValidMethods = array(
|
||||
'user' => array('deny', 'logout'),
|
||||
'my' => array('changepassword'),
|
||||
'message' => array('ajaxgetmessage'),
|
||||
);
|
||||
if(!empty($this->app->user->modifyPassword) and (!isset($beforeValidMethods[$module]) or !in_array($method, $beforeValidMethods[$module]))) return print(js::locate(helper::createLink('my', 'changepassword', '', '', true)));
|
||||
if($this->isOpenMethod($module, $method)) return true;
|
||||
if(!$this->loadModel('user')->isLogon() and $this->server->php_auth_user) $this->user->identifyByPhpAuth();
|
||||
if(!$this->loadModel('user')->isLogon() and $this->cookie->za) $this->user->identifyByCookie();
|
||||
|
||||
if(isset($this->app->user))
|
||||
catch(EndResponseException $endResponseException)
|
||||
{
|
||||
if(in_array($module, $this->config->programPriv->waterfall) and $this->app->tab == 'project') return true;
|
||||
|
||||
$this->app->user = $this->session->user;
|
||||
if(!commonModel::hasPriv($module, $method)) $this->deny($module, $method);
|
||||
}
|
||||
else
|
||||
{
|
||||
$referer = helper::safe64Encode($this->app->getURI(true));
|
||||
print(js::locate(helper::createLink('user', 'login', "referer=$referer")));
|
||||
helper::end();
|
||||
echo $endResponseException->getContent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@
|
||||
else
|
||||
{
|
||||
appCode = getAppCodeFromUrl(url);
|
||||
if(!appCode) return false;
|
||||
if(!appCode) return openTab('my');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user