Project path validation: array of not allowed paths

This commit is contained in:
Dmitriy Zaporozhets 2012-10-30 13:27:15 +02:00
parent 37e39e4176
commit 8272e18e57

View file

@ -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