Skip to content

Release 4.0: Admin groups, Templates, Profiles

Dave Kaplan edited this page Jul 13, 2018 · 5 revisions
# setup admin groups and templates
Organization.all.each do |o|
  unless o.admin_group.present?
    o.create_admin_group(name: o.admin_group_name, organization: o, handle: o.admin_group_handle)
    o.save
  end
end

Group.all.each do |g|
  next unless g.primary?
  g.admins[:users].each do |u|
    u.add_role(Role::ADMIN, g.organization.admin_group)
  end
end

# JUST RUN FOR IDEO / GCI
Organization.where(id: [1, 159]).each do |o|
  OrganizationTemplates.call(o)
end


Organization.where(id: [1, 159]).each do |o|
  o.all_active_users.each do |u|
    # just in case they were missing for some reason... 
    Collection::UserCollection.find_or_create_for_user(u, o)
    Collection::UserProfile.find_or_create_for_user(user: u, organization: o)
  end
end
Clone this wiki locally