function systemsinventory_update($content, $currentVersion)
{
    switch ($currentVersion) {
        case version_compare($currentVersion, '1.0.0', '<'):
            PHPWS_Core::initModClass('users', 'permission.php');
            User_Permission::registerPermissions('systemsinventory', $content);
        case version_compare($currentVersion, '1.0.2', '<'):
            runDbMigration('update_1_0_2.sql');
        case version_compare($currentVersion, '1.0.3', '<'):
            runDbMigration('update_1_0_3.sql');
    }
    return TRUE;
}
	function execute(&$controller, &$xoopsUser)
	{
		$this->_loadGroup();
		
		if (!is_object($this->mGroup)) {
			return USER_FRAME_VIEW_ERROR;
		}
		
		$this->mActionForm->fetch();
		$this->mActionForm->validate();
		
		if ($this->mActionForm->hasError()) {
			return $this->getDefaultView($controller, $xoopsUser);
		}
		
		//
		// Reset group permission
		//
		$gpermHandler =& xoops_gethandler('groupperm');
		
		$criteria =new CriteriaCompo();
		$criteria->add(new Criteria('gperm_groupid', $this->mGroup->get('groupid')));
		$criteria->add(new Criteria('gperm_modid', 1));
		$criteria->add(new Criteria('gperm_name', 'system_admin'));
		$gpermHandler->deleteAll($criteria);

		foreach ($this->mActionForm->get('system') as $sid => $value) {
			$item =new User_PermissionSystemAdminItem($sid, null);
			$perm =new User_Permission($this->mGroup->get('groupid'), $item);
			
			$perm->save();

			unset($item);
			unset($perm);
		}
		
		$moduleHandler =& xoops_gethandler('module');
		$modPerms = array();

		//
		// Store module read permission
		//
		$this->_loadActiveModules();
		foreach ($this->_mActiveModules as $module)	{
			$value = $this->mActionForm->get('module', $module->get('mid'));
			if ($value) {
				$gpermHandler->addRight('module_read', $module->get('mid'), $this->mGroup->get('groupid'));
			}
			else {
				$gpermHandler->removeRight('module_read', $module->get('mid'), $this->mGroup->get('groupid'));
			}
		}

		foreach ($this->_mActiveModules as $module)	{
			$value = $this->mActionForm->get('module_admin', $module->get('mid'));
			if ($value) {
				$gpermHandler->addRight('module_admin', $module->get('mid'), $this->mGroup->get('groupid'));
			}
			else {
				$gpermHandler->removeRight('module_admin', $module->get('mid'), $this->mGroup->get('groupid'));
			}
		}

		$blockHandler =& xoops_gethandler('block');

		$this->_loadActiveBlocks();
		foreach ($this->_mActiveBlocks as $side => $blocks) {
			foreach ($blocks as $block) {
				$value = $this->mActionForm->get('block', $block->get('bid'));
				if ($value) {
					$gpermHandler->addRight('block_read', $block->get('bid'), $this->mGroup->get('groupid'));
				}
				elseif (is_object($block) && !$value) {
					$gpermHandler->removeRight('block_read', $block->get('bid'), $this->mGroup->get('groupid'));
				}
			}
		}
		
		return USER_FRAME_VIEW_SUCCESS;
	}