* Finish task #69699.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user