From 3bf7dd4c6f94bddcf70a03e97bf93f6d50e720f2 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Thu, 4 Mar 2021 08:43:07 +0800 Subject: [PATCH 1/8] * Fix bug. --- module/upgrade/control.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/upgrade/control.php b/module/upgrade/control.php index 306fa4fb70..c966e046f2 100644 --- a/module/upgrade/control.php +++ b/module/upgrade/control.php @@ -164,7 +164,7 @@ class upgrade extends control $mode = fixer::input('post')->get('mode'); $this->loadModel('setting')->setItem('system.common.global.mode', $mode); - if($mode == 'old') $this->locate(inlink('afterExec', "fromVersion=$fromVersion")); + if($mode == 'classic') $this->locate(inlink('afterExec', "fromVersion=$fromVersion")); if($mode == 'new') $this->locate(inlink('mergeTips')); } From b0d5278b77bc9a5daab0f82db25834a87d73b414 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Thu, 4 Mar 2021 15:11:11 +0800 Subject: [PATCH 2/8] * Modify button language. --- module/custom/view/mode.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/custom/view/mode.html.php b/module/custom/view/mode.html.php index 30e3411edb..0760c541dd 100644 --- a/module/custom/view/mode.html.php +++ b/module/custom/view/mode.html.php @@ -29,7 +29,7 @@

upgrade->selectedModeTips['new'];?>

- upgrade->common);?> + upgrade->switch);?> From 117f9b8a7c3e19a4c7339c472d1d96ccbbcac53a Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Thu, 4 Mar 2021 16:28:08 +0800 Subject: [PATCH 3/8] * Fix bug. --- module/custom/view/mode.html.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/module/custom/view/mode.html.php b/module/custom/view/mode.html.php index 0760c541dd..dba96a1fd2 100644 --- a/module/custom/view/mode.html.php +++ b/module/custom/view/mode.html.php @@ -29,7 +29,10 @@

upgrade->selectedModeTips['new'];?>

