Merge branch '15.0.beta3' of https://gitlab.zcorp.cc/easycorp/zentaopms into 15.0.beta3

This commit is contained in:
wangyidong
2021-04-01 11:35:41 +08:00
25 changed files with 150 additions and 88 deletions
+40 -2
View File
@@ -636,6 +636,7 @@ class upgradeModel extends model
$this->saveLogs('Execute 15_0');
$this->execSQL($this->getUpgradeFile('15.0'));
$this->adjustWhitelistOfProject();
$this->adjustWhitelistOfProduct();
$this->appendExec('15_0');
case '15_0_beta1':
$this->saveLogs('Execute 15_0_beta1');
@@ -4404,6 +4405,10 @@ class upgradeModel extends model
$groups = explode(',', $product->whitelist);
$groupAccounts = $this->group->getGroupAccounts($groups);
/* Get the whitelist data from the classic version mode upgrade. */
$groupAccounts += $this->dao->select('account')->from(TABLE_ACL)->where('objectID')->eq($product->id)->andWhere('objectType')->eq('product')->andWhere('type')->eq('whitelist')->fetchPairs('account');
$whiteList += $groupAccounts;
$this->personnel->updateWhitelist($groupAccounts, 'product', $product->id, 'whitelist', 'upgrade');
}
@@ -4414,10 +4419,12 @@ class upgradeModel extends model
{
if($sprint->acl != 'private') continue;
$groups = explode(',', $sprint->whitelist);
$groupAccounts = $this->group->getGroupAccounts($groups);
$groups = explode(',', $sprint->whitelist);
$groupAccounts = $this->group->getGroupAccounts($groups);
/* Get the whitelist data from the classic version mode upgrade. */
$groupAccounts += $this->dao->select('account')->from(TABLE_ACL)->where('objectID')->eq($sprint->id)->andWhere('objectType')->eq('sprint')->andWhere('type')->eq('whitelist')->fetchPairs('account');
$this->personnel->updateWhitelist($groupAccounts, 'sprint', $sprint->id, 'whitelist', 'upgrade');
}
}
@@ -4724,4 +4731,35 @@ class upgradeModel extends model
return true;
}
/**
* Adjust the whitelist of projects.
*
* @access public
* @return bool
*/
public function adjustWhitelistOfProduct()
{
$products = $this->dao->select('*')->from(TABLE_PRODUCT)->where('acl')->eq('custom')->fetchAll();
foreach($products as $product)
{
$groups = explode(',', $product->whitelist);
$accounts = $this->dao->select('account')->from(TABLE_USERGROUP)->where('`group`')->in($groups)->fetchPairs('account');
foreach($accounts as $account)
{
$acl = new stdclass();
$acl->account = $account;
$acl->objectType = 'product';
$acl->objectID = $product->id;
$acl->type = 'whitelist';
$acl->source = 'upgrade';
$this->dao->insert(TABLE_ACL)->data($acl)->exec();
}
$this->dao->update(TABLE_PRODUCT)->set('acl')->eq('private')->where('id')->eq($product->id)->exec();
}
return true;
}
}