Minahito
minah****@users*****
2005年 12月 22日 (木) 20:26:01 JST
Index: xoops2jp/html/modules/user/admin/class/Permission.class.php diff -u /dev/null xoops2jp/html/modules/user/admin/class/Permission.class.php:1.1.2.1 --- /dev/null Thu Dec 22 20:26:01 2005 +++ xoops2jp/html/modules/user/admin/class/Permission.class.php Thu Dec 22 20:26:01 2005 @@ -0,0 +1,135 @@ +<?php + +define('USER_PERMISSION_NONE', 0); +define('USER_PERMISSION_READ', 1); +define('USER_PERMISSION_ADMIN', 2); + +class User_Permission +{ + var $mGroupId; + var $mName; + var $mValue; + + /** + * User_PermissionItem + */ + var $mItem; + + function User_Permission($groupId, &$item) + { + $this->mGroupId = $groupId; + $this->mItem =& $item; + $this->_load(); + } + + function _load() + { + $this->mValue = $this->mItem->loadPermission($this->mGroupId); + } +} + +class User_PermissionItem +{ + /** + * Return name + */ + function getName() + { + } + + /** + * Return the url of module's control panel. + */ + function getAdminUrl() + { + } + + /** + * @return bool + */ + function isActive() + { + } + + function loadPermission($groupId) + { + } +} + +class User_PermissionModuleItem extends User_PermissionItem +{ + var $mModule; + + function User_PermissionModuleItem(&$module) + { + $this->mModule =& $module; + } + + function getName() + { + return $this->mModule->getProperty('name'); + } + + function getAdminUrl() + { + } + + function isActive() + { + return true; + } + + function loadPermission($groupId) + { + $ret = USER_PERMISSION_NONE; + + $gpermHandler =& xoops_gethandler('groupperm'); + if ($gpermHandler->checkRight("module_admin", $this->mModule->getVar('mid'), $groupId)) { + $ret |= USER_PERMISSION_ADMIN; + } + + if ($gpermHandler->checkRight("module_read", $this->mModule->getVar('mid'), $groupId)) { + $ret |= USER_PERMISSION_READ; + } + + return $ret; + } +} + +class User_PermissionBlockItem extends User_PermissionItem +{ + var $mBlock; + + function User_PermissionBlockItem(&$block) + { + $this->mBlock =& $block; + } + + function getName() + { + return $this->mBlock->getProperty('title'); + } + + function getAdminUrl() + { + } + + function isActive() + { + return $this->mBlock->getProperty('visible')==1 ? true : false; + } + + function loadPermission($groupId) + { + $ret = USER_PERMISSION_NONE; + + $gpermHandler =& xoops_gethandler('groupperm'); + if ($gpermHandler->checkRight("block_read", $this->mBlock->getVar('bid'), $groupId)) { + $ret |= USER_PERMISSION_READ; + } + + return $ret; + } +} + +?> \ No newline at end of file