- upgrade->switch);?> + + + custom->switch);?> + From b27fbb4f963419b8866c1fed6b273d5849aeac90 Mon Sep 17 00:00:00 2001 From: holan20180123 <56391770@qq.com> Date: Fri, 4 Jun 2021 11:21:50 +0800 Subject: [PATCH 4/8] * Adjust code style. --- module/testreport/view/blockbugreport.html.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/testreport/view/blockbugreport.html.php b/module/testreport/view/blockbugreport.html.php index 74dfa1fbbd..a513b35723 100644 --- a/module/testreport/view/blockbugreport.html.php +++ b/module/testreport/view/blockbugreport.html.php @@ -209,7 +209,7 @@ var colorKey = 0; for(var key in bugPriList) { $('.pri-' + key).css('background', colorList[colorKey]); - var priName = key == 0 ? zeroPri : bugPriList[key]; + var priName = key == 0 ? zeroPri : bugPriList[key]; var pri = { label: priName, color: colorList[colorKey], @@ -230,7 +230,7 @@ colorKey = 2; for(var key in bugHandleGroups) { $('.' + key).css('background', colorList[colorKey]); - var stageName = bugStageList[key]; + var stageName = bugStageList[key]; var stage = { label: stageName, color: colorList[colorKey], From a3056d3c426764f3ac3bf2f86a3625d95a46b905 Mon Sep 17 00:00:00 2001 From: holan20180123 <56391770@qq.com> Date: Fri, 4 Jun 2021 13:41:24 +0800 Subject: [PATCH 5/8] * Adjust code for review. --- module/upgrade/model.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 53b185d58a..1b2f490be4 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -675,11 +675,8 @@ class upgradeModel extends model $this->updateProjectLifeTime(); $this->adjustBugOfProject(); $this->processBuildTable(); - $this->appendExec('15_0'); - case '15_0_1': - $this->saveLogs('Execute 15_0_1'); $this->updateProductVersion(); - $this->appendExec('15_0_1'); + $this->appendExec('15_0'); } $this->deletePatch(); From de5ab488181f832cd2f10d3e37ad34854f993a33 Mon Sep 17 00:00:00 2001 From: holan20180123 <56391770@qq.com> Date: Fri, 4 Jun 2021 13:57:20 +0800 Subject: [PATCH 6/8] * Adjust logic of hidden stage field. --- module/story/view/batchedit.html.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module/story/view/batchedit.html.php b/module/story/view/batchedit.html.php index 5f16b51bbe..3b188e40b9 100644 --- a/module/story/view/batchedit.html.php +++ b/module/story/view/batchedit.html.php @@ -32,7 +32,8 @@ $visibleFields = array(); foreach(explode(',', $showFields) as $field) { - if($field and ($storyType == 'story' or $field != 'stage'))$visibleFields[$field] = ''; + if($storyType == 'requeirment' and $field == 'stage') continue; + if($field) $visibleFields[$field] = ''; } ?>
" id="batchEditForm"> From 41d59a068829be1f430564dfab03e0e1f43efcc2 Mon Sep 17 00:00:00 2001 From: holan20180123 <56391770@qq.com> Date: Mon, 7 Jun 2021 08:15:32 +0800 Subject: [PATCH 7/8] * Fix bug 12627. --- module/group/config.php | 5 +++ module/group/control.php | 3 +- module/group/model.php | 17 ++++++++- module/personnel/model.php | 77 ++++++++++++++++++++++++++++++++------ 4 files changed, 89 insertions(+), 13 deletions(-) diff --git a/module/group/config.php b/module/group/config.php index dda03629bd..6b75d3807b 100644 --- a/module/group/config.php +++ b/module/group/config.php @@ -4,3 +4,8 @@ $config->group->create = new stdclass(); $config->group->edit = new stdclass(); $config->group->create->requiredFields = 'name'; $config->group->edit->requiredFields = 'name'; + +$config->group->acl = new stdclass(); +$config->group->acl->objectTypes['programs'] = 'program'; +$config->group->acl->objectTypes['projects'] = 'project'; +$config->group->acl->objectTypes['products'] = 'product'; diff --git a/module/group/control.php b/module/group/control.php index afabc0c35e..89139a8a4a 100644 --- a/module/group/control.php +++ b/module/group/control.php @@ -132,7 +132,8 @@ class group extends control $this->group->updateView($groupID); if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); - $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); + $link = isonlybody() ? 'parent' : $this->createLink('group', 'browse'); + $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link)); } /* Get the group data by id. */ diff --git a/module/group/model.php b/module/group/model.php index 902e84727a..39f4be6265 100644 --- a/module/group/model.php +++ b/module/group/model.php @@ -345,7 +345,8 @@ class groupModel extends model */ public function updateView($groupID) { - $actions = $this->post->actions; + $actions = $this->post->actions; + $oldGroup = $this->getByID($groupID); if(isset($_POST['allchecker']))$actions['views'] = array(); if(!isset($actions['actions']))$actions['actions'] = array(); @@ -362,6 +363,20 @@ class groupModel extends model } $actions['actions'] = $dynamic; + /* Update whitelist. */ + $users = $this->getUserPairs($groupID); + $users = array_keys($users); + foreach($this->config->group->acl->objectTypes as $key => $objectType) + { + $oldAcls = isset($oldGroup->acl[$key]) ? $oldGroup->acl[$key] : array(); + $newAcls = isset($actions[$key]) ? $actions[$key] : array(); + $needRemoveAcls = array_diff($oldAcls, $newAcls); + $needAddAcls = array_diff($newAcls, $oldAcls); + foreach($needAddAcls as $objectID) $this->loadModel('personnel')->updateWhitelist($users, $objectType, $objectID, 'whitelist', 'add', 'increase'); + foreach($needRemoveAcls as $objectID) $this->loadModel('personnel')->deleteWhitelist($users, $objectType, $objectID); + } + + $actions = empty($actions) ? '' : json_encode($actions); $this->dao->update(TABLE_GROUP)->set('acl')->eq($actions)->where('id')->eq($groupID)->exec(); return dao::isError() ? false : true; diff --git a/module/personnel/model.php b/module/personnel/model.php index 6ecd627650..899273e09d 100644 --- a/module/personnel/model.php +++ b/module/personnel/model.php @@ -491,25 +491,27 @@ class personnelModel extends model * @param array $users * @param string $objectType program|project|product|sprint * @param int $objectID - * @param string $type whitelist|blacklist - * @param string $source upgrade|add|sync + * @param string $type whitelist|blacklist + * @param string $source upgrade|add|sync + * @param string $updateType increase|replace * @access public * @return void */ - public function updateWhitelist($users = array(), $objectType = '', $objectID = 0, $type = 'whitelist', $source = 'add') + public function updateWhitelist($users = array(), $objectType = '', $objectID = 0, $type = 'whitelist', $source = 'add', $updateType = 'replace') { $oldWhitelist = $this->dao->select('account,objectType,objectID,type,source')->from(TABLE_ACL)->where('objectID')->eq($objectID)->andWhere('objectType')->eq($objectType)->fetchAll('account'); - $this->dao->delete()->from(TABLE_ACL)->where('objectID')->eq($objectID)->andWhere('objectType')->eq($objectType)->exec(); + if($updateType == 'replace') $this->dao->delete()->from(TABLE_ACL)->where('objectID')->eq($objectID)->andWhere('objectType')->eq($objectType)->exec(); $users = array_filter($users); $users = array_unique($users); $accounts = array(); foreach($users as $account) { + $accounts[$account] = $account; + if(isset($oldWhitelist[$account])) { - $this->dao->insert(TABLE_ACL)->data($oldWhitelist[$account])->exec(); - $accounts[$account] = $account; + if($updateType == 'replace') $this->dao->insert(TABLE_ACL)->data($oldWhitelist[$account])->exec(); continue; } @@ -521,11 +523,17 @@ class personnelModel extends model $acl->source = $source; $this->dao->insert(TABLE_ACL)->data($acl)->autoCheck()->exec(); if(!dao::isError()) $this->loadModel('user')->updateUserView($acl->objectID, $acl->objectType, $acl->account); - $accounts[$account] = $account; } - $whitelist = ',' . implode(',', $accounts); + /* Update whitelist field. */ $objectTable = $objectType == 'product' ? TABLE_PRODUCT : TABLE_PROJECT; + if($updateType == 'increase') + { + $oldWhitelist = $this->dao->select('whitelist')->from($objectTable)->where('id')->eq($objectID)->fetch('whitelist'); + $oldWhitelist = explode(',', $oldWhitelist); + $accounts = array_unique(array_merge($accounts, $oldWhitelist)); + } + $whitelist = ',' . implode(',', $accounts); $this->dao->update($objectTable)->set('whitelist')->eq($whitelist)->where('id')->eq($objectID)->exec(); $deletedAccounts = array(); @@ -543,10 +551,13 @@ class personnelModel extends model $programWhitelist = $this->getWhitelistAccount($product->program, 'program'); $newWhitelist = array_merge($programWhitelist, $accounts); $source = $source == 'upgrade' ? 'upgrade' : 'sync'; - $this->updateWhitelist($newWhitelist, 'program', $product->program, 'whitelist', $source); + $this->updateWhitelist($newWhitelist, 'program', $product->program, 'whitelist', $source, $updateType); /* Removal of persons from centralized program whitelisting. */ - foreach($deletedAccounts as $account) $this->deleteProgramWhitelist($objectID, $account); + if($updateType == 'replace') + { + foreach($deletedAccounts as $account) $this->deleteProgramWhitelist($objectID, $account); + } } /* Synchronization of people from the sprint white list to the project. */ @@ -561,7 +572,10 @@ class personnelModel extends model $this->updateWhitelist($newWhitelist, 'project', $sprint->project, 'whitelist', $source); /* Removal of whitelisted persons from projects. */ - foreach($deletedAccounts as $account) $this->deleteProjectWhitelist($objectID, $account); + if($updateType == 'replace') + { + foreach($deletedAccounts as $account) $this->deleteProjectWhitelist($objectID, $account); + } } } @@ -579,6 +593,23 @@ class personnelModel extends model $this->updateWhitelist($users, $objectType, $objectID); } + /** + * Delete product whitelist. + * + * @param int $objectID + * @param string $account + * @access public + * @return void + */ + public function deleteProductWhitelist($objectID, $account = '') + { + $product = $this->dao->select('id,whitelist')->from(TABLE_PRODUCT)->where('id')->eq($objectID)->fetch('whitelist'); + if(empty($product)) return false; + + $newWhitelist = str_replace(',' . $acl->account, '', $product->whitelist); + $this->dao->update(TABLE_PRODUCT)->set('whitelist')->eq($newWhitelist)->where('id')->eq($objectID)->exec(); + } + /** * Determine whether the user exists in the white list of multiple products. * @@ -629,6 +660,30 @@ class personnelModel extends model } } + /** + * Delete users in whitelist. + * + * @param array $users + * @param string $objectType + * @param int $objectID + * @access public + * @return void + */ + public function deleteWhitelist($users = array(), $objectType = 'program', $objectID = 0) + { + $this->dao->delete()->from(TABLE_ACL) + ->where('objectID')->eq($objectID) + ->andWhere('account')->in($users) + ->exec(); + + foreach($users as $account) + { + if($objectType == 'program') $this->deleteProgramWhitelist($objectID, $account); + if($objectType == 'project') $this->deleteProjectWhitelist($objectID, $account); + if($objectType == 'product') $this->deleteProductWhitelist($objectID, $account); + } + } + /** * Create access links by department. * From 57d390129c35927c69f1f000c6c69656f648f5b5 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Fri, 18 Jun 2021 09:54:11 +0800 Subject: [PATCH 8/8] Fix an error. --- module/common/model.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/module/common/model.php b/module/common/model.php index 1543fdb084..95e46033de 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -818,11 +818,14 @@ class commonModel extends model foreach($menu as $menuItem) { /* Fix work and contribute navigation permission check issues. */ - if($menuItem->link['module'] == 'my' and ($menuItem->link['method'] == 'work' or $menuItem->link['method'] == 'contribute')) + if(isset($menuItem->link) and isset($menuItem->link['module']) and isset($menuItem->link['method'])) { - $mode = explode('&', $menuItem->link['vars']); - $mode = substr($mode[0], 5); - $menuItem->hidden = !common::hasPriv('my', $mode); + if($menuItem->link['module'] == 'my' and ($menuItem->link['method'] == 'work' or $menuItem->link['method'] == 'contribute')) + { + $mode = explode('&', $menuItem->link['vars']); + $mode = substr($mode[0], 5); + $menuItem->hidden = !common::hasPriv('my', $mode); + } } if(isset($menuItem->hidden) && $menuItem->hidden) continue;