* Process privilege.

* Adjust codes for program.
This commit is contained in:
daitingting
2023-03-30 13:41:04 +08:00
parent 03ac074ea2
commit 9010cb15ff
2 changed files with 33 additions and 27 deletions
+14 -12
View File
@@ -12,13 +12,10 @@ CREATE TABLE IF NOT EXISTS `zt_dimension` (
PRIMARY KEY (`id`),
KEY `code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `zt_chart_back` SELECT * FROM `zt_chart`;
ALTER TABLE `zt_chart` MODIFY `fields` mediumtext NOT NULL;
UPDATE `zt_grouppriv` SET `module` = 'dataview' WHERE `module` = 'dataset' AND `method` in ('create', 'browse', 'edit', 'delete');
DELETE FROM `zt_grouppriv` WHERE `module` = 'dataset' AND `method` = 'view';
ALTER TABLE `zt_chart` MODIFY `group` varchar(255) NOT NULL;
ALTER TABLE `zt_chart` ADD `stage` enum('draft','published') NOT NULL DEFAULT 'draft' AFTER `sql`;
ALTER TABLE `zt_chart` ADD `langs` text NOT NULL AFTER `fields`;
@@ -31,19 +28,24 @@ ALTER TABLE `zt_screen` ADD `builtin` enum('0', '1') NOT NULL DEFAULT '0' AFTER
UPDATE `zt_screen` SET `builtin` = '1', `status` = 'published';
REPLACE `zt_grouppriv` SET `module` = 'screen' where `module` = 'dashboard';
REPLACE `zt_grouppriv` SET `module` = 'pivot', `method` = 'create' where `module` = 'report' and (`method` = 'custom' or `method` = 'saveReport') ;
REPLACE `zt_grouppriv` SET `module` = 'pivot', `method` = 'delete' where `module` = 'report' and `method` = 'deleteReport';
REPLACE `zt_grouppriv` SET `module` = 'pivot', `method` = 'edit' where `module` = 'report' and `method` = 'editReport';
REPLACE `zt_grouppriv` SET `module` = 'pivot', `method` = 'preview' where `module` = 'report' and `method` = 'show';
REPLACE `zt_grouppriv` SET `module` = 'pivot', `method` = 'design' where `module` = 'report' and `method` = 'useReport';
REPLACE `zt_grouppriv` SET `module` = 'pivot', `method` = 'export' where `module` = 'report' and `method` = 'crystalExport';
UPDATE `zt_grouppriv` SET `module` = 'dataview' WHERE `module` = 'dataset' AND `method` in ('create', 'browse', 'edit', 'delete');
UPDATE `zt_grouppriv` SET `module` = 'screen' WHERE `module` = 'dashboard';
UPDATE `zt_grouppriv` SET `module` = 'pivot', `method` = 'create') WHERE `module` = 'report' AND `method` = 'custom';
UPDATE `zt_grouppriv` SET `module` = 'pivot', `method` = 'delete') WHERE `module` = 'report' AND `method` = 'deleteReport';
UPDATE `zt_grouppriv` SET `module` = 'pivot', `method` = 'edit') WHERE `module` = 'report' AND `method` = 'editReport';
UPDATE `zt_grouppriv` SET `module` = 'pivot', `method` = 'preview') WHERE `module` = 'report' AND `method` = 'show';
UPDATE `zt_grouppriv` SET `module` = 'pivot', `method` = 'design') WHERE `module` = 'report' AND `method` = 'useReport';
UPDATE `zt_grouppriv` SET `module` = 'pivot', `method` = 'export') WHERE `module` = 'report' AND `method` = 'crystalExport';
REPLACE INTO `zt_grouppriv` (`group`, `module`, `method`) SELECT `group`, 'pivot', 'create' FROM `zt_grouppriv` WHERE `module` = 'report' AND `method` = 'saveReport';
DELETE FROM `zt_grouppriv` WHERE `module` = 'report' AND `method` = 'saveReport';
DELETE FROM `zt_grouppriv` WHERE `module` = 'dataset' AND `method` = 'view';
CREATE TABLE `zt_pivot` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`dimension` mediumint(8) unsigned NOT NULL DEFAULT 0,
`group` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL,
`name` text NOT NULL,
`desc` text NOT NULL,
`sql` mediumtext NOT NULL,
`fields` mediumtext NOT NULL,
+19 -15
View File
@@ -8410,21 +8410,24 @@ class upgradeModel extends model
$type = !empty($option->i->type) ? $option->i->type : 'chart';
$chart = $this->loadModel($type)->getByID($option->i->id);
$settings = $chart->settings;
if($type == 'chart') $chartType = $chart->builtin ? $chart->type : $settings[0]['type'];
if($type == 'pivot') $chartType = 'table';
$chartConfig = json_decode(zget($this->config->screen->chartConfig, $chartType));
$chartConfig->fields = $chart->fieldSettings;
$chartConfig->sourceID = $option->i->id;
if($chart)
{
$settings = $chart->settings;
if($type == 'chart') $chartType = $chart->builtin ? $chart->type : $settings[0]['type'];
if($type == 'pivot') $chartType = 'table';
$chartConfig = json_decode(zget($this->config->screen->chartConfig, $chartType));
$chartConfig->fields = $chart->fieldSettings;
$chartConfig->sourceID = $option->i->id;
$component->title = $chart->name;
$component->type = $chartType;
$component->sourceID = $option->i->id;
$component->key = $chartConfig->key;
$component->chartConfig = $chartConfig;
$component->option = json_decode(zget($this->config->screen->chartOption, $chartType));
if(isset($component->option->title->text)) $component->option->title->text = $chart->name;
$component = $this->screen->getChartOption($component);
$component->title = $chart->name;
$component->type = $chartType;
$component->sourceID = $option->i->id;
$component->key = $chartConfig->key;
$component->chartConfig = $chartConfig;
$component->option = json_decode(zget($this->config->screen->chartOption, $chartType));
if(isset($component->option->title->text)) $component->option->title->text = $chart->name;
$component = $this->screen->getChartOption($component);
}
$componentList[] = $component;
@@ -8657,6 +8660,7 @@ class upgradeModel extends model
$layout[$index] = $chartLayout;
}
$dashboardLayoutPairs[$dashboardID] = json_encode($layout);
$this->dao->update(TABLE_DASHBOARD)->set('layout')->eq(json_encode($layout))->where('id')->eq($dashboardID)->exec();
}
@@ -8766,7 +8770,7 @@ class upgradeModel extends model
$reports = $this->dao->select('*')->from(TABLE_REPORT)->fetchAll();
$modulePairs = $this->dao->select('id, name')->from(TABLE_MODULE)->where('type')->eq('report')->fetchPairs();
$groupPairs = $this->dao->select('name, id')->from(TABLE_MODULE)->where('type')->eq('pivot')->fetchPairs();
$groupNames = $this->dao->select('name, id')->from(TABLE_MODULE)->where('type')->eq('pivot')->fetchPairs();
$this->loadModel('report');