mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-25 12:09:09 +08:00
增加特例超级用户100001
This commit is contained in:
parent
763a456406
commit
d65883c26e
@ -21,17 +21,6 @@ class Controller extends \Phalcon\Mvc\Controller
|
|||||||
|
|
||||||
public function beforeExecuteRoute(Dispatcher $dispatcher)
|
public function beforeExecuteRoute(Dispatcher $dispatcher)
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* demo分支拒绝数据提交
|
|
||||||
*/
|
|
||||||
if ($this->isNotSafeRequest()) {
|
|
||||||
$dispatcher->forward([
|
|
||||||
'controller' => 'public',
|
|
||||||
'action' => 'forbidden',
|
|
||||||
]);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->isNotSafeRequest()) {
|
if ($this->isNotSafeRequest()) {
|
||||||
$this->checkHttpReferer();
|
$this->checkHttpReferer();
|
||||||
$this->checkCsrfToken();
|
$this->checkCsrfToken();
|
||||||
@ -47,6 +36,17 @@ class Controller extends \Phalcon\Mvc\Controller
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* demo分支拒绝数据提交,100001帐号除外
|
||||||
|
*/
|
||||||
|
if ($this->isNotSafeRequest() && $this->authInfo['id'] != 100001) {
|
||||||
|
$dispatcher->forward([
|
||||||
|
'controller' => 'public',
|
||||||
|
'action' => 'forbidden',
|
||||||
|
]);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 管理员忽略权限检查
|
* 管理员忽略权限检查
|
||||||
*/
|
*/
|
||||||
|
@ -118,7 +118,7 @@ class Setting extends Service
|
|||||||
$result = [];
|
$result = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* demo分支过滤敏感数据
|
* demo分支过滤敏感数据,100001帐号除外
|
||||||
*/
|
*/
|
||||||
if ($items->count() > 0) {
|
if ($items->count() > 0) {
|
||||||
$pattern = '/(id|auth|key|secret|token|password|pwd|mobile|phone|mail|email)/';
|
$pattern = '/(id|auth|key|secret|token|password|pwd|mobile|phone|mail|email)/';
|
||||||
@ -126,7 +126,8 @@ class Setting extends Service
|
|||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
$case1 = preg_match($pattern, $item->item_key);
|
$case1 = preg_match($pattern, $item->item_key);
|
||||||
$case2 = $controllerName == 'setting';
|
$case2 = $controllerName == 'setting';
|
||||||
if ($case1 && $case2) {
|
$case3 = $this->getLoginUser()->id != 100001;
|
||||||
|
if ($case1 && $case2 && $case3) {
|
||||||
$item->item_value = '******';
|
$item->item_value = '******';
|
||||||
}
|
}
|
||||||
$result[$item->item_key] = $item->item_value;
|
$result[$item->item_key] = $item->item_value;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user