From db388f5d74bf640b5d3805f97b1b53eb6e3141ad Mon Sep 17 00:00:00 2001 From: tianshujie Date: Mon, 28 Mar 2022 09:42:50 +0800 Subject: [PATCH 1/3] * Fix bug #17359. --- module/custom/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/custom/model.php b/module/custom/model.php index 8b4eeb4f8d..273a093ff9 100644 --- a/module/custom/model.php +++ b/module/custom/model.php @@ -250,7 +250,7 @@ class customModel extends model { foreach($item['subMenu'] as $subMenu) { - if(!isset($subMenu['link'])) continue; + if(!isset($subMenu['link']) or strpos($subMenu['link'], '|') === false) continue; list($subLabel, $module, $method) = explode('|', $subMenu['link']); $hasPriv = commonModel::hasPriv($module, $method); if($hasPriv) break; From 0194c5b3c76bc8162265d6f338e7701212a11ab4 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Mon, 28 Mar 2022 11:13:23 +0800 Subject: [PATCH 2/3] * Fix bug #21186. --- config/zentaopms.php | 2 +- module/execution/view/all.html.php | 2 +- module/project/config.php | 23 ++++++++++++----------- module/project/control.php | 2 +- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/config/zentaopms.php b/config/zentaopms.php index c7ef2cd14a..3844c46e6d 100644 --- a/config/zentaopms.php +++ b/config/zentaopms.php @@ -375,4 +375,4 @@ $config->newFeatures = array('introduction', 'tutorial', 'youngBlueTheme', 'visi /* Program privs.*/ $config->programPriv = new stdclass(); $config->programPriv->scrum = array('story', 'projectstory', 'projectrelease', 'project', 'execution', 'build', 'bug', 'testcase', 'testreport', 'doc', 'repo', 'meeting', 'stakeholder', 'testtask'); -$config->programPriv->waterfall = array_merge($config->programPriv->scrum, array('workestimation', 'durationestimation', 'budget', 'programplan', 'review', 'reviewissue', 'weekly', 'cm', 'milestone', 'design', 'issue', 'risk', 'opportunity', 'measrecord', 'auditplan', 'trainplan', 'gapanalysis', 'pssp', 'researchplan', 'researchreport')); +$config->programPriv->waterfall = array_merge($config->programPriv->scrum, array('task', 'workestimation', 'durationestimation', 'budget', 'programplan', 'review', 'reviewissue', 'weekly', 'cm', 'milestone', 'design', 'issue', 'risk', 'opportunity', 'measrecord', 'auditplan', 'trainplan', 'gapanalysis', 'pssp', 'researchplan', 'researchreport')); diff --git a/module/execution/view/all.html.php b/module/execution/view/all.html.php index 39ad793f27..44dfab54d5 100644 --- a/module/execution/view/all.html.php +++ b/module/execution/view/all.html.php @@ -173,7 +173,7 @@ else { $disabled = ($execution->grade == 2) ? ' disabled' : ''; - echo html::a('javascript:alert("' . $this->lang->programplan->error->createdTask . '");', '', '', 'class="btn ' . $disabled . '"'); + echo common::hasPriv('programplan', 'create') ? html::a('javascript:alert("' . $this->lang->programplan->error->createdTask . '");', '', '', 'class="btn ' . $disabled . '"') : ''; } common::printIcon('programplan', 'edit', "planID=$execution->id&projectID=$projectID", $execution, 'list', '', '', 'iframe', true); diff --git a/module/project/config.php b/module/project/config.php index 4de782d212..a9e7474d96 100644 --- a/module/project/config.php +++ b/module/project/config.php @@ -132,14 +132,15 @@ $config->project->maxCheckList = new stdclass(); $config->project->maxCheckList->scrum = array('bug', 'execution', 'build', 'doc', 'release', 'testtask', 'case', 'issue', 'risk', 'meeting'); $config->project->maxCheckList->waterfall = array('execution', 'design', 'doc', 'bug', 'case', 'build', 'release', 'testtask', 'review', 'build', 'researchplan', 'issue', 'risk', 'opportunity', 'auditplan', 'gapanalysis', 'meeting'); -$config->project->excludedPriv['project'] = array('index', 'browse', 'kanban', 'create', 'batchEdit', 'qa', 'updateOrder', 'createGuide', 'programTitle', 'export'); -$config->project->excludedPriv['execution'] = array('view', 'browse', 'edit', 'batchedit', 'start', 'activate', 'putoff', 'suspend', 'close', 'delete', 'task', 'grouptask', 'importtask', 'importplanstories', 'importBug', 'story', 'build', 'testtask', 'testcase', 'bug', 'testreport', 'burn', 'computeBurn', 'fixFirst', 'burnData', 'team', 'doc', 'dynamic', 'manageProducts', 'manageMembers', 'unlinkMember', 'linkStory', 'unlinkStory', 'batchUnlinkStory', 'updateOrder', 'taskKanban', 'printKanban', 'tree', 'treeTask', 'treeStory', 'all', 'kanbanHideCols', 'kanbanColsColor', 'export', 'storyKanban', 'storySort', 'whitelist', 'addWhitelist', 'unbindWhitelist', 'storyEstimate', 'executionkanban', 'kanban'); -$config->project->excludedPriv['story'] = array('report', 'linkStory', 'batchChangeBranch', 'batchChangeModule', 'batchToTask', 'processStoryChange', 'track', 'tasks', 'bugs', 'cases'); -$config->project->excludedPriv['bug'] = array('browse', 'batchChangePlan', 'batchCreate', 'batchEdit', 'batchConfirm', 'batchResolve', 'batchClose', 'batchActivate', 'report', 'batchChangeModule', 'batchChangeBranch'); -$config->project->excludedPriv['testcase'] = array('browse', 'batchChangeModule', 'batchChangeBranch'); -$config->project->excludedPriv['testtask'] = array('browse', 'view', 'start', 'activate', 'block', 'close'); -$config->project->excludedPriv['doc'] = array('browse', 'view', 'catalog', 'index'); -$config->project->excludedPriv['repo'] = array('edit', 'delete', 'maintain', 'setRules'); -$config->project->excludedPriv['testreport'] = array('browse'); -$config->project->excludedPriv['auditplan'] = array('delete'); -if($config->edition != 'max') $config->project->excludedPriv['stakeholder'] = array('issue', 'viewIssue', 'userIssue'); +$config->project->includedPriv['project'] = array('edit', 'group', 'createGroup', 'managePriv', 'manageMembers', 'manageGroupMember', 'copyGroup', 'editGroup', 'start', 'suspend', 'close', 'activate', 'delete', 'view', 'whitelist', 'addWhitelist', 'unbindWhitelist', 'manageProducts', 'dynamic', 'build', 'bug', 'testcase', 'testtask', 'testreport', 'execution', 'team', 'unlinkMember'); +$config->project->includedPriv['execution'] = array('create', 'start', 'delete', 'calendar', 'effortCalendar', 'effort', 'taskEffort', 'computeTaskEffort', 'deleterelation', 'maintainrelation', 'relation', 'gantt'); +$config->project->includedPriv['task'] = array('create'); +$config->project->includedPriv['story'] = array('create', 'batchCreate', 'edit', 'export', 'delete', 'view', 'change', 'review', 'batchReview', 'recall', 'close', 'batchClose', 'batchChangePlan', 'batchChangeStage', 'assignTo', 'batchAssignTo', 'activate', 'zeroCase', 'batchEdit', 'import', 'showImport', 'exportTemplet', 'importToLib', 'batchImportToLib', 'relation', 'browse'); +$config->project->includedPriv['bug'] = array('create', 'confirmBug', 'view', 'edit', 'assignTo', 'batchAssignTo', 'resolve', 'activate', 'close', 'export', 'confirmStoryChange', 'delete', 'linkBugs', 'import', 'showImport', 'exportTemplet'); +$config->project->includedPriv['testcase'] = array('groupCase', 'create', 'batchCreate', 'createBug', 'view', 'edit', 'delete', 'export', 'confirmChange', 'confirmStoryChange', 'batchEdit', 'batchDelete', 'linkCases', 'bugs', 'review', 'batchReview', 'batchConfirmStoryChange', 'importFromLib', 'batchCaseTypeChange', 'exportTemplet', 'import', 'showImport', 'confirmLibcaseChange', 'ignoreLibcaseChange', 'submit'); +$config->project->includedPriv['testtask'] = array('create', 'cases', 'groupCase', 'edit', 'delete', 'batchAssign', 'linkcase', 'unlinkcase', 'runcase', 'results', 'batchUnlinkCases', 'report', 'browseUnits', 'unitCases', 'importUnitResult', 'batchRun', 'runDeployCase', 'deployCaseResults'); +$config->project->includedPriv['doc'] = array('createLib', 'editLib', 'deleteLib', 'create', 'edit', 'delete', 'deleteFile', 'allLibs', 'objectLibs', 'collect', 'tableContents', 'showFiles', 'diff', 'manageBook', 'importToPracticeLib', 'importToComponentLib'); +$config->project->includedPriv['repo'] = array('create', 'showSyncCommit', 'browse', 'view', 'diff', 'log', 'revision', 'blame', 'download', 'apiGetRepoByUrl', 'review', 'addBug', 'editBug', 'deleteBug', 'addComment', 'editComment', 'deleteComment'); +$config->project->includedPriv['testreport'] = array('create', 'view', 'delete', 'edit', 'export'); +$config->project->includedPriv['auditplan'] = array('browse', 'create', 'edit', 'batchCreate', 'batchCheck', 'check', 'nc', 'result', 'assignTo'); +if($config->edition != 'max') $config->project->includedPriv['stakeholder'] = array('browse', 'create', 'batchCreate', 'edit', 'delete', 'view', 'communicate', 'expect', 'expectation', 'deleteExpect', 'createExpect', 'editExpect', 'viewExpect'); diff --git a/module/project/control.php b/module/project/control.php index e9c203372c..aff6d363e3 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -1253,7 +1253,7 @@ class project extends control foreach($methods as $method => $label) { - if(isset($this->config->project->excludedPriv[$module]) and in_array($method, $this->config->project->excludedPriv[$module])) unset($this->lang->resource->$module->$method); + if(isset($this->config->project->includedPriv[$module]) and !in_array($method, $this->config->project->includedPriv[$module])) unset($this->lang->resource->$module->$method); } } } From b125b0fc2c37cb6f365f505fc8a9831677246651 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Mon, 28 Mar 2022 11:20:38 +0800 Subject: [PATCH 3/3] * Fix bug #21186. --- module/project/control.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/project/control.php b/module/project/control.php index aff6d363e3..52441f1177 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -1249,7 +1249,7 @@ class project extends control } else { - if($project->model == 'scrum' and $module == 'projectstory') $this->config->project->excludedPriv[$module][] = 'track'; + if($project->model == 'scrum' and $module == 'projectstory') unset($this->lang->resource->projectstory->track); foreach($methods as $method => $label) {