* Finish task #69699.

This commit is contained in:
wangyuting2
2022-09-22 01:05:34 +00:00
parent 0165845882
commit 6a82102b27
2 changed files with 38 additions and 1 deletions
+36
View File
@@ -833,4 +833,40 @@ class customModel extends model
return $waterfallCount || $assetLibCount || $URStoryCount;
}
/**
* process project priv within a program set.
*
* @access public
* @return void
*/
public function processProjectAcl()
{
$projectGroup = $this->dao->select('id,parent,whitelist')->from(TABLE_PROJECT)
->where('parent')->ne('0')
->andwhere('type')->eq('project')
->andWhere('acl')->eq('program')
->fetchGroup('parent');
$programs = $this->dao->select("id,CONCAT(PM,',',openedBy)")->from(TABLE_PROGRAM)
->where('id')->in(array_keys($projectGroup))
->andWhere('type')->eq('program')
->fetchPairs();
foreach($projectGroup as $projects)
{
foreach($projects as $project)
{
$whitelist = rtrim($project->whitelist . ',' . zget($programs, $project->parent, ''));
$whitelist = explode(',', $whitelist);
$whitelist = array_filter(array_unique($whitelist));
$whitelist = join(',', $whitelist);
$data = new stdclass();
$data->acl = 'private';
$data->whitelist = $whitelist;
$this->dao->update(TABLE_PROJECT)->data($data)->where('id')->eq($project->id)->exec();
}
}
}
}