コード例 #1
0
ファイル: access_control.php プロジェクト: ndjido/tuleap
$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'));
        } else {
            $GLOBALS['Response']->addFeedback('error', $Language->getText('svn_admin_access_control', 'upd_fail'));
        }
    }
    $GLOBALS['Response']->redirect('/svn/admin/?func=access_control&group_id=' . $group_id);