Commit 295914e1c02f1f6066d2a7165f479ff649a90587

Authored by Braulio Bhavamitra
1 parent b3ca57de
Exists in rails5

rails5: drop unsecure and unsupported protected_attributes

Showing 173 changed files with 99 additions and 530 deletions   Show diff stats

Too many changes.

To preserve performance only 100 of 173 files displayed.

Gemfile
... ... @@ -49,7 +49,6 @@ gem 'sass-rails'
49 49 gem 'sprockets-rails', '~> 2.1'
50 50  
51 51 # gems to enable rails3 behaviour
52   -gem 'protected_attributes'
53 52 gem 'rails-observers', github: 'rails/rails-observers'
54 53 gem 'actionpack-page_caching'
55 54 gem 'actionpack-action_caching'
... ...
app/controllers/my_profile/cms_controller.rb
... ... @@ -207,14 +207,11 @@ class CmsController < MyProfileController
207 207 params[:uploaded_files].each do |file|
208 208 unless file == ''
209 209 @uploaded_files << UploadedFile.create(
210   - {
211   - :uploaded_data => file,
212   - :profile => profile,
213   - :parent => @parent,
214   - :last_changed_by => user,
215   - :author => user,
216   - },
217   - :without_protection => true
  210 + uploaded_data: file,
  211 + profile: profile,
  212 + parent: @parent,
  213 + last_changed_by: user,
  214 + author: user,
218 215 )
219 216 end
220 217 end
... ...
app/controllers/my_profile/manage_products_controller.rb
... ... @@ -86,7 +86,7 @@ class ManageProductsController &lt; ApplicationController
86 86 @edit = true
87 87 @level = @category.level
88 88 if request.post?
89   - if @product.update({:product_category_id => params[:selected_category_id]}, :without_protection => true)
  89 + if @product.update product_category_id: params[:selected_category_id]
90 90 render :partial => 'shared/redirect_via_javascript',
91 91 :locals => { :url => url_for(:controller => 'manage_products', :action => 'show', :id => @product) }
92 92 else
... ...
app/controllers/my_profile/profile_roles_controller.rb
... ... @@ -12,7 +12,7 @@ class ProfileRolesController &lt; MyProfileController
12 12 end
13 13  
14 14 def create
15   - @role = Role.new({:name => params[:role][:name], :permissions => params[:role][:permissions], :environment => environment }, :without_protection => true)
  15 + @role = Role.new name: params[:role][:name], permissions: params[:role][:permissions], environment: environment
16 16 if @role.save
17 17 profile.custom_roles << @role
18 18 redirect_to :action => 'show', :id => @role
... ...
app/mailers/mailing.rb
... ... @@ -4,8 +4,6 @@ class Mailing &lt; ActiveRecord::Base
4 4  
5 5 acts_as_having_settings :field => :data
6 6  
7   - attr_accessible :subject, :body, :data
8   -
9 7 validates_presence_of :source_id, :subject, :body
10 8 belongs_to :source, :foreign_key => :source_id, :polymorphic => true
11 9 belongs_to :person
... ...
app/models/abuse_report.rb
1 1 class AbuseReport < ActiveRecord::Base
2 2  
3   - attr_accessible :content, :reason
4   -
5 3 belongs_to :reporter, :class_name => 'Person'
6 4 belongs_to :abuse_complaint
7 5 has_many :reported_images, :dependent => :destroy
... ...
app/models/action_tracker_notification.rb
... ... @@ -8,8 +8,6 @@ class ActionTrackerNotification &lt; ActiveRecord::Base
8 8 validates_presence_of :profile_id, :action_tracker_id
9 9 validates_uniqueness_of :action_tracker_id, :scope => :profile_id
10 10  
11   - attr_accessible :profile_id, :action_tracker_id
12   -
13 11 end
14 12  
15 13 ActionTracker::Record.has_many :action_tracker_notifications, :class_name => 'ActionTrackerNotification', :foreign_key => 'action_tracker_id', :dependent => :destroy
... ...
app/models/approve_comment.rb
... ... @@ -8,7 +8,7 @@ class ApproveComment &lt; Task
8 8 def comment
9 9 unless @comment || self.comment_attributes.nil?
10 10 @comment = Comment.new
11   - @comment.assign_attributes(ActiveSupport::JSON.decode(self.comment_attributes.to_s), :without_protection => true)
  11 + @comment.assign_attributes ActiveSupport::JSON.decode(self.comment_attributes.to_s)
12 12 end
13 13 @comment
14 14 end
... ...
app/models/article.rb
1 1  
2 2 class Article < ActiveRecord::Base
3 3  
4   - attr_accessible :name, :body, :abstract, :profile, :tag_list, :parent,
5   - :allow_members_to_edit, :translation_of_id, :language,
6   - :license_id, :parent_id, :display_posts_in_current_language,
7   - :category_ids, :posts_per_page, :moderate_comments,
8   - :accept_comments, :feed, :published, :source, :source_name,
9   - :highlighted, :notify_comments, :display_hits, :slug,
10   - :external_feed_builder, :display_versions, :external_link,
11   - :image_builder, :show_to_followers,
12   - :author, :display_preview, :published_at, :person_followers
13   -
14 4 acts_as_having_image
15 5 include Noosfero::Plugin::HotSpot
16 6  
... ...
app/models/article_block.rb
1 1 class ArticleBlock < Block
2 2  
3   - attr_accessible :article_id
4   -
5 3 def self.description
6 4 _('Display one of your contents.')
7 5 end
... ...
app/models/block.rb
1 1 class Block < ActiveRecord::Base
2 2  
3   - attr_accessible :title, :subtitle, :display, :limit, :box_id, :posts_per_page,
4   - :visualization_format, :language, :display_user,
5   - :box, :edit_modes, :move_modes, :mirror
6   -
7 3 include ActionView::Helpers::TagHelper
8 4  
9 5 # Block-specific stuff
... ...
app/models/blog.rb
1 1 class Blog < Folder
2 2  
3   - attr_accessible :visualization_format
4   -
5 3 acts_as_having_posts
6 4 include PostsLimit
7 5  
... ... @@ -55,7 +53,7 @@ class Blog &lt; Folder
55 53 if self.external_feed(true) && self.external_feed.id == self.external_feed_data[:id].to_i
56 54 self.external_feed.attributes = self.external_feed_data.except(:id)
57 55 else
58   - self.build_external_feed(self.external_feed_data, :without_protection => true)
  56 + self.build_external_feed self.external_feed_data
