Remove the limitation on characters that can be used in custom_field, issue_status, role, tracker, user names (#5152).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4599 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
92d34234b0
commit
44ffc5a336
|
@ -23,7 +23,6 @@ class CustomField < ActiveRecord::Base
|
||||||
validates_presence_of :name, :field_format
|
validates_presence_of :name, :field_format
|
||||||
validates_uniqueness_of :name, :scope => :type
|
validates_uniqueness_of :name, :scope => :type
|
||||||
validates_length_of :name, :maximum => 30
|
validates_length_of :name, :maximum => 30
|
||||||
validates_format_of :name, :with => /^[\w\s\.\'\-]*$/i
|
|
||||||
validates_inclusion_of :field_format, :in => Redmine::CustomFieldFormat.available_formats
|
validates_inclusion_of :field_format, :in => Redmine::CustomFieldFormat.available_formats
|
||||||
|
|
||||||
def initialize(attributes = nil)
|
def initialize(attributes = nil)
|
||||||
|
|
|
@ -25,7 +25,6 @@ class IssueStatus < ActiveRecord::Base
|
||||||
validates_presence_of :name
|
validates_presence_of :name
|
||||||
validates_uniqueness_of :name
|
validates_uniqueness_of :name
|
||||||
validates_length_of :name, :maximum => 30
|
validates_length_of :name, :maximum => 30
|
||||||
validates_format_of :name, :with => /^[\w\s\'\-]*$/i
|
|
||||||
validates_inclusion_of :default_done_ratio, :in => 0..100, :allow_nil => true
|
validates_inclusion_of :default_done_ratio, :in => 0..100, :allow_nil => true
|
||||||
|
|
||||||
def after_save
|
def after_save
|
||||||
|
|
|
@ -43,7 +43,6 @@ class Role < ActiveRecord::Base
|
||||||
validates_presence_of :name
|
validates_presence_of :name
|
||||||
validates_uniqueness_of :name
|
validates_uniqueness_of :name
|
||||||
validates_length_of :name, :maximum => 30
|
validates_length_of :name, :maximum => 30
|
||||||
validates_format_of :name, :with => /^[\w\s\'\-]*$/i
|
|
||||||
|
|
||||||
def permissions
|
def permissions
|
||||||
read_attribute(:permissions) || []
|
read_attribute(:permissions) || []
|
||||||
|
|
|
@ -31,7 +31,6 @@ class Tracker < ActiveRecord::Base
|
||||||
validates_presence_of :name
|
validates_presence_of :name
|
||||||
validates_uniqueness_of :name
|
validates_uniqueness_of :name
|
||||||
validates_length_of :name, :maximum => 30
|
validates_length_of :name, :maximum => 30
|
||||||
validates_format_of :name, :with => /^[\w\s\'\-]*$/i
|
|
||||||
|
|
||||||
def to_s; name end
|
def to_s; name end
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,6 @@ class User < Principal
|
||||||
# Login must contain lettres, numbers, underscores only
|
# Login must contain lettres, numbers, underscores only
|
||||||
validates_format_of :login, :with => /^[a-z0-9_\-@\.]*$/i
|
validates_format_of :login, :with => /^[a-z0-9_\-@\.]*$/i
|
||||||
validates_length_of :login, :maximum => 30
|
validates_length_of :login, :maximum => 30
|
||||||
validates_format_of :firstname, :lastname, :with => /^[\w\s\'\-\.]*$/i
|
|
||||||
validates_length_of :firstname, :lastname, :maximum => 30
|
validates_length_of :firstname, :lastname, :maximum => 30
|
||||||
validates_format_of :mail, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :allow_nil => true
|
validates_format_of :mail, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :allow_nil => true
|
||||||
validates_length_of :mail, :maximum => 60, :allow_nil => true
|
validates_length_of :mail, :maximum => 60, :allow_nil => true
|
||||||
|
|
|
@ -88,13 +88,11 @@ task :migrate_from_mantis => :environment do
|
||||||
|
|
||||||
def firstname
|
def firstname
|
||||||
@firstname = realname.blank? ? username : realname.split.first[0..29]
|
@firstname = realname.blank? ? username : realname.split.first[0..29]
|
||||||
@firstname.gsub!(/[^\w\s\'\-]/i, '')
|
|
||||||
@firstname
|
@firstname
|
||||||
end
|
end
|
||||||
|
|
||||||
def lastname
|
def lastname
|
||||||
@lastname = realname.blank? ? '-' : realname.split[1..-1].join(' ')[0..29]
|
@lastname = realname.blank? ? '-' : realname.split[1..-1].join(' ')[0..29]
|
||||||
@lastname.gsub!(/[^\w\s\'\-]/i, '')
|
|
||||||
@lastname = '-' if @lastname.blank?
|
@lastname = '-' if @lastname.blank?
|
||||||
@lastname
|
@lastname
|
||||||
end
|
end
|
||||||
|
@ -224,7 +222,7 @@ task :migrate_from_mantis => :environment do
|
||||||
end
|
end
|
||||||
|
|
||||||
def name
|
def name
|
||||||
read_attribute(:name)[0..29].gsub(/[^\w\s\'\-]/, '-')
|
read_attribute(:name)[0..29]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -246,8 +246,8 @@ namespace :redmine do
|
||||||
ln = ($2 || '-').strip
|
ln = ($2 || '-').strip
|
||||||
|
|
||||||
u = User.new :mail => mail.gsub(/[^-@a-z0-9\.]/i, '-'),
|
u = User.new :mail => mail.gsub(/[^-@a-z0-9\.]/i, '-'),
|
||||||
:firstname => fn[0, limit_for(User, 'firstname')].gsub(/[^\w\s\'\-]/i, '-'),
|
:firstname => fn[0, limit_for(User, 'firstname')],
|
||||||
:lastname => ln[0, limit_for(User, 'lastname')].gsub(/[^\w\s\'\-]/i, '-')
|
:lastname => ln[0, limit_for(User, 'lastname')]
|
||||||
|
|
||||||
u.login = username[0,limit_for(User, 'login')].gsub(/[^a-z0-9_\-@\.]/i, '-')
|
u.login = username[0,limit_for(User, 'login')].gsub(/[^a-z0-9_\-@\.]/i, '-')
|
||||||
u.password = 'trac'
|
u.password = 'trac'
|
||||||
|
|
Loading…
Reference in New Issue