[xoops-cvslog 1299] CVS update: xoops2jp/html/modules/base/admin/class

Back to archive index

Minahito minah****@users*****
2005年 12月 19日 (月) 22:59:42 JST


Index: xoops2jp/html/modules/base/admin/class/ModuleInstaller.class.php
diff -u xoops2jp/html/modules/base/admin/class/ModuleInstaller.class.php:1.1.2.1 xoops2jp/html/modules/base/admin/class/ModuleInstaller.class.php:1.1.2.2
--- xoops2jp/html/modules/base/admin/class/ModuleInstaller.class.php:1.1.2.1	Fri Dec 16 18:56:11 2005
+++ xoops2jp/html/modules/base/admin/class/ModuleInstaller.class.php	Mon Dec 19 22:59:42 2005
@@ -2,6 +2,10 @@
 
 require_once XOOPS_BASE_PATH."/admin/class/AbstractModuleInstaller.class.php";
 
+/**
+ * This class extends a base class for the process of install module. This is added
+ * some private functions.
+ */
 class Legacy_ModuleInstaller extends Legacy_AbstractModuleInstaller
 {
 	/**
@@ -26,6 +30,51 @@
 		
 		return $module;
 	}
+	
+	function _installModule()
+	{
+		if (parent::_installModule()) {
+			$gpermHandler =& xoops_gethandler('groupperm');
+
+			//
+			// Add a permission which administrators can manage.
+			//
+			$adminPerm =& $this->_createPermission();
+			$adminPerm->setVar('gperm_name', 'module_admin');
+
+			if (!$gpermHandler->insert($adminPerm)) {
+				$log->addWarn("Could not set admin permission " . $tplfile->getVar('bid'));
+			}
+
+			//
+			// Add a permission which administrators can read.
+			//
+			$readPerm =& $this->_createPermission();
+			$readPerm->setVar('gperm_name', 'module_read');
+
+			if (!$gpermHandler->insert($adminPerm)) {
+				$log->addWarn("Could not set read permission " . $tplfile->getVar('bid'));
+			}
+		}
+	}
+
+	/**
+	 * Create a permission object which has been initialized for admin.
+	 * For flexibility, creation only and not save it.
+	 * @access private
+	 */
+	function &_createPermission()
+	{
+		$gpermHandler =& xoops_gethandler('groupperm');
+
+		$perm =& $gpermHandler->create();
+
+		$perm->setVar('gperm_groupid', XOOPS_GROUP_ADMIN);
+		$perm->setVar('gperm_itemid', $this->mModule->getVar('mid'));
+		$perm->setVar('gperm_modid', 1);
+		
+		return $perm;
+	}
 
 	function _installTable()
 	{


xoops-cvslog メーリングリストの案内
Back to archive index