|
|
@ -52,7 +52,9 @@ module DemoData |
|
|
|
groups.each do |group_attr| |
|
|
|
groups.each do |group_attr| |
|
|
|
print '.' |
|
|
|
print '.' |
|
|
|
group = create_group group_attr[:name] |
|
|
|
group = create_group group_attr[:name] |
|
|
|
|
|
|
|
|
|
|
|
add_user_to_group group |
|
|
|
add_user_to_group group |
|
|
|
|
|
|
|
add_projects_to_group group, group_attr[:projects] |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
@ -63,5 +65,18 @@ module DemoData |
|
|
|
def add_user_to_group(group) |
|
|
|
def add_user_to_group(group) |
|
|
|
group.users << user |
|
|
|
group.users << user |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def add_projects_to_group(group, projects) |
|
|
|
|
|
|
|
projects.each do |project_attr| |
|
|
|
|
|
|
|
project = Project.find(project_attr[:name]) |
|
|
|
|
|
|
|
role = Role.find_by(name: project_attr[:role]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Member.create!( |
|
|
|
|
|
|
|
project: project, |
|
|
|
|
|
|
|
principal: group, |
|
|
|
|
|
|
|
roles: [role] |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|