Merge branch 'sprint/167_tianshujie_43169' into 'sprint/167'
*Finish task #43169 See merge request easycorp/zentaopms!71
This commit is contained in:
@@ -680,8 +680,6 @@ class personnelModel extends model
|
||||
$product = $this->dao->select('id,whitelist')->from(TABLE_PRODUCT)->where('id')->eq($productID)->fetch();
|
||||
if(empty($product)) return false;
|
||||
|
||||
$newWhitelist = str_replace(',' . $account, '', $product->whitelist);
|
||||
$this->dao->update(TABLE_PRODUCT)->set('whitelist')->eq($newWhitelist)->where('id')->eq($productID)->exec();
|
||||
$result = $this->dao->delete()->from(TABLE_ACL)
|
||||
->where('objectID')->eq($productID)
|
||||
->andWhere('account')->eq($account)
|
||||
@@ -692,11 +690,13 @@ class personnelModel extends model
|
||||
/* Update user view when delete success. */
|
||||
if($result)
|
||||
{
|
||||
$newWhitelist = str_replace(',' . $account, '', $product->whitelist);
|
||||
$this->dao->update(TABLE_PRODUCT)->set('whitelist')->eq($newWhitelist)->where('id')->eq($productID)->exec();
|
||||
|
||||
$viewProducts = $this->dao->select('products')->from(TABLE_USERVIEW)->where('account')->eq($account)->fetch('products');
|
||||
$newViewProducts = trim(str_replace(",$productID,", '', ",$viewProducts,"), ',');
|
||||
$this->dao->update(TABLE_USERVIEW)->set('products')->eq($newViewProducts)->where('account')->eq($account)->exec();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -718,8 +718,6 @@ class personnelModel extends model
|
||||
/* Determine if the user exists in other products in the program set. */
|
||||
if(empty($whitelist))
|
||||
{
|
||||
$newWhitelist = str_replace(',' . $account, '', $program->whitelist);
|
||||
$this->dao->update(TABLE_PROGRAM)->set('whitelist')->eq($newWhitelist)->where('id')->eq($programID)->exec();
|
||||
$result = $this->dao->delete()->from(TABLE_ACL)
|
||||
->where('objectID')->eq($programID)
|
||||
->andWhere('account')->eq($account)
|
||||
@@ -730,6 +728,9 @@ class personnelModel extends model
|
||||
/* Update user view when delete success. */
|
||||
if($result)
|
||||
{
|
||||
$newWhitelist = str_replace(',' . $account, '', $program->whitelist);
|
||||
$this->dao->update(TABLE_PROGRAM)->set('whitelist')->eq($newWhitelist)->where('id')->eq($programID)->exec();
|
||||
|
||||
$viewPrograms = $this->dao->select('programs')->from(TABLE_USERVIEW)->where('account')->eq($account)->fetch('programs');
|
||||
$newViewPrograms = trim(str_replace(",$programID,", '', ",$viewPrograms,"), ',');
|
||||
$this->dao->update(TABLE_USERVIEW)->set('programs')->eq($newViewPrograms)->where('account')->eq($account)->exec();
|
||||
@@ -758,8 +759,6 @@ class personnelModel extends model
|
||||
/* Determine if the user exists in other sprints in the project set. */
|
||||
if(empty($whitelist))
|
||||
{
|
||||
$newWhitelist = str_replace(',' . $account, '', $project->whitelist);
|
||||
$this->dao->update(TABLE_PROJECT)->set('whitelist')->eq($newWhitelist)->where('id')->eq($projectID)->exec();
|
||||
$result = $this->dao->delete()->from(TABLE_ACL)
|
||||
->where('objectID')->eq($projectID)
|
||||
->andWhere('account')->eq($account)
|
||||
@@ -770,6 +769,9 @@ class personnelModel extends model
|
||||
/* Update user view when delete success. */
|
||||
if($result)
|
||||
{
|
||||
$newWhitelist = str_replace(',' . $account, '', $project->whitelist);
|
||||
$this->dao->update(TABLE_PROJECT)->set('whitelist')->eq($newWhitelist)->where('id')->eq($projectID)->exec();
|
||||
|
||||
$viewProjects = $this->dao->select('projects')->from(TABLE_USERVIEW)->where('account')->eq($account)->fetch('projects');
|
||||
$newViewProjects = trim(str_replace(",$projectID,", '', ",$viewProjects,"), ',');
|
||||
$this->dao->update(TABLE_USERVIEW)->set('projects')->eq($newViewProjects)->where('account')->eq($account)->exec();
|
||||
@@ -778,6 +780,38 @@ class personnelModel extends model
|
||||
$this->loadModel('user')->updateUserView($projectID, 'project', array($account));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete execution whitelist.
|
||||
*
|
||||
* @param int $executionID
|
||||
* @param string $account
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function deleteExecutionWhitelist($executionID, $account = '')
|
||||
{
|
||||
$execution = $this->dao->select('id,whitelist')->from(TABLE_EXECUTION)->where('id')->eq($executionID)->fetch();
|
||||
if(empty($execution)) return false;
|
||||
|
||||
$result = $this->dao->delete()->from(TABLE_ACL)
|
||||
->where('objectID')->eq($executionID)
|
||||
->andWhere('account')->eq($account)
|
||||
->andWhere('objectType')->eq('sprint')
|
||||
->andWhere('source')->eq('sync')
|
||||
->exec();
|
||||
|
||||
/* Update user view when delete success. */
|
||||
if($result)
|
||||
{
|
||||
$newWhitelist = str_replace(',' . $account, '', $execution->whitelist);
|
||||
$this->dao->update(TABLE_EXECUTION)->set('whitelist')->eq($newWhitelist)->where('id')->eq($executionID)->exec();
|
||||
|
||||
$viewExecutions = $this->dao->select('sprints')->from(TABLE_USERVIEW)->where('account')->eq($account)->fetch('sprints');
|
||||
$newViewExecutions = trim(str_replace(",$executionID,", '', ",$viewExecutions,"), ',');
|
||||
$this->dao->update(TABLE_USERVIEW)->set('sprints')->eq($newViewExecutions)->where('account')->eq($account)->exec();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete users in whitelist.
|
||||
*
|
||||
@@ -794,6 +828,7 @@ class personnelModel extends model
|
||||
if($objectType == 'program') $this->deleteProgramWhitelist($objectID, $account);
|
||||
if($objectType == 'project') $this->deleteProjectWhitelist($objectID, $account);
|
||||
if($objectType == 'product') $this->deleteProductWhitelist($objectID, $account);
|
||||
if($objectType == 'sprint') $this->deleteExecutionWhitelist($objectID, $account);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user