From 8272e18e57fd93e9adac789353a5b3640d781041 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 30 Oct 2012 13:27:15 +0200 Subject: [PATCH] Project path validation: array of not allowed paths --- app/models/project.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/project.rb b/app/models/project.rb index 53fe0ee1ccb..5b59f227c87 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -104,8 +104,10 @@ class Project < ActiveRecord::Base end def repo_name - if path == "gitolite-admin" - errors.add(:path, " like 'gitolite-admin' is not allowed") + denied_paths = %w(gitolite-admin groups projects dashboard) + + if denied_paths.include?(path) + errors.add(:path, "like #{path} is not allowed") end end