function prj_pushDownNewPermissions($pid) { global $_TABLES; // First - remove all permissions on tasks $query = DB_query("SELECT tid from {$_TABLES['prj_tasks']} WHERE pid={$pid}"); while (list($tid) = DB_fetchArray($query)) { $tids[] = $tid; } if (count($tids) > 0) { $project_tasks = implode(',', $tids); $sql = "DELETE FROM {$_TABLES['prj_projPerms']} WHERE pid='{$pid}' "; $sql .= "AND taskid in ( {$project_tasks} )"; DB_query($sql); } // Set perms for non-private tasks $sql = "select tid from {$_TABLES['prj_tasks']} where pid='{$pid}' and make_private_enabled_flag<>'on'"; $res = DB_query($sql); $nrows = DB_numRows($res); for ($cntr = 0; $cntr < $nrows; $cntr++) { list($taskID) = DB_fetchArray($res); prj_addTrickleDownTaskPerms($pid, $taskID); } // Do the same but for private tasks.... $sql = "select tid from {$_TABLES['prj_tasks']} where pid='{$pid}' and make_private_enabled_flag='on'"; $res = DB_query($sql); $nrows = DB_numRows($res); for ($cntr = 0; $cntr < $nrows; $cntr++) { list($taskID) = DB_fetchArray($res); prj_addTeamMemberTaskPerms($pid, $taskID); } }
//fullaccess $sql .= "'1'"; //seedetails $sql .= ")"; DB_query($sql); /*********************************************/ //add trickle down permissions here //from the project to this task //ONLY if the 'private' task button is not clicked //if private, only team members get permissions /*********************************************/ if ($newrec['make_private_enabled_flag'] != 'on') { prj_addTrickleDownTaskPerms($pid, $newrec['tid']); } else { // prj_addTeamMemberTaskPerms($pid, $newrec['tid']); } DB_query("UPDATE {$_TABLES['prj_projects']} SET last_updated_date={$newrec['last_updated_date']} WHERE pid={$pid}"); prj_sendNotification($pid, $newrec['tid'], $action = 3); prj_sendNotification($pid, $newrec['tid'], $action = 4); $logentry = "Task ID-{$newrec['tid']} was created"; prg_updateAuditLog($logentry); } else { COM_errorLog("projects: Error adding new task - User: {$uid} has no right"); } $msg = "createTask"; break; case 'add': // Form to add new task $uid = $_USER[uid]; $protoken = prj_getProjectPermissions($pid, $uid);