function testGetCurrentSection() { $saf = new SVNAccessFile(); $this->assertEqual(-1, $saf->getCurrentSection('', -1)); $this->assertEqual(-1, $saf->getCurrentSection('blah', -1)); $this->assertEqual('groups', $saf->getCurrentSection('[Groups]', -1)); $this->assertEqual('groups', $saf->getCurrentSection('[Groups]', 'groups')); $this->assertEqual(-1, $saf->getCurrentSection('[/]', -1)); $this->assertEqual(-1, $saf->getCurrentSection('[/]', 'groups')); $this->assertEqual('groups', $saf->getCurrentSection('Group1 = user1, user2', 'groups')); $this->assertEqual(-1, $saf->getCurrentSection('Group1 = user1, user2', -1)); }
// // Originally written by Laurent Julliard 2004, Codendi Team, Xerox // $project_manager = ProjectManager::instance(); $project = $project_manager->getProject($group_id); $project_svnroot = $project->getSVNRootPath(); $dao = new SVN_AccessFile_DAO(); $path = realpath(dirname(__FILE__) . '/../../../templates/svn/'); $renderer = TemplateRendererFactory::build()->getRenderer($path); $request->valid(new Valid_String('post_changes')); $request->valid(new Valid_String('SUBMIT')); if ($request->isPost() && $request->existAndNonEmpty('post_changes')) { $vAccessFile = new Valid_Text('form_accessfile'); $vAccessFile->setErrorMessage($Language->getText('svn_admin_access_control', 'upd_fail')); if ($request->valid($vAccessFile)) { $saf = new SVNAccessFile(); $form_accessfile = null; //store the custom access file in db if ($request->exist('submit_new_version')) { $form_accessfile = trim($saf->parseGroupLines($project, $request->get('form_accessfile'), true)); $dao->saveNewAccessFileVersionInProject($group_id, $form_accessfile); } else { $form_accessfile = $saf->parseGroupLines($project, $request->get('other_version_content'), true); $version_id = $request->get('version_selected'); $dao->updateAccessFileVersionInProject($group_id, $version_id); } $buffer = svn_utils_read_svn_access_file_defaults($project_svnroot); $buffer .= $form_accessfile; $ret = svn_utils_write_svn_access_file($project_svnroot, $buffer); if ($ret) { $GLOBALS['Response']->addFeedback('info', $Language->getText('svn_admin_access_control', 'upd_success'));
// // // // Originally written by Laurent Julliard 2004, Codendi Team, Xerox // $pm = ProjectManager::instance(); $project = $pm->getProject($group_id); $gname = $project->getUnixName(false); // don't return a lower case group name $request->valid(new Valid_String('post_changes')); $request->valid(new Valid_String('SUBMIT')); if ($request->isPost() && $request->existAndNonEmpty('post_changes')) { $vAccessFile = new Valid_Text('form_accessfile'); $vAccessFile->setErrorMessage($Language->getText('svn_admin_access_control', 'upd_fail')); if ($request->valid($vAccessFile)) { $saf = new SVNAccessFile(); $form_accessfile = $saf->parseGroupLines($project, $request->get('form_accessfile'), true); //store the custom access file in db $sql = "UPDATE groups\n SET svn_accessfile = '" . db_es($form_accessfile) . "'\n WHERE group_id = " . db_ei($group_id); db_query($sql); $buffer = svn_utils_read_svn_access_file_defaults($gname); $buffer .= $form_accessfile; $ret = svn_utils_write_svn_access_file($gname, $buffer); if ($ret) { $GLOBALS['Response']->addFeedback('info', $Language->getText('svn_admin_access_control', 'upd_success')); } else { $GLOBALS['Response']->addFeedback('error', $Language->getText('svn_admin_access_control', 'upd_fail')); } } } $hp =& Codendi_HTMLPurifier::instance();