Пример #1
0
 /**
  * Check if the commit target is tags
  * @param Project $project
  * @param Integer $transaction
  *
  * @return Boolean
  */
 private function isCommitAllowed($project, $transaction)
 {
     $paths = $this->svn_look->getTransactionPath($project, $transaction);
     $this->logger->debug("Checking if commit is done in tag");
     foreach ($paths as $path) {
         $this->logger->debug("Checking {$path}");
         if ($this->isCommitDoneInImmutableTag($project, $path)) {
             $this->logger->debug("{$path} is denied");
             return false;
         }
     }
     $this->logger->debug("Commit is allowed \\o/");
     return true;
 }
 private function getRevisionInfo($revision, Project $project)
 {
     $info = $this->svnlook->getInfo($project, $revision['revision']);
     $date_parts = explode(' (', $info[1]);
     return new SVN_RevisionPathInfo($revision['revision'], $revision['path'], $this->getUserId($info[0]), strtotime($date_parts[0]), $info[3]);
 }
Пример #3
0
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Tuleap; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
$immutable_tags_handler = new SVN_Immutable_Tags_Handler(new SVN_Immutable_Tags_DAO());
$request->valid(new Valid_String('post_changes'));
$request->valid(new Valid_String('SUBMIT'));
if ($request->isPost() && $request->existAndNonEmpty('post_changes')) {
    $vImmutableTagsWhitelist = new Valid_Text('immutable-tags-whitelist');
    $vImmutableTagsPath = new Valid_Text('immutable-tags-path');
    if ($request->valid($vImmutableTagsWhitelist) && $request->valid($vImmutableTagsPath)) {
        $immutable_tags_whitelist = trim($request->get('immutable-tags-whitelist'));
        $immutable_tags_path = trim($request->get('immutable-tags-path'));
        $immutable_tags_handler->saveImmutableTagsForProject($group_id, $immutable_tags_whitelist, $immutable_tags_path);
    } else {
        $GLOBALS['Response']->addFeedback('error', $Language->getText('svn_admin_general_settings', 'upd_fail'));
    }
    $GLOBALS['Response']->redirect('/svn/admin/?func=immutable_tags&group_id=' . $group_id);
}
// Display the form
svn_header_admin(array('title' => $Language->getText('svn_admin_immutable_tags', 'title'), 'help' => 'svn.html#subversion-administration-interface'));
$pm = ProjectManager::instance();
$project = $pm->getProject($group_id);
$template_dir = ForgeConfig::get('codendi_dir') . '/src/templates/svn/';
$renderer = TemplateRendererFactory::build()->getRenderer($template_dir);
$svnlook = new SVN_Svnlook();
$presenter = new SVN_ImmutableTagsPresenter($project, $immutable_tags_handler->getImmutableTagsWhitelistForProject($group_id), $immutable_tags_handler->getImmutableTagsPathForProject($group_id), $svnlook->getTree($project));
$renderer->renderToPage('immutable-tags', $presenter);
svn_footer(array());