59 57 end
60 58 self.external_feed.valid?
61 59 self.external_feed.errors.delete(:blog_id) # dont validate here relation: external_feed <-> blog
... ...
app/models/box.rb
... ... @@ -5,8 +5,6 @@ class Box &lt; ActiveRecord::Base
5 5 belongs_to :owner, :polymorphic => true
6 6 has_many :blocks, -> { order 'position' }, dependent: :destroy
7 7  
8   - attr_accessible :owner
9   -
10 8 include Noosfero::Plugin::HotSpot
11 9  
12 10 scope :with_position, -> { where 'boxes.position > 0' }
... ...
app/models/categories_block.rb
... ... @@ -8,8 +8,6 @@ class CategoriesBlock &lt; Block
8 8  
9 9 settings_items :category_types, :type => Array, :default => []
10 10  
11   - attr_accessible :category_types
12   -
13 11 def self.description
14 12 _("Categories Menu")
15 13 end
... ...
app/models/category.rb
1 1 class Category < ActiveRecord::Base
2 2  
3   - attr_accessible :name, :parent_id, :display_color, :display_in_menu, :image_builder, :environment, :parent
4   -
5 3 SEARCHABLE_FIELDS = {
6 4 :name => {:label => _('Name'), :weight => 10},
7 5 :acronym => {:label => _('Acronym'), :weight => 5},
... ...
app/models/certifier.rb
1 1 class Certifier < ActiveRecord::Base
2 2  
3   - attr_accessible :name, :environment
4   -
5 3 SEARCHABLE_FIELDS = {
6 4 :name => {:label => _('Name'), :weight => 10},
7 5 :description => {:label => _('Description'), :weight => 3},
... ...
app/models/chat_message.rb
1 1 class ChatMessage < ActiveRecord::Base
2   - attr_accessible :body, :from, :to
3 2  
4 3 belongs_to :to, :class_name => 'Profile'
5 4 belongs_to :from, :class_name => 'Profile'
6 5  
7 6 validates_presence_of :from, :to
  7 +
8 8 end
... ...
app/models/city.rb
1 1 class City < Region
2   - attr_accessible :name, :parent_id
  2 +
3 3 end
... ...
app/models/comment.rb
... ... @@ -6,8 +6,6 @@ class Comment &lt; ActiveRecord::Base
6 6 :body => {:label => _('Content'), :weight => 2},
7 7 }
8 8  
9   - attr_accessible :body, :author, :name, :email, :title, :reply_of_id, :source, :follow_article
10   -
11 9 validates_presence_of :body
12 10  
13 11 belongs_to :source, :counter_cache => true, :polymorphic => true
... ...
app/models/communities_block.rb
1 1 class CommunitiesBlock < ProfileListBlock
2 2  
3   - attr_accessible :accessor_id, :accessor_type, :role_id, :resource_id, :resource_type
4   -
5 3 def self.description
6 4 _("<p>Display all of your communities.</p><p>You could choose the amount of communities will be displayed and you could priorize that profiles with images.</p> <p>The view all button is always present in the block.</p>")
7 5 end
... ...
app/models/community.rb
1 1 class Community < Organization
2 2  
3   - attr_accessible :accessor_id, :accessor_type, :role_id, :resource_id, :resource_type
4   - attr_accessible :address_reference, :district, :tag_list, :language, :description
5 3 after_destroy :check_invite_member_for_destroy
6 4  
7 5 def self.type_name
... ...
app/models/create_community.rb
... ... @@ -9,15 +9,11 @@ class CreateCommunity &lt; Task
9 9 alias :environment :target
10 10 alias :environment= :target=
11 11  
12   - attr_accessible :environment, :requestor, :target
13   - attr_accessible :reject_explanation, :template_id
14   -
15 12 acts_as_having_image
16 13  
17 14 DATA_FIELDS = Community.fields + ['name', 'closed', 'description']
18 15 DATA_FIELDS.each do |field|
19 16 settings_items field.to_sym
20   - attr_accessible field.to_sym
21 17 end
22 18  
23 19 settings_items :custom_values
... ...
app/models/custom_field.rb
1 1 class CustomField < ActiveRecord::Base
2   - attr_accessible :name, :default_value, :format, :extras, :customized_type, :active, :required, :signup, :environment, :moderation_task
  2 +
3 3 serialize :customized_type
4 4 serialize :extras
5 5 has_many :custom_field_values, :dependent => :delete_all
... ...
app/models/custom_field_value.rb
1 1 class CustomFieldValue < ActiveRecord::Base
  2 +
2 3 belongs_to :custom_field
3 4 belongs_to :customized, :polymorphic => true
4   - attr_accessible :value, :public, :customized, :custom_field, :customized_type
  5 +
5 6 validate :can_save?
6 7  
7 8 def can_save?
... ...
app/models/domain.rb
... ... @@ -2,8 +2,6 @@ require &#39;noosfero/multi_tenancy&#39;
2 2  
3 3 class Domain < ActiveRecord::Base
4 4  
5   - attr_accessible :name, :owner, :is_default
6   -
7 5 # relationships
8 6 ###############
9 7  
... ...
app/models/enterprise.rb
... ... @@ -2,8 +2,6 @@
2 2 # only enterprises can offer products and services.
3 3 class Enterprise < Organization
4 4  
5   - attr_accessible :business_name, :address_reference, :district, :tag_list, :organization_website, :historic_and_current_context, :activities_short_description, :products_per_catalog_page
6   -
7 5 SEARCH_FILTERS = {
8 6 :order => %w[more_recent more_popular more_active],
9 7 :display => %w[compact full map]
... ...
app/models/environment.rb
... ... @@ -3,18 +3,6 @@
3 3 # domains.
4 4 class Environment < ActiveRecord::Base
5 5  
6   - attr_accessible :name, :is_default, :signup_welcome_text_subject,
7   - :signup_welcome_text_body, :terms_of_use,
8   - :message_for_disabled_enterprise, :news_amount_by_folder,
9   - :default_language, :languages, :description,
10   - :organization_approval_method, :enabled_plugins,
11   - :enabled_features, :redirection_after_login,
12   - :redirection_after_signup, :contact_email, :theme,
13   - :reports_lower_bound, :noreply_email,
14   - :signup_welcome_screen_body, :members_whitelist_enabled,
15   - :members_whitelist, :highlighted_news_amount,
16   - :portal_news_amount, :date_format, :signup_intro
17   -
18 6 has_many :users
19 7  
20 8 # allow roles use
... ...
app/models/event.rb
... ... @@ -3,8 +3,6 @@ require &#39;builder&#39;
3 3  
4 4 class Event < Article
5 5  
6   - attr_accessible :start_date, :end_date, :link, :address
7   -
8 6 def self.type_name
9 7 _('Event')
10 8 end
... ...
app/models/external_feed.rb
... ... @@ -10,8 +10,6 @@ class ExternalFeed &lt; ActiveRecord::Base
10 10 where '(fetched_at is NULL) OR (fetched_at < ?)', Time.now - FeedUpdater.update_interval
11 11 }
12 12  
13   - attr_accessible :address, :enabled, :only_once
14   -
15 13 def add_item(title, link, date, content)
16 14 return if content.blank?
17 15 doc = Nokogiri::HTML.fragment content
... ...
app/models/favorite_enterprise_person.rb
1 1 class FavoriteEnterprisePerson < ActiveRecord::Base
2 2  
3   - attr_accessible :person, :enterprise
4   -
5 3 track_actions :favorite_enterprise, :after_create, keep_params: [:enterprise_name, :enterprise_url], if: proc{ |f| f.is_trackable? }
6 4  
7 5 belongs_to :enterprise
... ...
app/models/featured_products_block.rb
1 1 class FeaturedProductsBlock < Block
2 2  
3   - attr_accessible :product_ids, :groups_of, :speed, :reflect
4   -
5 3 settings_items :product_ids, :type => Array, :default => []
6 4 settings_items :groups_of, :type => :integer, :default => 3
7 5 settings_items :speed, :type => :integer, :default => 1000
... ...
app/models/feed_reader_block.rb
1 1 class FeedReaderBlock < Block
2 2  
3   - attr_accessible :address, :update_errors
4   -
5 3 def initialize(attributes = nil, options = {})
6 4 data = attributes || {}
7 5 super(data)
... ...
app/models/forum.rb
... ... @@ -3,8 +3,6 @@ class Forum &lt; Folder
3 3 acts_as_having_posts -> { reorder 'updated_at DESC' }
4 4 include PostsLimit
5 5  
6   - attr_accessible :has_terms_of_use, :terms_of_use, :topic_creation
7   -
8 6 settings_items :terms_of_use, :type => :string, :default => ""
9 7 settings_items :has_terms_of_use, :type => :boolean, :default => false
10 8 settings_items :topic_creation, :type => :string, :default => 'self'
... ...
app/models/highlights_block.rb
1 1 class HighlightsBlock < Block
2 2  
3   - attr_accessible :images, :interval, :shuffle, :navigation
4   -
5 3 settings_items :images, :type => Array, :default => []
6 4 settings_items :interval, :type => 'integer', :default => 4
7 5 settings_items :shuffle, :type => 'boolean', :default => false
... ...
app/models/image.rb
1 1 class Image < ActiveRecord::Base
2 2  
3   - attr_accessible :uploaded_data, :label, :remove_image
4 3 attr_accessor :remove_image
5 4  
6 5 def self.max_size
... ...
app/models/input.rb
1 1 class Input < ActiveRecord::Base
2 2  
3   - attr_accessible :product, :product_id, :product_category, :product_category_id,
4   - :amount_used, :unit_id, :price_per_unit, :relevant_to_price, :is_from_solidarity_economy
5   -
6 3 belongs_to :product
7 4 belongs_to :product_category
8 5  
... ...
app/models/license.rb
1 1 class License < ActiveRecord::Base
2 2  
3   - attr_accessible :name, :url
4   -
5 3 SEARCHABLE_FIELDS = {
6 4 :name => {:label => _('Name'), :weight => 10},
7 5 :url => {:label => _('URL'), :weight => 5},
... ... @@ -14,8 +12,6 @@ class License &lt; ActiveRecord::Base
14 12 validates_presence_of :slug, :if => lambda {|license| license.name.present?}
15 13 validates_uniqueness_of :slug, :scope => :environment_id
16 14  
17   - attr_accessible :environment, :slug
18   -
19 15 before_validation do |license|
20 16 license.slug ||= license.name.to_slug if license.name.present?
21 17 end
... ...
app/models/link_article.rb
1 1 class LinkArticle < Article
2 2  
3   - attr_accessible :reference_article
4   -
5 3 def self.short_description
6 4 "Article link"
7 5 end
... ...
app/models/link_list_block.rb
1 1 class LinkListBlock < Block
2 2  
3   - attr_accessible :links
4   -
5 3 ICONS = [
6 4 ['no-icon', _('(No icon)')],
7 5 ['edit', N_('Edit')],
... ...
app/models/location_block.rb
1 1 class LocationBlock < Block
2 2  
3   - attr_accessible :zoom, :map_type
4   -
5 3 settings_items :zoom, :type => :integer, :default => 4
6 4 settings_items :map_type, :type => :string, :default => 'roadmap'
7 5  
... ...
app/models/mailing_sent.rb
1 1 class MailingSent < ActiveRecord::Base
2   - attr_accessible :person
  2 +
3 3 belongs_to :mailing
4 4 belongs_to :person
  5 +
5 6 end
... ...
app/models/my_network_block.rb
1 1 class MyNetworkBlock < Block
2 2  
3   - attr_accessible :display, :box
4   -
5 3 def self.description
6 4 _('My network')
7 5 end
... ...
app/models/organization.rb
1 1 # Represents any organization of the system
2 2 class Organization < Profile
3 3  
4   - attr_accessible :moderated_articles, :foundation_year, :contact_person, :acronym, :legal_form, :economic_activity, :management_information, :cnpj, :display_name, :enable_contact_us
5   -
6 4 SEARCH_FILTERS = {
7 5 :order => %w[more_recent more_popular more_active],
8 6 :display => %w[compact]
... ...
app/models/person.rb
1 1 # A person is the profile of an user holding all relationships with the rest of the system
2 2 class Person < Profile
3 3  
4   - attr_accessible :organization, :contact_information, :sex, :birth_date, :cell_phone, :comercial_phone, :jabber_id, :personal_website, :nationality, :address_reference, :district, :schooling, :schooling_status, :formation, :custom_formation, :area_of_study, :custom_area_of_study, :professional_activity, :organization_website, :following_articles
5   -
6 4 SEARCH_FILTERS = {
7 5 :order => %w[more_recent more_popular more_active],
8 6 :display => %w[compact]
9 7 }
10 8  
11   -
12 9 def self.type_name
13 10 _('Person')
14 11 end
... ...
app/models/price_detail.rb
1 1 class PriceDetail < ActiveRecord::Base
2 2  
3   - attr_accessible :price, :production_cost_id
4   -
5 3 belongs_to :product
6 4 validates_presence_of :product_id
7 5  
... ...
app/models/product.rb
... ... @@ -10,9 +10,6 @@ class Product &lt; ActiveRecord::Base
10 10 :display => %w[full map]
11 11 }
12 12  
13   - attr_accessible :name, :product_category, :profile, :profile_id, :enterprise,
14   - :highlighted, :price, :image_builder, :description, :available, :qualifiers, :unit_id, :discount, :inputs, :qualifiers_list
15   -
16 13 def self.default_search_display
17 14 'full'
18 15 end
... ...
app/models/product_category.rb
... ... @@ -3,8 +3,6 @@ class ProductCategory &lt; Category
3 3 has_many :products
4 4 has_many :inputs
5 5  
6   - attr_accessible :name, :parent, :environment
7   -
8 6 scope :unique, -> { select 'DISTINCT ON (path) categories.*' }
9 7 scope :by_enterprise, -> enterprise {
10 8 distinct.joins(:products).
... ...
app/models/product_qualifier.rb
1 1 class ProductQualifier < ActiveRecord::Base
2 2  
3   - attr_accessible :qualifier, :product, :certifier
4   -
5 3 belongs_to :qualifier
6 4 belongs_to :product
7 5 belongs_to :certifier
  6 +
8 7 end
... ...
app/models/production_cost.rb
1 1 class ProductionCost < ActiveRecord::Base
2 2  
3   - attr_accessible :name, :owner
4   -
5 3 belongs_to :owner, :polymorphic => true
  4 +
6 5 validates_presence_of :owner
7 6 validates_presence_of :name
8 7 validates_length_of :name, :maximum => 30, :allow_blank => true
... ...
app/models/products_block.rb
1 1 class ProductsBlock < Block
2 2  
3   - attr_accessible :product_ids
4   -
5 3 include ActionView::Helpers::TagHelper
6 4 include ActionView::Helpers::UrlHelper
7 5 include ActionView::Helpers
... ...
app/models/profile.rb
... ... @@ -3,10 +3,6 @@
3 3 # which by default is the one returned by Environment:default.
4 4 class Profile < ActiveRecord::Base
5 5  
6   - attr_accessible :name, :identifier, :public_profile, :nickname, :custom_footer, :custom_header, :address, :zip_code, :contact_phone, :image_builder, :description, :closed, :template_id, :environment, :lat, :lng, :is_template, :fields_privacy, :preferred_domain_id, :category_ids, :country, :city, :state, :national_region_code, :email, :contact_email, :redirect_l10n, :notification_time,
7   - :redirection_after_login, :custom_url_redirection,
8   - :email_suggestions, :allow_members_to_invite, :invite_friends_only, :secret, :profile_admin_mail_notification
9   -
10 6 # use for internationalizable human type names in search facets
11 7 # reimplement on subclasses
12 8 def self.type_name
... ...
app/models/profile_activity.rb
... ... @@ -2,9 +2,6 @@ class ProfileActivity &lt; ActiveRecord::Base
2 2  
3 3 self.record_timestamps = false
4 4  
5   - attr_accessible :profile_id,
6   - :profile, :activity
7   -
8 5 belongs_to :profile
9 6 belongs_to :activity, polymorphic: true
10 7  
... ...
app/models/profile_image_block.rb
1 1 class ProfileImageBlock < Block
2 2  
3   - attr_accessible :show_name
4   -
5 3 settings_items :show_name, :type => :boolean, :default => false
6 4  
7 5 def self.description
... ...
app/models/profile_list_block.rb
1 1 class ProfileListBlock < Block
2 2  
3   - attr_accessible :prioritize_profiles_with_image
4   -
5 3 settings_items :limit, :type => :integer, :default => 6
6 4 settings_items :prioritize_profiles_with_image, :type => :boolean, :default => true
7 5  
... ...
app/models/profile_suggestion.rb
1 1 class ProfileSuggestion < ActiveRecord::Base
  2 +
2 3 belongs_to :person
3 4 belongs_to :suggestion, :class_name => 'Profile', :foreign_key => :suggestion_id
4 5  
5   - attr_accessible :person, :suggestion, :suggestion_type, :categories, :enabled
6   -
7 6 has_many :suggestion_connections, :foreign_key => 'suggestion_id'
8 7 has_many :profile_connections, :through => :suggestion_connections, :source => :connection, :source_type => 'Profile'
9 8 has_many :tag_connections, :through => :suggestion_connections, :source => :connection, :source_type => 'ActsAsTaggableOn::Tag'
... ... @@ -67,7 +66,6 @@ class ProfileSuggestion &lt; ActiveRecord::Base
67 66  
68 67 RULES.keys.each do |rule|
69 68 settings_items rule
70   - attr_accessible rule
71 69 end
72 70  
73 71 # Number of suggestions by rule
... ...
app/models/qualifier.rb
1 1 class Qualifier < ActiveRecord::Base
2 2  
3   - attr_accessible :name, :environment
4   -
5 3 SEARCHABLE_FIELDS = {
6 4 :name => {:label => _('Name'), :weight => 1},
7 5 }
... ...
app/models/raw_html_block.rb
... ... @@ -10,8 +10,6 @@ class RawHTMLBlock &lt; Block
10 10  
11 11 settings_items :html, :type => :text
12 12  
13   - attr_accessible :html
14   -
15 13 def has_macro?
16 14 true
17 15 end
... ...
app/models/region.rb
1 1 # Region is a special type of category that is related to geographical issues.
2 2 class Region < Category
3 3  
4   - attr_accessible :name
5   -
6 4 has_and_belongs_to_many :validators, :class_name => 'Organization', :join_table => :region_validators
7 5  
8 6 require_dependency 'enterprise' # enterprises can also be validators
... ...
app/models/rss_feed.rb
1 1 class RssFeed < Article
2 2  
3   - attr_accessible :limit, :enabled, :language, :include, :feed_item_description
4   -
5 3 def self.type_name
6 4 _('RssFeed')
7 5 end
... ...
app/models/scrap.rb
1 1 class Scrap < ActiveRecord::Base
2 2  
3   - attr_accessible :content, :sender_id, :receiver_id, :scrap_id
4   -
5 3 SEARCHABLE_FIELDS = {
6 4 :content => {:label => _('Content'), :weight => 1},
7 5 }
... ...
app/models/search_term.rb
... ... @@ -5,8 +5,6 @@ class SearchTerm &lt; ActiveRecord::Base
5 5 belongs_to :context, :polymorphic => true
6 6 has_many :occurrences, :class_name => 'SearchTermOccurrence'
7 7  
8   - attr_accessible :term, :context, :asset
9   -
10 8 def self.calculate_scores
11 9 os = occurrences_scores
12 10 find_each { |search_term| search_term.calculate_score(os) }
... ...
app/models/search_term_occurrence.rb
... ... @@ -2,7 +2,6 @@ class SearchTermOccurrence &lt; ActiveRecord::Base
2 2  
3 3 belongs_to :search_term
4 4 validates_presence_of :search_term
5   - attr_accessible :search_term, :created_at, :total, :indexed
6 5  
7 6 EXPIRATION_TIME = 1.year
8 7  
... ...
app/models/sellers_search_block.rb
1 1 class SellersSearchBlock < Block
2 2  
3   - attr_accessible :title
4   -
5 3 def self.description
6 4 _('Search for enterprises and products')
7 5 end
... ...
app/models/slideshow_block.rb
... ... @@ -6,8 +6,6 @@ class SlideshowBlock &lt; Block
6 6 settings_items :navigation, :type => 'boolean', :default => false
7 7 settings_items :image_size, :type => 'string', :default => 'thumb'
8 8  
9   - attr_accessible :gallery_id, :image_size, :interval, :shuffle, :navigation
10   -
11 9 def self.description
12 10 _('Slideshow')
13 11 end
... ...
app/models/state.rb
1 1 class State < Region
2   - attr_accessible :name, :acronym, :environment
  2 +
3 3 end
... ...
app/models/suggestion_connection.rb
1 1 class SuggestionConnection < ActiveRecord::Base
2   - attr_accessible :suggestion, :suggestion_id, :connection_type, :connection_id
3 2  
4 3 belongs_to :suggestion, :class_name => 'ProfileSuggestion', :foreign_key => 'suggestion_id'
5 4 belongs_to :connection, :polymorphic => true
  5 +
6 6 end
... ...
app/models/tag.rb
1 1 Tag = ActsAsTaggableOn::Tag
2 2 class Tag
3 3  
4   - attr_accessible :name, :parent_id, :pending
5   -
6 4 has_many :children, class_name: 'Tag', foreign_key: 'parent_id', dependent: :destroy
7 5  
8 6 @@original_find = self.method(:find)
... ...
app/models/task.rb
... ... @@ -41,8 +41,6 @@ class Task &lt; ActiveRecord::Base
41 41 validates_uniqueness_of :code, :on => :create
42 42 validates_presence_of :code
43 43  
44   - attr_protected :status
45   -
46 44 settings_items :email_template_id, :type => :integer
47 45  
48 46 def initialize(*args)
... ...
app/models/thumbnail.rb
1 1 class Thumbnail < ActiveRecord::Base
2 2  
3   - attr_accessible :uploaded_data
4   - # mass assigned by attachment_fu
5   - attr_accessible :content_type, :filename, :thumbnail_resize_options, :thumbnail, :parent_id
6   -
7 3 has_attachment :storage => :file_system,
8 4 :content_type => :image, :max_size => UploadedFile.max_size, processor: 'Rmagick'
9 5 validates_as_attachment
... ...
app/models/unit.rb
... ... @@ -2,8 +2,6 @@ class Unit &lt; ActiveRecord::Base
2 2  
3 3 acts_as_list scope: -> unit { where environment_id: unit.environment_id }
4 4  
5   - attr_accessible :name, :singular, :plural, :environment
6   -
7 5 validates_presence_of :singular
8 6 validates_presence_of :plural
9 7  
... ...
app/models/uploaded_file.rb
... ... @@ -7,8 +7,6 @@ require &#39;sdbm&#39;
7 7  
8 8 class UploadedFile < Article
9 9  
10   - attr_accessible :uploaded_data, :title
11   -
12 10 def self.type_name
13 11 _('File')
14 12 end
... ...
app/models/user.rb
... ... @@ -6,8 +6,6 @@ require &#39;securerandom&#39;
6 6 # Rails generator.
7 7 class User < ActiveRecord::Base
8 8  
9   - attr_accessible :login, :email, :password, :password_confirmation, :activated_at
10   -
11 9 N_('Password')
12 10 N_('Password confirmation')
13 11 N_('Terms accepted')
... ... @@ -110,8 +108,6 @@ class User &lt; ActiveRecord::Base
110 108 # holds the current session, see lib/authenticated_system.rb
111 109 attr_accessor :session
112 110  
113   - attr_protected :activated_at
114   -
115 111 # Virtual attribute for the unencrypted password
116 112 attr_accessor :password, :name
117 113  
... ...
app/models/validation_info.rb
1 1 class ValidationInfo < ActiveRecord::Base
2 2  
3   - attr_accessible :validation_methodology, :restrictions, :organization
4   -
5 3 belongs_to :organization
6 4  
7 5 validates_presence_of :organization
... ...
config/application.rb
... ... @@ -72,12 +72,6 @@ module Noosfero
72 72 # like if you have constraints or database-specific column types
73 73 # config.active_record.schema_format = :sql
74 74  
75   - # Enforce whitelist mode for mass assignment.
76   - # This will create an empty whitelist of attributes available for mass-assignment for all models
77   - # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
78   - # parameters by using an attr_accessible or attr_protected declaration.
79   - config.active_record.whitelist_attributes = true
80   -
81 75 # Asset pipeline
82 76 config.assets.paths =
83 77 Dir.glob("app/assets/plugins/*/{,stylesheets,javascripts}") +
... ...
config/environments/development.rb
... ... @@ -20,9 +20,6 @@ Noosfero::Application.configure do
20 20 # Only use best-standards-support built into browsers
21 21 config.action_dispatch.best_standards_support = :builtin
22 22  
23   - # Raise exception on mass assignment protection for Active Record models
24   - config.active_record.mass_assignment_sanitizer = :strict
25   -
26 23 # Do not compress assets
27 24 config.assets.compress = false
28 25 config.assets.digest = false
... ...
config/environments/test.rb
... ... @@ -25,9 +25,6 @@ Noosfero::Application.configure do
25 25 # ActionMailer::Base.deliveries array.
26 26 config.action_mailer.delivery_method = :test
27 27  
28   - # Raise exception on mass assignment protection for Active Record models
29   - config.active_record.mass_assignment_sanitizer = :strict
30   -
31 28 # Print deprecation notices to the stderr
32 29 config.active_support.deprecation = :stderr
33 30 end
... ...
config/initializers/03_protected_attributes.rb
... ... @@ -1,6 +0,0 @@
1   -class Delayed::Backend::ActiveRecord::Job
2   - # rake db:schema:load run?
3   - if self.table_exists?
4   - attr_accessible *self.column_names, :payload_object
5   - end
6   -end
features/step_definitions/noosfero_steps.rb
... ... @@ -31,7 +31,7 @@ Given /^the following (community|communities|enterprises?|organizations?)$/ do |
31 31 category = row.delete("category")
32 32 img_name = row.delete("img")
33 33 city = row.delete("region")
34   - organization = klass.create!(row, :without_protection => true)
  34 + organization = klass.create! row
35 35 if owner
36 36 organization.add_admin(Profile[owner])
37 37 end
... ... @@ -204,7 +204,7 @@ Given /^the following products?$/ do |table|
204 204 qualifier = Qualifier.find_by name: data.delete("qualifier")
205 205 data.merge!(:qualifiers => [qualifier])
206 206 end
207   - product = Product.create!(data, :without_protection => true)
  207 + product = Product.create! data
208 208 end
209 209 end
210 210  
... ... @@ -215,8 +215,8 @@ Given /^the following inputs?$/ do |table|
215 215 category = Category.find_by slug: data.delete("category").to_slug
216 216 unit = Unit.find_by singular: data.delete("unit")
217 217 solidary = data.delete("solidary")
218   - input = Input.create!(data.merge(:product => product, :product_category => category, :unit => unit,
219   - :is_from_solidarity_economy => solidary), :without_protection => true)
  218 + input = Input.create! data.merge(product: product, product_category: category, unit: unit,
  219 + is_from_solidarity_economy: solidary)
220 220 input.update_attribute(:position, data['position'])
221 221 end
222 222 end
... ... @@ -254,7 +254,7 @@ end
254 254  
255 255 Given /^the following qualifiers$/ do |table|
256 256 table.hashes.each do |row|
257   - Qualifier.create!(row.merge(:environment_id => 1), :without_protection => true)
  257 + Qualifier.create! row.merge(environment_id: 1)
258 258 end
259 259 end
260 260  
... ... @@ -265,7 +265,7 @@ Given /^the following certifiers$/ do |table|
265 265 if qualifiers_list
266 266 row["qualifiers"] = qualifiers_list.split(', ').map{|i| Qualifier.find_by name: i }
267 267 end
268   - Certifier.create!(row.merge(:environment_id => 1), :without_protection => true)
  268 + Certifier.create! row.merge(environment_id: 1)
269 269 end
270 270 end
271 271  
... ... @@ -505,7 +505,7 @@ end
505 505  
506 506 Given /^the following units?$/ do |table|
507 507 table.hashes.each do |row|
508   - Unit.create!(row.merge(:environment_id => 1), :without_protection => true)
  508 + Unit.create! row.merge(environment_id: 1)
509 509 end
510 510 end
511 511  
... ...
lib/acts_as_customizable.rb
1 1 module Customizable
2 2  
3 3 def self.included(base)
4   - base.attr_accessible :custom_values
5 4 base.extend ClassMethods
6 5 end
7 6  
... ...
lib/acts_as_having_image.rb
... ... @@ -5,7 +5,6 @@ module ActsAsHavingImage
5 5 belongs_to :image, dependent: :destroy
6 6 scope :with_image, -> { where "#{table_name}.image_id IS NOT NULL" }
7 7 scope :without_image, -> { where "#{table_name}.image_id IS NULL" }
8   - attr_accessible :image_builder
9 8 include ActsAsHavingImage
10 9 end
11 10 end
... ...
plugins/analytics/models/analytics_plugin/page_view.rb
... ... @@ -2,11 +2,7 @@ class AnalyticsPlugin::PageView &lt; ActiveRecord::Base
2 2  
3 3 serialize :data
4 4  
5   - attr_accessible *self.column_names
6   - attr_accessible :user, :profile
7   -
8 5 attr_accessor :request
9   - attr_accessible :request
10 6  
11 7 acts_as_having_settings field: :options
12 8  
... ...
plugins/analytics/models/analytics_plugin/visit.rb
1 1 class AnalyticsPlugin::Visit < ActiveRecord::Base
2 2  
3   - attr_accessible *self.column_names
4   - attr_accessible :profile
5   -
6 3 belongs_to :profile
7 4 has_many :page_views, class_name: 'AnalyticsPlugin::PageView', dependent: :destroy
8 5  
... ...
plugins/breadcrumbs/lib/breadcrumbs_plugin/content_breadcrumbs_block.rb
... ... @@ -4,8 +4,6 @@ class BreadcrumbsPlugin::ContentBreadcrumbsBlock &lt; Block
4 4 settings_items :show_profile, :type => :boolean, :default => true
5 5 settings_items :show_section_name, :type => :boolean, :default => true
6 6  
7   - attr_accessible :show_cms_action, :show_profile, :show_section_name
8   -
9 7 def self.description
10 8 _("<p>Display a breadcrumb of the current content navigation.</p><p>You could choose if the breadcrumb is going to appear in the cms editing or not.</p> <p>There is either the option of display the profile location in the breadcrumb path.</p>")
11 9 end
... ...
plugins/comment_classification/lib/comment_classification_plugin/comment_label_user.rb
... ... @@ -5,8 +5,6 @@ class CommentClassificationPlugin::CommentLabelUser &lt; ActiveRecord::Base
5 5 belongs_to :comment
6 6 belongs_to :label, :class_name => 'CommentClassificationPlugin::Label'
7 7  
8   - attr_accessible :profile, :comment, :label
9   -
10 8 validates_presence_of :profile
11 9 validates_presence_of :comment
12 10 validates_presence_of :label
... ...
plugins/comment_classification/lib/comment_classification_plugin/comment_status_user.rb
... ... @@ -5,8 +5,6 @@ class CommentClassificationPlugin::CommentStatusUser &lt; ActiveRecord::Base
5 5 belongs_to :comment
6 6 belongs_to :status, :class_name => 'CommentClassificationPlugin::Status'
7 7  
8   - attr_accessible :name, :enabled, :profile, :comment, :status_id, :reason
9   -
10 8 validates_presence_of :profile
11 9 validates_presence_of :comment
12 10 validates_presence_of :status
... ...
plugins/comment_classification/lib/comment_classification_plugin/label.rb
... ... @@ -6,8 +6,6 @@ class CommentClassificationPlugin::Label &lt; ActiveRecord::Base
6 6  
7 7 scope :enabled, -> { where enabled: true }
8 8  
9   - attr_accessible :name, :enabled, :color
10   -
11 9 COLORS = ['red', 'green', 'yellow', 'gray', 'blue']
12 10  
13 11 end
... ...
plugins/comment_classification/lib/comment_classification_plugin/status.rb
... ... @@ -2,8 +2,6 @@ class CommentClassificationPlugin::Status &lt; ActiveRecord::Base
2 2  
3 3 belongs_to :owner, :polymorphic => true
4 4  
5   - attr_accessible :name, :enabled
6   -
7 5 validates_presence_of :name
8 6  
9 7 scope :enabled, -> { where enabled: true }
... ...
plugins/comment_group/lib/ext/comment.rb
... ... @@ -6,6 +6,4 @@ class Comment
6 6  
7 7 scope :in_group, -> group_id { where 'group_id = ?', group_id }
8 8  
9   - attr_accessible :group_id
10   -
11 9 end
... ...
plugins/comment_paragraph/lib/ext/comment.rb
... ... @@ -11,8 +11,6 @@ class Comment
11 11 where 'paragraph_uuid = ?', paragraph_uuid
12 12 }
13 13  
14   - attr_accessible :paragraph_uuid, :comment_paragraph_selected_area, :id, :comment_paragraph_selected_content
15   -
16 14 before_validation do |comment|
17 15 comment.comment_paragraph_selected_area = nil if comment.comment_paragraph_selected_area.blank?
18 16 comment.comment_paragraph_selected_content = nil if comment_paragraph_selected_content.blank?
... ...
plugins/community_track/lib/community_track_plugin/step.rb
... ... @@ -3,8 +3,6 @@ class CommunityTrackPlugin::Step &lt; Folder
3 3 settings_items :hidden, :type => :boolean, :default => false
4 4 settings_items :tool_type, :type => String
5 5  
6   - attr_accessible :start_date, :end_date, :tool_type, :hidden
7   -
8 6 alias :tools :children
9 7  
10 8 acts_as_list scope: -> step { where parent_id: step.parent_id }
... ...
plugins/community_track/lib/community_track_plugin/track.rb
... ... @@ -5,8 +5,6 @@ class CommunityTrackPlugin::Track &lt; Folder
5 5  
6 6 validate :validate_categories
7 7  
8   - attr_accessible :goals, :expected_results
9   -
10 8 def comments_count
11 9 @comments_count = sum_children_comments self unless @comments_count
12 10 @comments_count
... ...
plugins/context_content/lib/context_content_plugin/context_content_block.rb
... ... @@ -7,8 +7,6 @@ class ContextContentPlugin::ContextContentBlock &lt; Block
7 7 settings_items :types, :type => Array, :default => ['UploadedFile']
8 8 settings_items :limit, :type => :integer, :default => 6
9 9  
10   - attr_accessible :show_image, :show_name, :use_parent_title, :show_parent_content, :types
11   -
12 10 alias :profile :owner
13 11  
14 12 include Noosfero::Plugin::HotSpot
... ...
plugins/custom_forms/lib/custom_forms_plugin/alternative.rb
... ... @@ -5,6 +5,5 @@ class CustomFormsPlugin::Alternative &lt; ActiveRecord::Base
5 5  
6 6 belongs_to :field, :class_name => 'CustomFormsPlugin::Field'
7 7  
8   - attr_accessible :label, :field, :position, :selected_by_default
9 8 end
10 9  
... ...
plugins/custom_forms/lib/custom_forms_plugin/answer.rb
... ... @@ -6,8 +6,6 @@ class CustomFormsPlugin::Answer &lt; ActiveRecord::Base
6 6 validates_presence_of :field
7 7 validate :value_mandatory, :if => 'field.present?'
8 8  
9   - attr_accessible :field, :value, :submission
10   -
11 9 def value_mandatory
12 10 if field.mandatory && value.blank?
13 11 errors.add(:value, _("is mandatory.").fix_i18n)
... ...
plugins/custom_forms/lib/custom_forms_plugin/field.rb
... ... @@ -4,8 +4,6 @@ class CustomFormsPlugin::Field &lt; ActiveRecord::Base
4 4 validates_presence_of :name
5 5 validates_length_of :default_value, :maximum => 255
6 6  
7   - attr_accessible :name, :form, :mandatory, :type, :position, :default_value, :show_as, :alternatives_attributes
8   -
9 7 belongs_to :form, :class_name => 'CustomFormsPlugin::Form'
10 8 has_many :answers, :class_name => 'CustomFormsPlugin::Answer', :dependent => :destroy
11 9  
... ...
plugins/custom_forms/lib/custom_forms_plugin/form.rb
... ... @@ -14,8 +14,6 @@ class CustomFormsPlugin::Form &lt; ActiveRecord::Base
14 14 validate :period_range, :if => Proc.new { |f| f.begining.present? && f.ending.present? }
15 15 validate :access_format
16 16  
17   - attr_accessible :name, :profile, :for_admission, :access, :begining, :ending, :description, :fields_attributes, :profile_id, :on_membership
18   -
19 17 before_validation do |form|
20 18 form.slug = form.name.to_slug if form.name.present?
21 19 form.access = nil if form.access.blank?
... ...
plugins/custom_forms/lib/custom_forms_plugin/submission.rb
... ... @@ -6,8 +6,6 @@ class CustomFormsPlugin::Submission &lt; ActiveRecord::Base
6 6 # validation is done manually, see below
7 7 has_many :answers, :class_name => 'CustomFormsPlugin::Answer', :dependent => :destroy, :validate => false
8 8  
9   - attr_accessible :form, :profile, :author_name, :author_email
10   -
11 9 validates_presence_of :form
12 10 validates_presence_of :author_name, :author_email, :if => lambda {|submission| submission.profile.nil?}
13 11 validates_uniqueness_of :author_email, :scope => :form_id, :allow_nil => true
... ...
plugins/delivery/models/delivery_plugin/method.rb
... ... @@ -7,9 +7,6 @@ class DeliveryPlugin::Method &lt; ActiveRecord::Base
7 7 address address_line2 address_reference district city state country_name zip_code
8 8 ].map(&:to_sym)
9 9  
10   - attr_accessible :profile, :delivery_type, :name, :description,
11   - :fixed_cost, :free_over_price, :distribution_margin_percentage, :distribution_margin_fixed
12   -
13 10 belongs_to :profile
14 11  
15 12 has_many :delivery_options, class_name: 'DeliveryPlugin::Option', foreign_key: :delivery_method_id, dependent: :destroy
... ...
plugins/delivery/models/delivery_plugin/option.rb
... ... @@ -6,6 +6,4 @@ class DeliveryPlugin::Option &lt; ActiveRecord::Base
6 6 validates_presence_of :delivery_method
7 7 validates_presence_of :owner
8 8  
9   - attr_accessible :owner_id, :owner_type, :delivery_methods, :delivery_method
10   -
11 9 end
... ...
plugins/display_content/lib/display_content_block.rb
... ... @@ -29,8 +29,6 @@ class DisplayContentBlock &lt; Block
29 29 settings_items :content_with_translations, :type => :boolean, :default => :true
30 30 settings_items :limit_to_show, :type => :integer, :default => 6
31 31  
32   - attr_accessible :sections, :checked_nodes, :display_folder_children, :types, :order_by_recent, :limit_to_show, :content_with_translations
33   -
34 32 def self.description
35 33 _('Display your contents')
36 34 end
... ...