Minahito
minah****@users*****
2006年 2月 3日 (金) 15:03:58 JST
Index: xoops2jp/html/modules/base/class/ActionFrame.class.php diff -u xoops2jp/html/modules/base/class/ActionFrame.class.php:1.1.2.1 xoops2jp/html/modules/base/class/ActionFrame.class.php:1.1.2.2 --- xoops2jp/html/modules/base/class/ActionFrame.class.php:1.1.2.1 Thu Jan 26 01:18:03 2006 +++ xoops2jp/html/modules/base/class/ActionFrame.class.php Fri Feb 3 15:03:58 2006 @@ -53,12 +53,21 @@ require_once $fileName; if (class_exists($className)) { - $this->mAction =& new $className(); + $this->mAction =& new $className($this->mAdminFlag); } if (!is_object($this->mAction)) { die(); } + + if (!$this->mAction->isPerm($controller, $controller->getXoopsUser())) { + if ($this->mAdminFlag) { + $controller->executeForward(XOOPS_URL . "/admin.php"); + } + else { + $controller->executeForward(XOOPS_URL); + } + } $this->mAction->prepare($controller, $controller->getXoopsUser()); @@ -91,10 +100,34 @@ class Legacy_Action { - function Legacy_Action() + /** + * @access private + */ + var $_mAdminFlag = false; + + function Legacy_Action($adminFlag = false) { + $this->_mAdminFlag = $adminFlag; } + function isPerm(&$controller, &$xoopsUser) + { + if ($this->_mAdminFlag) { + $moduleHandler =& xoops_gethandler('module'); + $permHandler =& xoops_gethandler('groupperm'); + + $module =& $moduleHandler->getByDirname('base'); + + return $permHandler->checkRight('module_admin', $module->get('mid'), $xoopsUser->getGroups()); + } + else { + // + // TODO Really? + // + return true; + } + } + function prepare(&$controller, &$xoopsUser) { }