-
Notifications
You must be signed in to change notification settings - Fork 983
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes #6150 - users need taxonomy added on "all Users"
With this commit, if "All users" is ticked then locations and organizations are added to users. On edit user page, you can not edit this taxonomy as they are disabled with tooltip "Select all option enabled for this taxonomy".
- Loading branch information
Showing
10 changed files
with
111 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class UpdateTaxonomiesWithUsers < ActiveRecord::Migration | ||
def up | ||
say "This Migration will take time for updating organization & location records with all users for which ignore_types includes 'User' resource." | ||
Rake::Task['taxonomy:update_taxonomy'].invoke | ||
end | ||
|
||
def down | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
namespace :taxonomy do | ||
desc <<-END_DESC | ||
This task will update organization & location records with all users for which ignore_types includes 'User' resource. | ||
END_DESC | ||
task :update_taxonomy => :environment do | ||
users = User.all | ||
orgs_with_user_ignore_types = Organization.enabled_select_all_taxonomies('User') | ||
orgs_with_user_ignore_types.each do |org| | ||
org.users = users | ||
success = org.save | ||
puts "Failed to save Organization #{org.id}- #{org.errors.full_messages.inspect}" unless success | ||
end | ||
locations_with_user_ignore_types = Location.enabled_select_all_taxonomies('User') | ||
locations_with_user_ignore_types.each do |loc| | ||
loc.users = users | ||
success = loc.save | ||
puts "Failed to save Location #{loc.id}- #{loc.errors.full_messages.inspect}" unless success | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters