Fixed Mantis importer: projects trackers and modules assignment

Fixed Trac and Mantis importers: roles assignments

git-svn-id: http://redmine.rubyforge.org/svn/trunk@936 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-11-29 20:08:14 +00:00
parent bf6e02c739
commit 2cf11bd64e
3 changed files with 18 additions and 8 deletions

View File

@ -53,9 +53,10 @@ task :migrate_from_mantis => :environment do
TRACKER_BUG = Tracker.find_by_position(1)
TRACKER_FEATURE = Tracker.find_by_position(2)
DEFAULT_ROLE = Role.find_by_position(3)
manager_role = Role.find_by_position(1)
developer_role = Role.find_by_position(2)
roles = Role.find(:all, :conditions => {:builtin => 0}, :order => 'position ASC')
manager_role = roles[0]
developer_role = roles[1]
DEFAULT_ROLE = roles.last
ROLE_MAPPING = {10 => DEFAULT_ROLE, # viewer
25 => DEFAULT_ROLE, # reporter
40 => DEFAULT_ROLE, # updater
@ -268,6 +269,9 @@ task :migrate_from_mantis => :environment do
p.identifier = project.identifier
next unless p.save
projects_map[project.id] = p.id
p.enabled_module_names = ['issue_tracking', 'news', 'wiki']
p.trackers << TRACKER_BUG
p.trackers << TRACKER_FEATURE
print '.'
# Project members

View File

@ -54,10 +54,11 @@ namespace :redmine do
'task' => TRACKER_FEATURE,
'patch' =>TRACKER_FEATURE
}
DEFAULT_ROLE = Role.find_by_position(3)
manager_role = Role.find_by_position(1)
developer_role = Role.find_by_position(2)
roles = Role.find(:all, :conditions => {:builtin => 0}, :order => 'position ASC')
manager_role = roles[0]
developer_role = roles[1]
DEFAULT_ROLE = roles.last
ROLE_MAPPING = {'admin' => manager_role,
'developer' => developer_role
}
@ -173,7 +174,7 @@ namespace :redmine do
elsif TracPermission.find_by_username_and_action(username, 'developer')
role = ROLE_MAPPING['developer']
end
Member.create(:user => u, :project => @target_project, :role => DEFAULT_ROLE)
Member.create(:user => u, :project => @target_project, :role => role)
u.reload
end
u

View File

@ -46,4 +46,9 @@ class SearchControllerTest < Test::Unit::TestCase
assert_response :success
assert_template 'index'
end
def test_tokens_with_quotes
get :index, :id => 1, :q => '"good bye" hello "bye bye"'
assert_equal ["good bye", "hello", "bye bye"], assigns(:tokens)
end
end