From 295914e1c02f1f6066d2a7165f479ff649a90587 Mon Sep 17 00:00:00 2001 From: Braulio Bhavamitra Date: Sun, 21 Feb 2016 15:22:11 -0300 Subject: [PATCH] rails5: drop unsecure and unsupported protected_attributes --- Gemfile | 1 - app/controllers/my_profile/cms_controller.rb | 13 +++++-------- app/controllers/my_profile/manage_products_controller.rb | 2 +- app/controllers/my_profile/profile_roles_controller.rb | 2 +- app/mailers/mailing.rb | 2 -- app/models/abuse_report.rb | 2 -- app/models/action_tracker_notification.rb | 2 -- app/models/approve_comment.rb | 2 +- app/models/article.rb | 10 ---------- app/models/article_block.rb | 2 -- app/models/block.rb | 4 ---- app/models/blog.rb | 4 +--- app/models/box.rb | 2 -- app/models/categories_block.rb | 2 -- app/models/category.rb | 2 -- app/models/certifier.rb | 2 -- app/models/chat_message.rb | 2 +- app/models/city.rb | 2 +- app/models/comment.rb | 2 -- app/models/communities_block.rb | 2 -- app/models/community.rb | 2 -- app/models/create_community.rb | 4 ---- app/models/custom_field.rb | 2 +- app/models/custom_field_value.rb | 3 ++- app/models/domain.rb | 2 -- app/models/enterprise.rb | 2 -- app/models/environment.rb | 12 ------------ app/models/event.rb | 2 -- app/models/external_feed.rb | 2 -- app/models/favorite_enterprise_person.rb | 2 -- app/models/featured_products_block.rb | 2 -- app/models/feed_reader_block.rb | 2 -- app/models/forum.rb | 2 -- app/models/highlights_block.rb | 2 -- app/models/image.rb | 1 - app/models/input.rb | 3 --- app/models/license.rb | 4 ---- app/models/link_article.rb | 2 -- app/models/link_list_block.rb | 2 -- app/models/location_block.rb | 2 -- app/models/mailing_sent.rb | 3 ++- app/models/my_network_block.rb | 2 -- app/models/organization.rb | 2 -- app/models/person.rb | 3 --- app/models/price_detail.rb | 2 -- app/models/product.rb | 3 --- app/models/product_category.rb | 2 -- app/models/product_qualifier.rb | 3 +-- app/models/production_cost.rb | 3 +-- app/models/products_block.rb | 2 -- app/models/profile.rb | 4 ---- app/models/profile_activity.rb | 3 --- app/models/profile_image_block.rb | 2 -- app/models/profile_list_block.rb | 2 -- app/models/profile_suggestion.rb | 4 +--- app/models/qualifier.rb | 2 -- app/models/raw_html_block.rb | 2 -- app/models/region.rb | 2 -- app/models/rss_feed.rb | 2 -- app/models/scrap.rb | 2 -- app/models/search_term.rb | 2 -- app/models/search_term_occurrence.rb | 1 - app/models/sellers_search_block.rb | 2 -- app/models/slideshow_block.rb | 2 -- app/models/state.rb | 2 +- app/models/suggestion_connection.rb | 2 +- app/models/tag.rb | 2 -- app/models/task.rb | 2 -- app/models/thumbnail.rb | 4 ---- app/models/unit.rb | 2 -- app/models/uploaded_file.rb | 2 -- app/models/user.rb | 4 ---- app/models/validation_info.rb | 2 -- config/application.rb | 6 ------ config/environments/development.rb | 3 --- config/environments/test.rb | 3 --- config/initializers/03_protected_attributes.rb | 6 ------ features/step_definitions/noosfero_steps.rb | 14 +++++++------- lib/acts_as_customizable.rb | 1 - lib/acts_as_having_image.rb | 1 - plugins/analytics/models/analytics_plugin/page_view.rb | 4 ---- plugins/analytics/models/analytics_plugin/visit.rb | 3 --- plugins/breadcrumbs/lib/breadcrumbs_plugin/content_breadcrumbs_block.rb | 2 -- plugins/comment_classification/lib/comment_classification_plugin/comment_label_user.rb | 2 -- plugins/comment_classification/lib/comment_classification_plugin/comment_status_user.rb | 2 -- plugins/comment_classification/lib/comment_classification_plugin/label.rb | 2 -- plugins/comment_classification/lib/comment_classification_plugin/status.rb | 2 -- plugins/comment_group/lib/ext/comment.rb | 2 -- plugins/comment_paragraph/lib/ext/comment.rb | 2 -- plugins/community_track/lib/community_track_plugin/step.rb | 2 -- plugins/community_track/lib/community_track_plugin/track.rb | 2 -- plugins/context_content/lib/context_content_plugin/context_content_block.rb | 2 -- plugins/custom_forms/lib/custom_forms_plugin/alternative.rb | 1 - plugins/custom_forms/lib/custom_forms_plugin/answer.rb | 2 -- plugins/custom_forms/lib/custom_forms_plugin/field.rb | 2 -- plugins/custom_forms/lib/custom_forms_plugin/form.rb | 2 -- plugins/custom_forms/lib/custom_forms_plugin/submission.rb | 2 -- plugins/delivery/models/delivery_plugin/method.rb | 3 --- plugins/delivery/models/delivery_plugin/option.rb | 2 -- plugins/display_content/lib/display_content_block.rb | 2 -- plugins/driven_signup/models/driven_signup_plugin/auth.rb | 2 -- plugins/environment_notification/lib/environment_notifications_user.rb | 2 -- plugins/environment_notification/models/environment_notification_plugin/environment_notification.rb | 2 -- plugins/event/lib/event_plugin/event_block.rb | 2 -- plugins/fb_app/lib/ext/profile.rb | 7 ------- plugins/fb_app/models/fb_app_plugin/auth.rb | 2 -- plugins/fb_app/models/fb_app_plugin/page_tab.rb | 4 ---- plugins/gallery_block/lib/gallery_block.rb | 2 -- plugins/google_analytics/lib/ext/profile.rb | 5 +---- plugins/lattes_curriculum/lib/academic_info.rb | 1 - plugins/lattes_curriculum/lib/ext/person.rb | 2 -- plugins/ldap/lib/ext/environment.rb | 2 -- plugins/newsletter/lib/newsletter_plugin/newsletter.rb | 2 -- plugins/newsletter/lib/newsletter_plugin/newsletter_mailing.rb | 2 -- plugins/oauth_client/models/oauth_client_plugin/auth.rb | 3 --- plugins/oauth_client/models/oauth_client_plugin/provider.rb | 4 ---- plugins/open_graph/lib/ext/profile.rb | 6 ------ plugins/open_graph/models/open_graph_plugin/track.rb | 4 ---- plugins/orders/lib/orders_plugin/date_range_attr.rb | 1 - plugins/orders/models/orders_plugin/item.rb | 7 ------- plugins/orders/models/orders_plugin/order.rb | 3 --- plugins/orders_cycle/models/orders_cycle_plugin/cycle.rb | 6 ------ plugins/orders_cycle/models/orders_cycle_plugin/order_base.rb | 2 -- plugins/organization_ratings/lib/create_organization_rating_comment.rb | 3 --- plugins/organization_ratings/lib/organization_rating.rb | 2 -- plugins/organization_ratings/lib/organization_ratings_config.rb | 3 --- plugins/people_block/lib/members_block.rb | 2 +- plugins/people_block/lib/people_block_base.rb | 1 - plugins/piwik/lib/ext/environment.rb | 1 - plugins/profile_members_headlines/lib/profile_members_headlines_block.rb | 2 -- plugins/recent_content/lib/recent_content_block.rb | 2 -- plugins/relevant_content/lib/relevant_content_plugin/relevant_content_block.rb | 2 -- plugins/require_auth_to_comment/lib/ext/profile.rb | 5 +---- plugins/send_email/lib/send_email_plugin/core_ext.rb | 4 ---- plugins/site_tour/lib/site_tour_plugin/tour_block.rb | 2 -- plugins/spaminator/lib/spaminator_plugin/report.rb | 2 -- plugins/spaminator/lib/spaminator_plugin/spaminator.rb | 7 +++---- plugins/statistics/lib/statistics_block.rb | 2 -- plugins/stoa/lib/ext/person.rb | 2 +- plugins/stoa/test/functional/account_controller_test.rb | 2 +- plugins/stoa/test/unit/usp_user_test.rb | 2 +- plugins/sub_organizations/lib/ext/organization.rb | 2 -- plugins/sub_organizations/lib/related_organizations_block.rb | 2 -- plugins/sub_organizations/lib/sub_organizations_plugin/approve_paternity_relation.rb | 2 -- plugins/sub_organizations/lib/sub_organizations_plugin/relation.rb | 2 -- plugins/suppliers/lib/ext/price_detail.rb | 8 -------- plugins/suppliers/lib/ext/product.rb | 6 ------ plugins/suppliers/models/suppliers_plugin/base_product.rb | 3 --- plugins/suppliers/models/suppliers_plugin/distributed_product.rb | 5 ----- plugins/suppliers/models/suppliers_plugin/source_product.rb | 2 -- plugins/suppliers/models/suppliers_plugin/supplier.rb | 2 -- plugins/tolerance_time/lib/tolerance_time_plugin/publication.rb | 2 +- plugins/tolerance_time/lib/tolerance_time_plugin/tolerance.rb | 2 +- plugins/video/lib/video_plugin/video_block.rb | 2 -- plugins/volunteers/lib/ext/profile.rb | 7 ------- plugins/volunteers/models/volunteers_plugin/assignment.rb | 2 -- plugins/volunteers/models/volunteers_plugin/period.rb | 6 ------ plugins/work_assignment/lib/work_assignment_plugin/work_assignment.rb | 21 +++++++-------------- plugins/work_assignment/test/functional/work_assignment_plugin_myprofile_controller_test.rb | 73 +++++++++++++++++++------------------------------------------------------ plugins/work_assignment/test/unit/work_assingment_plugin_test.rb | 34 ++++++++++++++-------------------- test/functional/content_viewer_controller_test.rb | 4 ++-- test/functional/profile_roles_controller_test.rb | 12 ++++++++---- test/support/factories.rb | 2 +- test/unit/acts_as_having_settings_test.rb | 1 - test/unit/profile_activity_test.rb | 1 - vendor/plugins/access_control/lib/role.rb | 6 ++++-- vendor/plugins/access_control/lib/role_assignment.rb | 2 -- vendor/plugins/access_control/test/acts_as_accessor_test.rb | 6 +----- vendor/plugins/access_control/test/role_assignment_test.rb | 8 ++------ vendor/plugins/access_control/test/role_test.rb | 6 ++---- vendor/plugins/access_control/test/test_helper.rb | 3 --- vendor/plugins/action_tracker/lib/action_tracker_model.rb | 1 - vendor/plugins/kandadaboggu-vote_fu/lib/models/vote.rb | 2 -- 173 files changed, 99 insertions(+), 530 deletions(-) delete mode 100644 config/initializers/03_protected_attributes.rb delete mode 100644 plugins/send_email/lib/send_email_plugin/core_ext.rb delete mode 100644 plugins/suppliers/lib/ext/price_detail.rb diff --git a/Gemfile b/Gemfile index d5e2fa1..f4f5142 100644 --- a/Gemfile +++ b/Gemfile @@ -49,7 +49,6 @@ gem 'sass-rails' gem 'sprockets-rails', '~> 2.1' # gems to enable rails3 behaviour -gem 'protected_attributes' gem 'rails-observers', github: 'rails/rails-observers' gem 'actionpack-page_caching' gem 'actionpack-action_caching' diff --git a/app/controllers/my_profile/cms_controller.rb b/app/controllers/my_profile/cms_controller.rb index b218b11..1b1c6fa 100644 --- a/app/controllers/my_profile/cms_controller.rb +++ b/app/controllers/my_profile/cms_controller.rb @@ -207,14 +207,11 @@ class CmsController < MyProfileController params[:uploaded_files].each do |file| unless file == '' @uploaded_files << UploadedFile.create( - { - :uploaded_data => file, - :profile => profile, - :parent => @parent, - :last_changed_by => user, - :author => user, - }, - :without_protection => true + uploaded_data: file, + profile: profile, + parent: @parent, + last_changed_by: user, + author: user, ) end end diff --git a/app/controllers/my_profile/manage_products_controller.rb b/app/controllers/my_profile/manage_products_controller.rb index 6e06d0a..5147112 100644 --- a/app/controllers/my_profile/manage_products_controller.rb +++ b/app/controllers/my_profile/manage_products_controller.rb @@ -86,7 +86,7 @@ class ManageProductsController < ApplicationController @edit = true @level = @category.level if request.post? - if @product.update({:product_category_id => params[:selected_category_id]}, :without_protection => true) + if @product.update product_category_id: params[:selected_category_id] render :partial => 'shared/redirect_via_javascript', :locals => { :url => url_for(:controller => 'manage_products', :action => 'show', :id => @product) } else diff --git a/app/controllers/my_profile/profile_roles_controller.rb b/app/controllers/my_profile/profile_roles_controller.rb index bfc8315..c7fb3d1 100644 --- a/app/controllers/my_profile/profile_roles_controller.rb +++ b/app/controllers/my_profile/profile_roles_controller.rb @@ -12,7 +12,7 @@ class ProfileRolesController < MyProfileController end def create - @role = Role.new({:name => params[:role][:name], :permissions => params[:role][:permissions], :environment => environment }, :without_protection => true) + @role = Role.new name: params[:role][:name], permissions: params[:role][:permissions], environment: environment if @role.save profile.custom_roles << @role redirect_to :action => 'show', :id => @role diff --git a/app/mailers/mailing.rb b/app/mailers/mailing.rb index 5995f0f..08d844c 100644 --- a/app/mailers/mailing.rb +++ b/app/mailers/mailing.rb @@ -4,8 +4,6 @@ class Mailing < ActiveRecord::Base acts_as_having_settings :field => :data - attr_accessible :subject, :body, :data - validates_presence_of :source_id, :subject, :body belongs_to :source, :foreign_key => :source_id, :polymorphic => true belongs_to :person diff --git a/app/models/abuse_report.rb b/app/models/abuse_report.rb index 07ec3c4..73f99fe 100644 --- a/app/models/abuse_report.rb +++ b/app/models/abuse_report.rb @@ -1,7 +1,5 @@ class AbuseReport < ActiveRecord::Base - attr_accessible :content, :reason - belongs_to :reporter, :class_name => 'Person' belongs_to :abuse_complaint has_many :reported_images, :dependent => :destroy diff --git a/app/models/action_tracker_notification.rb b/app/models/action_tracker_notification.rb index b84eb41..b8ef0cc 100644 --- a/app/models/action_tracker_notification.rb +++ b/app/models/action_tracker_notification.rb @@ -8,8 +8,6 @@ class ActionTrackerNotification < ActiveRecord::Base validates_presence_of :profile_id, :action_tracker_id validates_uniqueness_of :action_tracker_id, :scope => :profile_id - attr_accessible :profile_id, :action_tracker_id - end ActionTracker::Record.has_many :action_tracker_notifications, :class_name => 'ActionTrackerNotification', :foreign_key => 'action_tracker_id', :dependent => :destroy diff --git a/app/models/approve_comment.rb b/app/models/approve_comment.rb index 3cdab4e..80b7abc 100644 --- a/app/models/approve_comment.rb +++ b/app/models/approve_comment.rb @@ -8,7 +8,7 @@ class ApproveComment < Task def comment unless @comment || self.comment_attributes.nil? @comment = Comment.new - @comment.assign_attributes(ActiveSupport::JSON.decode(self.comment_attributes.to_s), :without_protection => true) + @comment.assign_attributes ActiveSupport::JSON.decode(self.comment_attributes.to_s) end @comment end diff --git a/app/models/article.rb b/app/models/article.rb index bcb805c..4b32cef 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -1,16 +1,6 @@ class Article < ActiveRecord::Base - attr_accessible :name, :body, :abstract, :profile, :tag_list, :parent, - :allow_members_to_edit, :translation_of_id, :language, - :license_id, :parent_id, :display_posts_in_current_language, - :category_ids, :posts_per_page, :moderate_comments, - :accept_comments, :feed, :published, :source, :source_name, - :highlighted, :notify_comments, :display_hits, :slug, - :external_feed_builder, :display_versions, :external_link, - :image_builder, :show_to_followers, - :author, :display_preview, :published_at, :person_followers - acts_as_having_image include Noosfero::Plugin::HotSpot diff --git a/app/models/article_block.rb b/app/models/article_block.rb index 1d36cb7..d1cf39e 100644 --- a/app/models/article_block.rb +++ b/app/models/article_block.rb @@ -1,7 +1,5 @@ class ArticleBlock < Block - attr_accessible :article_id - def self.description _('Display one of your contents.') end diff --git a/app/models/block.rb b/app/models/block.rb index d2fe631..7fe2791 100644 --- a/app/models/block.rb +++ b/app/models/block.rb @@ -1,9 +1,5 @@ class Block < ActiveRecord::Base - attr_accessible :title, :subtitle, :display, :limit, :box_id, :posts_per_page, - :visualization_format, :language, :display_user, - :box, :edit_modes, :move_modes, :mirror - include ActionView::Helpers::TagHelper # Block-specific stuff diff --git a/app/models/blog.rb b/app/models/blog.rb index cb4722e..7d36605 100644 --- a/app/models/blog.rb +++ b/app/models/blog.rb @@ -1,7 +1,5 @@ class Blog < Folder - attr_accessible :visualization_format - acts_as_having_posts include PostsLimit @@ -55,7 +53,7 @@ class Blog < Folder if self.external_feed(true) && self.external_feed.id == self.external_feed_data[:id].to_i self.external_feed.attributes = self.external_feed_data.except(:id) else - self.build_external_feed(self.external_feed_data, :without_protection => true) + self.build_external_feed self.external_feed_data end self.external_feed.valid? self.external_feed.errors.delete(:blog_id) # dont validate here relation: external_feed <-> blog diff --git a/app/models/box.rb b/app/models/box.rb index 45dad95..ed5ff2f 100644 --- a/app/models/box.rb +++ b/app/models/box.rb @@ -5,8 +5,6 @@ class Box < ActiveRecord::Base belongs_to :owner, :polymorphic => true has_many :blocks, -> { order 'position' }, dependent: :destroy - attr_accessible :owner - include Noosfero::Plugin::HotSpot scope :with_position, -> { where 'boxes.position > 0' } diff --git a/app/models/categories_block.rb b/app/models/categories_block.rb index 27bc072..b2defd7 100644 --- a/app/models/categories_block.rb +++ b/app/models/categories_block.rb @@ -8,8 +8,6 @@ class CategoriesBlock < Block settings_items :category_types, :type => Array, :default => [] - attr_accessible :category_types - def self.description _("Categories Menu") end diff --git a/app/models/category.rb b/app/models/category.rb index 07acc00..226942b 100644 --- a/app/models/category.rb +++ b/app/models/category.rb @@ -1,7 +1,5 @@ class Category < ActiveRecord::Base - attr_accessible :name, :parent_id, :display_color, :display_in_menu, :image_builder, :environment, :parent - SEARCHABLE_FIELDS = { :name => {:label => _('Name'), :weight => 10}, :acronym => {:label => _('Acronym'), :weight => 5}, diff --git a/app/models/certifier.rb b/app/models/certifier.rb index 0d5bd8c..79f9061 100644 --- a/app/models/certifier.rb +++ b/app/models/certifier.rb @@ -1,7 +1,5 @@ class Certifier < ActiveRecord::Base - attr_accessible :name, :environment - SEARCHABLE_FIELDS = { :name => {:label => _('Name'), :weight => 10}, :description => {:label => _('Description'), :weight => 3}, diff --git a/app/models/chat_message.rb b/app/models/chat_message.rb index 6a90d39..0ef3948 100644 --- a/app/models/chat_message.rb +++ b/app/models/chat_message.rb @@ -1,8 +1,8 @@ class ChatMessage < ActiveRecord::Base - attr_accessible :body, :from, :to belongs_to :to, :class_name => 'Profile' belongs_to :from, :class_name => 'Profile' validates_presence_of :from, :to + end diff --git a/app/models/city.rb b/app/models/city.rb index 4a21a00..0321ece 100644 --- a/app/models/city.rb +++ b/app/models/city.rb @@ -1,3 +1,3 @@ class City < Region - attr_accessible :name, :parent_id + end diff --git a/app/models/comment.rb b/app/models/comment.rb index 961c79a..e6a993c 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -6,8 +6,6 @@ class Comment < ActiveRecord::Base :body => {:label => _('Content'), :weight => 2}, } - attr_accessible :body, :author, :name, :email, :title, :reply_of_id, :source, :follow_article - validates_presence_of :body belongs_to :source, :counter_cache => true, :polymorphic => true diff --git a/app/models/communities_block.rb b/app/models/communities_block.rb index 0f2b190..8b873f0 100644 --- a/app/models/communities_block.rb +++ b/app/models/communities_block.rb @@ -1,7 +1,5 @@ class CommunitiesBlock < ProfileListBlock - attr_accessible :accessor_id, :accessor_type, :role_id, :resource_id, :resource_type - def self.description _("

Display all of your communities.

You could choose the amount of communities will be displayed and you could priorize that profiles with images.

The view all button is always present in the block.

") end diff --git a/app/models/community.rb b/app/models/community.rb index b4fb5cf..4ccdb3c 100644 --- a/app/models/community.rb +++ b/app/models/community.rb @@ -1,7 +1,5 @@ class Community < Organization - attr_accessible :accessor_id, :accessor_type, :role_id, :resource_id, :resource_type - attr_accessible :address_reference, :district, :tag_list, :language, :description after_destroy :check_invite_member_for_destroy def self.type_name diff --git a/app/models/create_community.rb b/app/models/create_community.rb index 1720ddd..0ff5a6d 100644 --- a/app/models/create_community.rb +++ b/app/models/create_community.rb @@ -9,15 +9,11 @@ class CreateCommunity < Task alias :environment :target alias :environment= :target= - attr_accessible :environment, :requestor, :target - attr_accessible :reject_explanation, :template_id - acts_as_having_image DATA_FIELDS = Community.fields + ['name', 'closed', 'description'] DATA_FIELDS.each do |field| settings_items field.to_sym - attr_accessible field.to_sym end settings_items :custom_values diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb index 1e7635a..f46512d 100644 --- a/app/models/custom_field.rb +++ b/app/models/custom_field.rb @@ -1,5 +1,5 @@ class CustomField < ActiveRecord::Base - attr_accessible :name, :default_value, :format, :extras, :customized_type, :active, :required, :signup, :environment, :moderation_task + serialize :customized_type serialize :extras has_many :custom_field_values, :dependent => :delete_all diff --git a/app/models/custom_field_value.rb b/app/models/custom_field_value.rb index cf776ad..a04cada 100644 --- a/app/models/custom_field_value.rb +++ b/app/models/custom_field_value.rb @@ -1,7 +1,8 @@ class CustomFieldValue < ActiveRecord::Base + belongs_to :custom_field belongs_to :customized, :polymorphic => true - attr_accessible :value, :public, :customized, :custom_field, :customized_type + validate :can_save? def can_save? diff --git a/app/models/domain.rb b/app/models/domain.rb index 59e9d6b..364a7f9 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -2,8 +2,6 @@ require 'noosfero/multi_tenancy' class Domain < ActiveRecord::Base - attr_accessible :name, :owner, :is_default - # relationships ############### diff --git a/app/models/enterprise.rb b/app/models/enterprise.rb index 10e5fcc..9da2394 100644 --- a/app/models/enterprise.rb +++ b/app/models/enterprise.rb @@ -2,8 +2,6 @@ # only enterprises can offer products and services. class Enterprise < Organization - attr_accessible :business_name, :address_reference, :district, :tag_list, :organization_website, :historic_and_current_context, :activities_short_description, :products_per_catalog_page - SEARCH_FILTERS = { :order => %w[more_recent more_popular more_active], :display => %w[compact full map] diff --git a/app/models/environment.rb b/app/models/environment.rb index b59dce4..1099029 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -3,18 +3,6 @@ # domains. class Environment < ActiveRecord::Base - attr_accessible :name, :is_default, :signup_welcome_text_subject, - :signup_welcome_text_body, :terms_of_use, - :message_for_disabled_enterprise, :news_amount_by_folder, - :default_language, :languages, :description, - :organization_approval_method, :enabled_plugins, - :enabled_features, :redirection_after_login, - :redirection_after_signup, :contact_email, :theme, - :reports_lower_bound, :noreply_email, - :signup_welcome_screen_body, :members_whitelist_enabled, - :members_whitelist, :highlighted_news_amount, - :portal_news_amount, :date_format, :signup_intro - has_many :users # allow roles use diff --git a/app/models/event.rb b/app/models/event.rb index 0dbe2e7..3352d40 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -3,8 +3,6 @@ require 'builder' class Event < Article - attr_accessible :start_date, :end_date, :link, :address - def self.type_name _('Event') end diff --git a/app/models/external_feed.rb b/app/models/external_feed.rb index e3111fd..7e04b15 100644 --- a/app/models/external_feed.rb +++ b/app/models/external_feed.rb @@ -10,8 +10,6 @@ class ExternalFeed < ActiveRecord::Base where '(fetched_at is NULL) OR (fetched_at < ?)', Time.now - FeedUpdater.update_interval } - attr_accessible :address, :enabled, :only_once - def add_item(title, link, date, content) return if content.blank? doc = Nokogiri::HTML.fragment content diff --git a/app/models/favorite_enterprise_person.rb b/app/models/favorite_enterprise_person.rb index 764dc2a..4ad111b 100644 --- a/app/models/favorite_enterprise_person.rb +++ b/app/models/favorite_enterprise_person.rb @@ -1,7 +1,5 @@ class FavoriteEnterprisePerson < ActiveRecord::Base - attr_accessible :person, :enterprise - track_actions :favorite_enterprise, :after_create, keep_params: [:enterprise_name, :enterprise_url], if: proc{ |f| f.is_trackable? } belongs_to :enterprise diff --git a/app/models/featured_products_block.rb b/app/models/featured_products_block.rb index b6fd1d1..b2da286 100644 --- a/app/models/featured_products_block.rb +++ b/app/models/featured_products_block.rb @@ -1,7 +1,5 @@ class FeaturedProductsBlock < Block - attr_accessible :product_ids, :groups_of, :speed, :reflect - settings_items :product_ids, :type => Array, :default => [] settings_items :groups_of, :type => :integer, :default => 3 settings_items :speed, :type => :integer, :default => 1000 diff --git a/app/models/feed_reader_block.rb b/app/models/feed_reader_block.rb index 6153c1b..bff2bea 100644 --- a/app/models/feed_reader_block.rb +++ b/app/models/feed_reader_block.rb @@ -1,7 +1,5 @@ class FeedReaderBlock < Block - attr_accessible :address, :update_errors - def initialize(attributes = nil, options = {}) data = attributes || {} super(data) diff --git a/app/models/forum.rb b/app/models/forum.rb index 07eb334..0fba005 100644 --- a/app/models/forum.rb +++ b/app/models/forum.rb @@ -3,8 +3,6 @@ class Forum < Folder acts_as_having_posts -> { reorder 'updated_at DESC' } include PostsLimit - attr_accessible :has_terms_of_use, :terms_of_use, :topic_creation - settings_items :terms_of_use, :type => :string, :default => "" settings_items :has_terms_of_use, :type => :boolean, :default => false settings_items :topic_creation, :type => :string, :default => 'self' diff --git a/app/models/highlights_block.rb b/app/models/highlights_block.rb index 2884367..fcfe5fe 100644 --- a/app/models/highlights_block.rb +++ b/app/models/highlights_block.rb @@ -1,7 +1,5 @@ class HighlightsBlock < Block - attr_accessible :images, :interval, :shuffle, :navigation - settings_items :images, :type => Array, :default => [] settings_items :interval, :type => 'integer', :default => 4 settings_items :shuffle, :type => 'boolean', :default => false diff --git a/app/models/image.rb b/app/models/image.rb index f46778c..4d08f50 100644 --- a/app/models/image.rb +++ b/app/models/image.rb @@ -1,6 +1,5 @@ class Image < ActiveRecord::Base - attr_accessible :uploaded_data, :label, :remove_image attr_accessor :remove_image def self.max_size diff --git a/app/models/input.rb b/app/models/input.rb index ba6dfb2..12dfe8b 100644 --- a/app/models/input.rb +++ b/app/models/input.rb @@ -1,8 +1,5 @@ class Input < ActiveRecord::Base - attr_accessible :product, :product_id, :product_category, :product_category_id, - :amount_used, :unit_id, :price_per_unit, :relevant_to_price, :is_from_solidarity_economy - belongs_to :product belongs_to :product_category diff --git a/app/models/license.rb b/app/models/license.rb index 6e25375..4f1ddff 100644 --- a/app/models/license.rb +++ b/app/models/license.rb @@ -1,7 +1,5 @@ class License < ActiveRecord::Base - attr_accessible :name, :url - SEARCHABLE_FIELDS = { :name => {:label => _('Name'), :weight => 10}, :url => {:label => _('URL'), :weight => 5}, @@ -14,8 +12,6 @@ class License < ActiveRecord::Base validates_presence_of :slug, :if => lambda {|license| license.name.present?} validates_uniqueness_of :slug, :scope => :environment_id - attr_accessible :environment, :slug - before_validation do |license| license.slug ||= license.name.to_slug if license.name.present? end diff --git a/app/models/link_article.rb b/app/models/link_article.rb index ccd4b56..d28ff9f 100644 --- a/app/models/link_article.rb +++ b/app/models/link_article.rb @@ -1,7 +1,5 @@ class LinkArticle < Article - attr_accessible :reference_article - def self.short_description "Article link" end diff --git a/app/models/link_list_block.rb b/app/models/link_list_block.rb index c17a747..6dbbb25 100644 --- a/app/models/link_list_block.rb +++ b/app/models/link_list_block.rb @@ -1,7 +1,5 @@ class LinkListBlock < Block - attr_accessible :links - ICONS = [ ['no-icon', _('(No icon)')], ['edit', N_('Edit')], diff --git a/app/models/location_block.rb b/app/models/location_block.rb index aa41301..a39a420 100644 --- a/app/models/location_block.rb +++ b/app/models/location_block.rb @@ -1,7 +1,5 @@ class LocationBlock < Block - attr_accessible :zoom, :map_type - settings_items :zoom, :type => :integer, :default => 4 settings_items :map_type, :type => :string, :default => 'roadmap' diff --git a/app/models/mailing_sent.rb b/app/models/mailing_sent.rb index 67c2032..367dcfe 100644 --- a/app/models/mailing_sent.rb +++ b/app/models/mailing_sent.rb @@ -1,5 +1,6 @@ class MailingSent < ActiveRecord::Base - attr_accessible :person + belongs_to :mailing belongs_to :person + end diff --git a/app/models/my_network_block.rb b/app/models/my_network_block.rb index 7153602..8ca37af 100644 --- a/app/models/my_network_block.rb +++ b/app/models/my_network_block.rb @@ -1,7 +1,5 @@ class MyNetworkBlock < Block - attr_accessible :display, :box - def self.description _('My network') end diff --git a/app/models/organization.rb b/app/models/organization.rb index 220b30d..eb850af 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -1,8 +1,6 @@ # Represents any organization of the system class Organization < Profile - attr_accessible :moderated_articles, :foundation_year, :contact_person, :acronym, :legal_form, :economic_activity, :management_information, :cnpj, :display_name, :enable_contact_us - SEARCH_FILTERS = { :order => %w[more_recent more_popular more_active], :display => %w[compact] diff --git a/app/models/person.rb b/app/models/person.rb index ff8bd41..4fd568d 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -1,14 +1,11 @@ # A person is the profile of an user holding all relationships with the rest of the system class Person < Profile - 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 - SEARCH_FILTERS = { :order => %w[more_recent more_popular more_active], :display => %w[compact] } - def self.type_name _('Person') end diff --git a/app/models/price_detail.rb b/app/models/price_detail.rb index d0c0f03..958c1a5 100644 --- a/app/models/price_detail.rb +++ b/app/models/price_detail.rb @@ -1,7 +1,5 @@ class PriceDetail < ActiveRecord::Base - attr_accessible :price, :production_cost_id - belongs_to :product validates_presence_of :product_id diff --git a/app/models/product.rb b/app/models/product.rb index e47610b..42e8686 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -10,9 +10,6 @@ class Product < ActiveRecord::Base :display => %w[full map] } - attr_accessible :name, :product_category, :profile, :profile_id, :enterprise, - :highlighted, :price, :image_builder, :description, :available, :qualifiers, :unit_id, :discount, :inputs, :qualifiers_list - def self.default_search_display 'full' end diff --git a/app/models/product_category.rb b/app/models/product_category.rb index e1bccd5..90f583e 100644 --- a/app/models/product_category.rb +++ b/app/models/product_category.rb @@ -3,8 +3,6 @@ class ProductCategory < Category has_many :products has_many :inputs - attr_accessible :name, :parent, :environment - scope :unique, -> { select 'DISTINCT ON (path) categories.*' } scope :by_enterprise, -> enterprise { distinct.joins(:products). diff --git a/app/models/product_qualifier.rb b/app/models/product_qualifier.rb index 9a2fd57..69ebe1d 100644 --- a/app/models/product_qualifier.rb +++ b/app/models/product_qualifier.rb @@ -1,8 +1,7 @@ class ProductQualifier < ActiveRecord::Base - attr_accessible :qualifier, :product, :certifier - belongs_to :qualifier belongs_to :product belongs_to :certifier + end diff --git a/app/models/production_cost.rb b/app/models/production_cost.rb index f0df85b..0f80cdc 100644 --- a/app/models/production_cost.rb +++ b/app/models/production_cost.rb @@ -1,8 +1,7 @@ class ProductionCost < ActiveRecord::Base - attr_accessible :name, :owner - belongs_to :owner, :polymorphic => true + validates_presence_of :owner validates_presence_of :name validates_length_of :name, :maximum => 30, :allow_blank => true diff --git a/app/models/products_block.rb b/app/models/products_block.rb index bb80037..90c5f1e 100644 --- a/app/models/products_block.rb +++ b/app/models/products_block.rb @@ -1,7 +1,5 @@ class ProductsBlock < Block - attr_accessible :product_ids - include ActionView::Helpers::TagHelper include ActionView::Helpers::UrlHelper include ActionView::Helpers diff --git a/app/models/profile.rb b/app/models/profile.rb index d99354a..93f285e 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -3,10 +3,6 @@ # which by default is the one returned by Environment:default. class Profile < ActiveRecord::Base - 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, - :redirection_after_login, :custom_url_redirection, - :email_suggestions, :allow_members_to_invite, :invite_friends_only, :secret, :profile_admin_mail_notification - # use for internationalizable human type names in search facets # reimplement on subclasses def self.type_name diff --git a/app/models/profile_activity.rb b/app/models/profile_activity.rb index 8d87fb0..ee45be7 100644 --- a/app/models/profile_activity.rb +++ b/app/models/profile_activity.rb @@ -2,9 +2,6 @@ class ProfileActivity < ActiveRecord::Base self.record_timestamps = false - attr_accessible :profile_id, - :profile, :activity - belongs_to :profile belongs_to :activity, polymorphic: true diff --git a/app/models/profile_image_block.rb b/app/models/profile_image_block.rb index 767cc98..e05c218 100644 --- a/app/models/profile_image_block.rb +++ b/app/models/profile_image_block.rb @@ -1,7 +1,5 @@ class ProfileImageBlock < Block - attr_accessible :show_name - settings_items :show_name, :type => :boolean, :default => false def self.description diff --git a/app/models/profile_list_block.rb b/app/models/profile_list_block.rb index 4bf02ff..68b5b42 100644 --- a/app/models/profile_list_block.rb +++ b/app/models/profile_list_block.rb @@ -1,7 +1,5 @@ class ProfileListBlock < Block - attr_accessible :prioritize_profiles_with_image - settings_items :limit, :type => :integer, :default => 6 settings_items :prioritize_profiles_with_image, :type => :boolean, :default => true diff --git a/app/models/profile_suggestion.rb b/app/models/profile_suggestion.rb index 41ee7ce..e0fd18f 100644 --- a/app/models/profile_suggestion.rb +++ b/app/models/profile_suggestion.rb @@ -1,9 +1,8 @@ class ProfileSuggestion < ActiveRecord::Base + belongs_to :person belongs_to :suggestion, :class_name => 'Profile', :foreign_key => :suggestion_id - attr_accessible :person, :suggestion, :suggestion_type, :categories, :enabled - has_many :suggestion_connections, :foreign_key => 'suggestion_id' has_many :profile_connections, :through => :suggestion_connections, :source => :connection, :source_type => 'Profile' has_many :tag_connections, :through => :suggestion_connections, :source => :connection, :source_type => 'ActsAsTaggableOn::Tag' @@ -67,7 +66,6 @@ class ProfileSuggestion < ActiveRecord::Base RULES.keys.each do |rule| settings_items rule - attr_accessible rule end # Number of suggestions by rule diff --git a/app/models/qualifier.rb b/app/models/qualifier.rb index 7601bf4..03777b9 100644 --- a/app/models/qualifier.rb +++ b/app/models/qualifier.rb @@ -1,7 +1,5 @@ class Qualifier < ActiveRecord::Base - attr_accessible :name, :environment - SEARCHABLE_FIELDS = { :name => {:label => _('Name'), :weight => 1}, } diff --git a/app/models/raw_html_block.rb b/app/models/raw_html_block.rb index 905e5aa..89af91d 100644 --- a/app/models/raw_html_block.rb +++ b/app/models/raw_html_block.rb @@ -10,8 +10,6 @@ class RawHTMLBlock < Block settings_items :html, :type => :text - attr_accessible :html - def has_macro? true end diff --git a/app/models/region.rb b/app/models/region.rb index 36e7128..b5e9645 100644 --- a/app/models/region.rb +++ b/app/models/region.rb @@ -1,8 +1,6 @@ # Region is a special type of category that is related to geographical issues. class Region < Category - attr_accessible :name - has_and_belongs_to_many :validators, :class_name => 'Organization', :join_table => :region_validators require_dependency 'enterprise' # enterprises can also be validators diff --git a/app/models/rss_feed.rb b/app/models/rss_feed.rb index a862261..bb11119 100644 --- a/app/models/rss_feed.rb +++ b/app/models/rss_feed.rb @@ -1,7 +1,5 @@ class RssFeed < Article - attr_accessible :limit, :enabled, :language, :include, :feed_item_description - def self.type_name _('RssFeed') end diff --git a/app/models/scrap.rb b/app/models/scrap.rb index 3e5a60c..bfb25a1 100644 --- a/app/models/scrap.rb +++ b/app/models/scrap.rb @@ -1,7 +1,5 @@ class Scrap < ActiveRecord::Base - attr_accessible :content, :sender_id, :receiver_id, :scrap_id - SEARCHABLE_FIELDS = { :content => {:label => _('Content'), :weight => 1}, } diff --git a/app/models/search_term.rb b/app/models/search_term.rb index 2b62c74..ae0813e 100644 --- a/app/models/search_term.rb +++ b/app/models/search_term.rb @@ -5,8 +5,6 @@ class SearchTerm < ActiveRecord::Base belongs_to :context, :polymorphic => true has_many :occurrences, :class_name => 'SearchTermOccurrence' - attr_accessible :term, :context, :asset - def self.calculate_scores os = occurrences_scores find_each { |search_term| search_term.calculate_score(os) } diff --git a/app/models/search_term_occurrence.rb b/app/models/search_term_occurrence.rb index 83c64e5..29208f2 100644 --- a/app/models/search_term_occurrence.rb +++ b/app/models/search_term_occurrence.rb @@ -2,7 +2,6 @@ class SearchTermOccurrence < ActiveRecord::Base belongs_to :search_term validates_presence_of :search_term - attr_accessible :search_term, :created_at, :total, :indexed EXPIRATION_TIME = 1.year diff --git a/app/models/sellers_search_block.rb b/app/models/sellers_search_block.rb index 085f92b..647d05e 100644 --- a/app/models/sellers_search_block.rb +++ b/app/models/sellers_search_block.rb @@ -1,7 +1,5 @@ class SellersSearchBlock < Block - attr_accessible :title - def self.description _('Search for enterprises and products') end diff --git a/app/models/slideshow_block.rb b/app/models/slideshow_block.rb index ecafb93..5277414 100644 --- a/app/models/slideshow_block.rb +++ b/app/models/slideshow_block.rb @@ -6,8 +6,6 @@ class SlideshowBlock < Block settings_items :navigation, :type => 'boolean', :default => false settings_items :image_size, :type => 'string', :default => 'thumb' - attr_accessible :gallery_id, :image_size, :interval, :shuffle, :navigation - def self.description _('Slideshow') end diff --git a/app/models/state.rb b/app/models/state.rb index 6b22335..e7b3a87 100644 --- a/app/models/state.rb +++ b/app/models/state.rb @@ -1,3 +1,3 @@ class State < Region - attr_accessible :name, :acronym, :environment + end diff --git a/app/models/suggestion_connection.rb b/app/models/suggestion_connection.rb index 93f17c2..9af9b71 100644 --- a/app/models/suggestion_connection.rb +++ b/app/models/suggestion_connection.rb @@ -1,6 +1,6 @@ class SuggestionConnection < ActiveRecord::Base - attr_accessible :suggestion, :suggestion_id, :connection_type, :connection_id belongs_to :suggestion, :class_name => 'ProfileSuggestion', :foreign_key => 'suggestion_id' belongs_to :connection, :polymorphic => true + end diff --git a/app/models/tag.rb b/app/models/tag.rb index 53e53fd..9b1d913 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -1,8 +1,6 @@ Tag = ActsAsTaggableOn::Tag class Tag - attr_accessible :name, :parent_id, :pending - has_many :children, class_name: 'Tag', foreign_key: 'parent_id', dependent: :destroy @@original_find = self.method(:find) diff --git a/app/models/task.rb b/app/models/task.rb index cd867fa..4aa3e0a 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -41,8 +41,6 @@ class Task < ActiveRecord::Base validates_uniqueness_of :code, :on => :create validates_presence_of :code - attr_protected :status - settings_items :email_template_id, :type => :integer def initialize(*args) diff --git a/app/models/thumbnail.rb b/app/models/thumbnail.rb index 1c844b3..8186afa 100644 --- a/app/models/thumbnail.rb +++ b/app/models/thumbnail.rb @@ -1,9 +1,5 @@ class Thumbnail < ActiveRecord::Base - attr_accessible :uploaded_data - # mass assigned by attachment_fu - attr_accessible :content_type, :filename, :thumbnail_resize_options, :thumbnail, :parent_id - has_attachment :storage => :file_system, :content_type => :image, :max_size => UploadedFile.max_size, processor: 'Rmagick' validates_as_attachment diff --git a/app/models/unit.rb b/app/models/unit.rb index 5faaa01..9ffecac 100644 --- a/app/models/unit.rb +++ b/app/models/unit.rb @@ -2,8 +2,6 @@ class Unit < ActiveRecord::Base acts_as_list scope: -> unit { where environment_id: unit.environment_id } - attr_accessible :name, :singular, :plural, :environment - validates_presence_of :singular validates_presence_of :plural diff --git a/app/models/uploaded_file.rb b/app/models/uploaded_file.rb index 2d3a380..e705432 100644 --- a/app/models/uploaded_file.rb +++ b/app/models/uploaded_file.rb @@ -7,8 +7,6 @@ require 'sdbm' class UploadedFile < Article - attr_accessible :uploaded_data, :title - def self.type_name _('File') end diff --git a/app/models/user.rb b/app/models/user.rb index 1eff6aa..af364f6 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -6,8 +6,6 @@ require 'securerandom' # Rails generator. class User < ActiveRecord::Base - attr_accessible :login, :email, :password, :password_confirmation, :activated_at - N_('Password') N_('Password confirmation') N_('Terms accepted') @@ -110,8 +108,6 @@ class User < ActiveRecord::Base # holds the current session, see lib/authenticated_system.rb attr_accessor :session - attr_protected :activated_at - # Virtual attribute for the unencrypted password attr_accessor :password, :name diff --git a/app/models/validation_info.rb b/app/models/validation_info.rb index 06ab25a..275abaf 100644 --- a/app/models/validation_info.rb +++ b/app/models/validation_info.rb @@ -1,7 +1,5 @@ class ValidationInfo < ActiveRecord::Base - attr_accessible :validation_methodology, :restrictions, :organization - belongs_to :organization validates_presence_of :organization diff --git a/config/application.rb b/config/application.rb index 9ff2c90..8f23668 100644 --- a/config/application.rb +++ b/config/application.rb @@ -72,12 +72,6 @@ module Noosfero # like if you have constraints or database-specific column types # config.active_record.schema_format = :sql - # Enforce whitelist mode for mass assignment. - # This will create an empty whitelist of attributes available for mass-assignment for all models - # in your app. As such, your models will need to explicitly whitelist or blacklist accessible - # parameters by using an attr_accessible or attr_protected declaration. - config.active_record.whitelist_attributes = true - # Asset pipeline config.assets.paths = Dir.glob("app/assets/plugins/*/{,stylesheets,javascripts}") + diff --git a/config/environments/development.rb b/config/environments/development.rb index 2476706..df2d8c8 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -20,9 +20,6 @@ Noosfero::Application.configure do # Only use best-standards-support built into browsers config.action_dispatch.best_standards_support = :builtin - # Raise exception on mass assignment protection for Active Record models - config.active_record.mass_assignment_sanitizer = :strict - # Do not compress assets config.assets.compress = false config.assets.digest = false diff --git a/config/environments/test.rb b/config/environments/test.rb index 89cb5ea..e850770 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -25,9 +25,6 @@ Noosfero::Application.configure do # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test - # Raise exception on mass assignment protection for Active Record models - config.active_record.mass_assignment_sanitizer = :strict - # Print deprecation notices to the stderr config.active_support.deprecation = :stderr end diff --git a/config/initializers/03_protected_attributes.rb b/config/initializers/03_protected_attributes.rb deleted file mode 100644 index 8a20ea3..0000000 --- a/config/initializers/03_protected_attributes.rb +++ /dev/null @@ -1,6 +0,0 @@ -class Delayed::Backend::ActiveRecord::Job - # rake db:schema:load run? - if self.table_exists? - attr_accessible *self.column_names, :payload_object - end -end diff --git a/features/step_definitions/noosfero_steps.rb b/features/step_definitions/noosfero_steps.rb index 619f580..82c6fa5 100644 --- a/features/step_definitions/noosfero_steps.rb +++ b/features/step_definitions/noosfero_steps.rb @@ -31,7 +31,7 @@ Given /^the following (community|communities|enterprises?|organizations?)$/ do | category = row.delete("category") img_name = row.delete("img") city = row.delete("region") - organization = klass.create!(row, :without_protection => true) + organization = klass.create! row if owner organization.add_admin(Profile[owner]) end @@ -204,7 +204,7 @@ Given /^the following products?$/ do |table| qualifier = Qualifier.find_by name: data.delete("qualifier") data.merge!(:qualifiers => [qualifier]) end - product = Product.create!(data, :without_protection => true) + product = Product.create! data end end @@ -215,8 +215,8 @@ Given /^the following inputs?$/ do |table| category = Category.find_by slug: data.delete("category").to_slug unit = Unit.find_by singular: data.delete("unit") solidary = data.delete("solidary") - input = Input.create!(data.merge(:product => product, :product_category => category, :unit => unit, - :is_from_solidarity_economy => solidary), :without_protection => true) + input = Input.create! data.merge(product: product, product_category: category, unit: unit, + is_from_solidarity_economy: solidary) input.update_attribute(:position, data['position']) end end @@ -254,7 +254,7 @@ end Given /^the following qualifiers$/ do |table| table.hashes.each do |row| - Qualifier.create!(row.merge(:environment_id => 1), :without_protection => true) + Qualifier.create! row.merge(environment_id: 1) end end @@ -265,7 +265,7 @@ Given /^the following certifiers$/ do |table| if qualifiers_list row["qualifiers"] = qualifiers_list.split(', ').map{|i| Qualifier.find_by name: i } end - Certifier.create!(row.merge(:environment_id => 1), :without_protection => true) + Certifier.create! row.merge(environment_id: 1) end end @@ -505,7 +505,7 @@ end Given /^the following units?$/ do |table| table.hashes.each do |row| - Unit.create!(row.merge(:environment_id => 1), :without_protection => true) + Unit.create! row.merge(environment_id: 1) end end diff --git a/lib/acts_as_customizable.rb b/lib/acts_as_customizable.rb index 5e73b91..72ef3b3 100644 --- a/lib/acts_as_customizable.rb +++ b/lib/acts_as_customizable.rb @@ -1,7 +1,6 @@ module Customizable def self.included(base) - base.attr_accessible :custom_values base.extend ClassMethods end diff --git a/lib/acts_as_having_image.rb b/lib/acts_as_having_image.rb index b62af0c..cfe0076 100644 --- a/lib/acts_as_having_image.rb +++ b/lib/acts_as_having_image.rb @@ -5,7 +5,6 @@ module ActsAsHavingImage belongs_to :image, dependent: :destroy scope :with_image, -> { where "#{table_name}.image_id IS NOT NULL" } scope :without_image, -> { where "#{table_name}.image_id IS NULL" } - attr_accessible :image_builder include ActsAsHavingImage end end diff --git a/plugins/analytics/models/analytics_plugin/page_view.rb b/plugins/analytics/models/analytics_plugin/page_view.rb index ac9b91d..d54512f 100644 --- a/plugins/analytics/models/analytics_plugin/page_view.rb +++ b/plugins/analytics/models/analytics_plugin/page_view.rb @@ -2,11 +2,7 @@ class AnalyticsPlugin::PageView < ActiveRecord::Base serialize :data - attr_accessible *self.column_names - attr_accessible :user, :profile - attr_accessor :request - attr_accessible :request acts_as_having_settings field: :options diff --git a/plugins/analytics/models/analytics_plugin/visit.rb b/plugins/analytics/models/analytics_plugin/visit.rb index d65f4f7..4405456 100644 --- a/plugins/analytics/models/analytics_plugin/visit.rb +++ b/plugins/analytics/models/analytics_plugin/visit.rb @@ -1,8 +1,5 @@ class AnalyticsPlugin::Visit < ActiveRecord::Base - attr_accessible *self.column_names - attr_accessible :profile - belongs_to :profile has_many :page_views, class_name: 'AnalyticsPlugin::PageView', dependent: :destroy diff --git a/plugins/breadcrumbs/lib/breadcrumbs_plugin/content_breadcrumbs_block.rb b/plugins/breadcrumbs/lib/breadcrumbs_plugin/content_breadcrumbs_block.rb index 194db19..d41f605 100644 --- a/plugins/breadcrumbs/lib/breadcrumbs_plugin/content_breadcrumbs_block.rb +++ b/plugins/breadcrumbs/lib/breadcrumbs_plugin/content_breadcrumbs_block.rb @@ -4,8 +4,6 @@ class BreadcrumbsPlugin::ContentBreadcrumbsBlock < Block settings_items :show_profile, :type => :boolean, :default => true settings_items :show_section_name, :type => :boolean, :default => true - attr_accessible :show_cms_action, :show_profile, :show_section_name - def self.description _("

Display a breadcrumb of the current content navigation.

You could choose if the breadcrumb is going to appear in the cms editing or not.

There is either the option of display the profile location in the breadcrumb path.

") end diff --git a/plugins/comment_classification/lib/comment_classification_plugin/comment_label_user.rb b/plugins/comment_classification/lib/comment_classification_plugin/comment_label_user.rb index b4c16e5..a50595e 100644 --- a/plugins/comment_classification/lib/comment_classification_plugin/comment_label_user.rb +++ b/plugins/comment_classification/lib/comment_classification_plugin/comment_label_user.rb @@ -5,8 +5,6 @@ class CommentClassificationPlugin::CommentLabelUser < ActiveRecord::Base belongs_to :comment belongs_to :label, :class_name => 'CommentClassificationPlugin::Label' - attr_accessible :profile, :comment, :label - validates_presence_of :profile validates_presence_of :comment validates_presence_of :label diff --git a/plugins/comment_classification/lib/comment_classification_plugin/comment_status_user.rb b/plugins/comment_classification/lib/comment_classification_plugin/comment_status_user.rb index 1437cfb..f63444c 100644 --- a/plugins/comment_classification/lib/comment_classification_plugin/comment_status_user.rb +++ b/plugins/comment_classification/lib/comment_classification_plugin/comment_status_user.rb @@ -5,8 +5,6 @@ class CommentClassificationPlugin::CommentStatusUser < ActiveRecord::Base belongs_to :comment belongs_to :status, :class_name => 'CommentClassificationPlugin::Status' - attr_accessible :name, :enabled, :profile, :comment, :status_id, :reason - validates_presence_of :profile validates_presence_of :comment validates_presence_of :status diff --git a/plugins/comment_classification/lib/comment_classification_plugin/label.rb b/plugins/comment_classification/lib/comment_classification_plugin/label.rb index 405cfb2..048fd20 100644 --- a/plugins/comment_classification/lib/comment_classification_plugin/label.rb +++ b/plugins/comment_classification/lib/comment_classification_plugin/label.rb @@ -6,8 +6,6 @@ class CommentClassificationPlugin::Label < ActiveRecord::Base scope :enabled, -> { where enabled: true } - attr_accessible :name, :enabled, :color - COLORS = ['red', 'green', 'yellow', 'gray', 'blue'] end diff --git a/plugins/comment_classification/lib/comment_classification_plugin/status.rb b/plugins/comment_classification/lib/comment_classification_plugin/status.rb index 7fa1f5e..6ac78ed 100644 --- a/plugins/comment_classification/lib/comment_classification_plugin/status.rb +++ b/plugins/comment_classification/lib/comment_classification_plugin/status.rb @@ -2,8 +2,6 @@ class CommentClassificationPlugin::Status < ActiveRecord::Base belongs_to :owner, :polymorphic => true - attr_accessible :name, :enabled - validates_presence_of :name scope :enabled, -> { where enabled: true } diff --git a/plugins/comment_group/lib/ext/comment.rb b/plugins/comment_group/lib/ext/comment.rb index b29cc5a..0ec18b9 100644 --- a/plugins/comment_group/lib/ext/comment.rb +++ b/plugins/comment_group/lib/ext/comment.rb @@ -6,6 +6,4 @@ class Comment scope :in_group, -> group_id { where 'group_id = ?', group_id } - attr_accessible :group_id - end diff --git a/plugins/comment_paragraph/lib/ext/comment.rb b/plugins/comment_paragraph/lib/ext/comment.rb index 16f4abf..b1944c5 100644 --- a/plugins/comment_paragraph/lib/ext/comment.rb +++ b/plugins/comment_paragraph/lib/ext/comment.rb @@ -11,8 +11,6 @@ class Comment where 'paragraph_uuid = ?', paragraph_uuid } - attr_accessible :paragraph_uuid, :comment_paragraph_selected_area, :id, :comment_paragraph_selected_content - before_validation do |comment| comment.comment_paragraph_selected_area = nil if comment.comment_paragraph_selected_area.blank? comment.comment_paragraph_selected_content = nil if comment_paragraph_selected_content.blank? diff --git a/plugins/community_track/lib/community_track_plugin/step.rb b/plugins/community_track/lib/community_track_plugin/step.rb index 3848a4b..e0276d2 100644 --- a/plugins/community_track/lib/community_track_plugin/step.rb +++ b/plugins/community_track/lib/community_track_plugin/step.rb @@ -3,8 +3,6 @@ class CommunityTrackPlugin::Step < Folder settings_items :hidden, :type => :boolean, :default => false settings_items :tool_type, :type => String - attr_accessible :start_date, :end_date, :tool_type, :hidden - alias :tools :children acts_as_list scope: -> step { where parent_id: step.parent_id } diff --git a/plugins/community_track/lib/community_track_plugin/track.rb b/plugins/community_track/lib/community_track_plugin/track.rb index 68affd1..19e8ad6 100644 --- a/plugins/community_track/lib/community_track_plugin/track.rb +++ b/plugins/community_track/lib/community_track_plugin/track.rb @@ -5,8 +5,6 @@ class CommunityTrackPlugin::Track < Folder validate :validate_categories - attr_accessible :goals, :expected_results - def comments_count @comments_count = sum_children_comments self unless @comments_count @comments_count diff --git a/plugins/context_content/lib/context_content_plugin/context_content_block.rb b/plugins/context_content/lib/context_content_plugin/context_content_block.rb index 22f1aed..99edc6a 100644 --- a/plugins/context_content/lib/context_content_plugin/context_content_block.rb +++ b/plugins/context_content/lib/context_content_plugin/context_content_block.rb @@ -7,8 +7,6 @@ class ContextContentPlugin::ContextContentBlock < Block settings_items :types, :type => Array, :default => ['UploadedFile'] settings_items :limit, :type => :integer, :default => 6 - attr_accessible :show_image, :show_name, :use_parent_title, :show_parent_content, :types - alias :profile :owner include Noosfero::Plugin::HotSpot diff --git a/plugins/custom_forms/lib/custom_forms_plugin/alternative.rb b/plugins/custom_forms/lib/custom_forms_plugin/alternative.rb index 7090ac1..ff86bae 100644 --- a/plugins/custom_forms/lib/custom_forms_plugin/alternative.rb +++ b/plugins/custom_forms/lib/custom_forms_plugin/alternative.rb @@ -5,6 +5,5 @@ class CustomFormsPlugin::Alternative < ActiveRecord::Base belongs_to :field, :class_name => 'CustomFormsPlugin::Field' - attr_accessible :label, :field, :position, :selected_by_default end diff --git a/plugins/custom_forms/lib/custom_forms_plugin/answer.rb b/plugins/custom_forms/lib/custom_forms_plugin/answer.rb index e1c29c4..6bcb080 100644 --- a/plugins/custom_forms/lib/custom_forms_plugin/answer.rb +++ b/plugins/custom_forms/lib/custom_forms_plugin/answer.rb @@ -6,8 +6,6 @@ class CustomFormsPlugin::Answer < ActiveRecord::Base validates_presence_of :field validate :value_mandatory, :if => 'field.present?' - attr_accessible :field, :value, :submission - def value_mandatory if field.mandatory && value.blank? errors.add(:value, _("is mandatory.").fix_i18n) diff --git a/plugins/custom_forms/lib/custom_forms_plugin/field.rb b/plugins/custom_forms/lib/custom_forms_plugin/field.rb index 76c9401..4577654 100644 --- a/plugins/custom_forms/lib/custom_forms_plugin/field.rb +++ b/plugins/custom_forms/lib/custom_forms_plugin/field.rb @@ -4,8 +4,6 @@ class CustomFormsPlugin::Field < ActiveRecord::Base validates_presence_of :name validates_length_of :default_value, :maximum => 255 - attr_accessible :name, :form, :mandatory, :type, :position, :default_value, :show_as, :alternatives_attributes - belongs_to :form, :class_name => 'CustomFormsPlugin::Form' has_many :answers, :class_name => 'CustomFormsPlugin::Answer', :dependent => :destroy diff --git a/plugins/custom_forms/lib/custom_forms_plugin/form.rb b/plugins/custom_forms/lib/custom_forms_plugin/form.rb index 1678fa7..1965b31 100644 --- a/plugins/custom_forms/lib/custom_forms_plugin/form.rb +++ b/plugins/custom_forms/lib/custom_forms_plugin/form.rb @@ -14,8 +14,6 @@ class CustomFormsPlugin::Form < ActiveRecord::Base validate :period_range, :if => Proc.new { |f| f.begining.present? && f.ending.present? } validate :access_format - attr_accessible :name, :profile, :for_admission, :access, :begining, :ending, :description, :fields_attributes, :profile_id, :on_membership - before_validation do |form| form.slug = form.name.to_slug if form.name.present? form.access = nil if form.access.blank? diff --git a/plugins/custom_forms/lib/custom_forms_plugin/submission.rb b/plugins/custom_forms/lib/custom_forms_plugin/submission.rb index 8cfb5d3..a0fedd9 100644 --- a/plugins/custom_forms/lib/custom_forms_plugin/submission.rb +++ b/plugins/custom_forms/lib/custom_forms_plugin/submission.rb @@ -6,8 +6,6 @@ class CustomFormsPlugin::Submission < ActiveRecord::Base # validation is done manually, see below has_many :answers, :class_name => 'CustomFormsPlugin::Answer', :dependent => :destroy, :validate => false - attr_accessible :form, :profile, :author_name, :author_email - validates_presence_of :form validates_presence_of :author_name, :author_email, :if => lambda {|submission| submission.profile.nil?} validates_uniqueness_of :author_email, :scope => :form_id, :allow_nil => true diff --git a/plugins/delivery/models/delivery_plugin/method.rb b/plugins/delivery/models/delivery_plugin/method.rb index 9f03c00..9d79f61 100644 --- a/plugins/delivery/models/delivery_plugin/method.rb +++ b/plugins/delivery/models/delivery_plugin/method.rb @@ -7,9 +7,6 @@ class DeliveryPlugin::Method < ActiveRecord::Base address address_line2 address_reference district city state country_name zip_code ].map(&:to_sym) - attr_accessible :profile, :delivery_type, :name, :description, - :fixed_cost, :free_over_price, :distribution_margin_percentage, :distribution_margin_fixed - belongs_to :profile has_many :delivery_options, class_name: 'DeliveryPlugin::Option', foreign_key: :delivery_method_id, dependent: :destroy diff --git a/plugins/delivery/models/delivery_plugin/option.rb b/plugins/delivery/models/delivery_plugin/option.rb index 12998d7..43d55a8 100644 --- a/plugins/delivery/models/delivery_plugin/option.rb +++ b/plugins/delivery/models/delivery_plugin/option.rb @@ -6,6 +6,4 @@ class DeliveryPlugin::Option < ActiveRecord::Base validates_presence_of :delivery_method validates_presence_of :owner - attr_accessible :owner_id, :owner_type, :delivery_methods, :delivery_method - end diff --git a/plugins/display_content/lib/display_content_block.rb b/plugins/display_content/lib/display_content_block.rb index a1cae4f..746b087 100644 --- a/plugins/display_content/lib/display_content_block.rb +++ b/plugins/display_content/lib/display_content_block.rb @@ -29,8 +29,6 @@ class DisplayContentBlock < Block settings_items :content_with_translations, :type => :boolean, :default => :true settings_items :limit_to_show, :type => :integer, :default => 6 - attr_accessible :sections, :checked_nodes, :display_folder_children, :types, :order_by_recent, :limit_to_show, :content_with_translations - def self.description _('Display your contents') end diff --git a/plugins/driven_signup/models/driven_signup_plugin/auth.rb b/plugins/driven_signup/models/driven_signup_plugin/auth.rb index 67a7236..2876c88 100644 --- a/plugins/driven_signup/models/driven_signup_plugin/auth.rb +++ b/plugins/driven_signup/models/driven_signup_plugin/auth.rb @@ -1,7 +1,5 @@ class DrivenSignupPlugin::Auth < ActiveRecord::Base - attr_accessible :name, :token - belongs_to :environment validates_presence_of :environment diff --git a/plugins/environment_notification/lib/environment_notifications_user.rb b/plugins/environment_notification/lib/environment_notifications_user.rb index 69d63b8..ec3c5df 100644 --- a/plugins/environment_notification/lib/environment_notifications_user.rb +++ b/plugins/environment_notification/lib/environment_notifications_user.rb @@ -4,7 +4,5 @@ class EnvironmentNotificationsUser < ActiveRecord::Base belongs_to :user belongs_to :environment_notification, class_name: 'EnvironmentNotificationPlugin::EnvironmentNotification' - attr_accessible :user_id, :environment_notification_id - validates_uniqueness_of :user_id, :scope => :environment_notification_id end diff --git a/plugins/environment_notification/models/environment_notification_plugin/environment_notification.rb b/plugins/environment_notification/models/environment_notification_plugin/environment_notification.rb index ba39ab0..6d27597 100644 --- a/plugins/environment_notification/models/environment_notification_plugin/environment_notification.rb +++ b/plugins/environment_notification/models/environment_notification_plugin/environment_notification.rb @@ -9,8 +9,6 @@ class EnvironmentNotificationPlugin::EnvironmentNotification < ActiveRecord::Bas "EnvironmentNotificationPlugin::DangerNotification" ] - attr_accessible :message, :environment_id, :active, :type, :display_only_in_homepage, :display_to_all_users, :display_popup, :title - has_many :environment_notifications_users has_many :users, :through => :environment_notifications_users diff --git a/plugins/event/lib/event_plugin/event_block.rb b/plugins/event/lib/event_plugin/event_block.rb index 2d0b221..9890f63 100644 --- a/plugins/event/lib/event_plugin/event_block.rb +++ b/plugins/event/lib/event_plugin/event_block.rb @@ -1,8 +1,6 @@ class EventPlugin::EventBlock < Block include DatesHelper - attr_accessible :all_env_events, :limit, :future_only, :date_distance_limit - settings_items :all_env_events, :type => :boolean, :default => false settings_items :limit, :type => :integer, :default => 4 settings_items :future_only, :type => :boolean, :default => true diff --git a/plugins/fb_app/lib/ext/profile.rb b/plugins/fb_app/lib/ext/profile.rb index c2a753e..f90ac66 100644 --- a/plugins/fb_app/lib/ext/profile.rb +++ b/plugins/fb_app/lib/ext/profile.rb @@ -2,13 +2,6 @@ require_dependency 'profile' # hate to wrte this, but without Noosfero::Plugin::Settings is loaded instead require 'fb_app_plugin/settings' -# attr_accessible must be defined on subclasses -Profile.descendants.each do |subclass| - subclass.class_eval do - attr_accessible :fb_app_settings - end -end - class Profile def fb_app_settings attrs = {} diff --git a/plugins/fb_app/models/fb_app_plugin/auth.rb b/plugins/fb_app/models/fb_app_plugin/auth.rb index bf33253..dae4c1a 100644 --- a/plugins/fb_app/models/fb_app_plugin/auth.rb +++ b/plugins/fb_app/models/fb_app_plugin/auth.rb @@ -9,8 +9,6 @@ class FbAppPlugin::Auth < OauthClientPlugin::Auth settings_items :signed_request settings_items :fb_user - attr_accessible :provider_user_id, :signed_request - before_create :update_user before_create :exchange_token after_create :schedule_exchange_token diff --git a/plugins/fb_app/models/fb_app_plugin/page_tab.rb b/plugins/fb_app/models/fb_app_plugin/page_tab.rb index 3d8c742..379b2f4 100644 --- a/plugins/fb_app/models/fb_app_plugin/page_tab.rb +++ b/plugins/fb_app/models/fb_app_plugin/page_tab.rb @@ -3,10 +3,6 @@ class FbAppPlugin::PageTab < ActiveRecord::Base # FIXME: rename table to match model self.table_name = :fb_app_plugin_page_tab_configs - attr_accessible :owner_profile, :profile_id, :page_id, - :config_type, :profile_ids, :query, - :title, :subtitle - belongs_to :owner_profile, foreign_key: :profile_id, class_name: 'Profile' acts_as_having_settings field: :config diff --git a/plugins/gallery_block/lib/gallery_block.rb b/plugins/gallery_block/lib/gallery_block.rb index 3614919..ce85ce6 100644 --- a/plugins/gallery_block/lib/gallery_block.rb +++ b/plugins/gallery_block/lib/gallery_block.rb @@ -1,7 +1,5 @@ class GalleryBlock < Block - attr_accessible :gallery_id, :groups_of, :speed, :interval - settings_items :gallery_id, :type => :integer settings_items :groups_of, :type => :integer, :default => 3 settings_items :speed, :type => :integer, :default => 1000 diff --git a/plugins/google_analytics/lib/ext/profile.rb b/plugins/google_analytics/lib/ext/profile.rb index acf834c..a613ffd 100644 --- a/plugins/google_analytics/lib/ext/profile.rb +++ b/plugins/google_analytics/lib/ext/profile.rb @@ -1,10 +1,7 @@ require_dependency 'profile' class Profile + settings_items :google_analytics_profile_id - attr_accessible :google_analytics_profile_id - descendants.each do |descendant| - descendant.attr_accessible :google_analytics_profile_id - end end diff --git a/plugins/lattes_curriculum/lib/academic_info.rb b/plugins/lattes_curriculum/lib/academic_info.rb index eeef15f..27559f8 100644 --- a/plugins/lattes_curriculum/lib/academic_info.rb +++ b/plugins/lattes_curriculum/lib/academic_info.rb @@ -2,7 +2,6 @@ class AcademicInfo < ActiveRecord::Base belongs_to :person - attr_accessible :lattes_url validate :lattes_url_validate? def lattes_url_validate? diff --git a/plugins/lattes_curriculum/lib/ext/person.rb b/plugins/lattes_curriculum/lib/ext/person.rb index b5aac79..ef3ff60 100755 --- a/plugins/lattes_curriculum/lib/ext/person.rb +++ b/plugins/lattes_curriculum/lib/ext/person.rb @@ -2,8 +2,6 @@ require_dependency 'person' class Person - attr_accessible :lattes_url, :academic_info_attributes - has_one :academic_info after_destroy do |person| diff --git a/plugins/ldap/lib/ext/environment.rb b/plugins/ldap/lib/ext/environment.rb index 87529e9..dba44c5 100644 --- a/plugins/ldap/lib/ext/environment.rb +++ b/plugins/ldap/lib/ext/environment.rb @@ -6,8 +6,6 @@ class Environment validates_presence_of :ldap_plugin_host, :if => lambda {|env| !env.ldap_plugin.blank? } - attr_accessible :ldap_plugin_host, :ldap_plugin_port, :ldap_plugin_tls, :ldap_plugin_onthefly_register, :ldap_plugin_account, :ldap_plugin_account_password, :ldap_plugin_filter, :ldap_plugin_base_dn, :ldap_plugin_attr_mail, :ldap_plugin_attr_login, :ldap_plugin_attr_fullname, :ldap_plugin_allow_password_recovery - def ldap_plugin_attributes self.ldap_plugin || {} end diff --git a/plugins/newsletter/lib/newsletter_plugin/newsletter.rb b/plugins/newsletter/lib/newsletter_plugin/newsletter.rb index 4476d97..ef9d0f7 100644 --- a/plugins/newsletter/lib/newsletter_plugin/newsletter.rb +++ b/plugins/newsletter/lib/newsletter_plugin/newsletter.rb @@ -9,8 +9,6 @@ class NewsletterPlugin::Newsletter < ActiveRecord::Base validates_numericality_of :periodicity, only_integer: true, greater_than: -1, message: _('must be a positive number') validates_numericality_of :posts_per_blog, only_integer: true, greater_than: -1, message: _('must be a positive number') - attr_accessible :environment, :enabled, :periodicity, :subject, :posts_per_blog, :footer, :blog_ids, :additional_recipients, :person, :person_id, :moderated - scope :enabled, -> { where enabled: true } # These methods are used by NewsletterMailing diff --git a/plugins/newsletter/lib/newsletter_plugin/newsletter_mailing.rb b/plugins/newsletter/lib/newsletter_plugin/newsletter_mailing.rb index ad84e65..8c390f6 100644 --- a/plugins/newsletter/lib/newsletter_plugin/newsletter_mailing.rb +++ b/plugins/newsletter/lib/newsletter_plugin/newsletter_mailing.rb @@ -1,7 +1,5 @@ class NewsletterPlugin::NewsletterMailing < EnvironmentMailing - attr_accessible :source, :person, :locale - validates_presence_of :person def url diff --git a/plugins/oauth_client/models/oauth_client_plugin/auth.rb b/plugins/oauth_client/models/oauth_client_plugin/auth.rb index 58d7f53..a8db3d1 100644 --- a/plugins/oauth_client/models/oauth_client_plugin/auth.rb +++ b/plugins/oauth_client/models/oauth_client_plugin/auth.rb @@ -1,8 +1,5 @@ class OauthClientPlugin::Auth < ActiveRecord::Base - attr_accessible :profile, :provider, :enabled, - :access_token, :expires_in - belongs_to :profile, class_name: 'Profile' belongs_to :provider, class_name: 'OauthClientPlugin::Provider' diff --git a/plugins/oauth_client/models/oauth_client_plugin/provider.rb b/plugins/oauth_client/models/oauth_client_plugin/provider.rb index c3d7864..44e6ee7 100644 --- a/plugins/oauth_client/models/oauth_client_plugin/provider.rb +++ b/plugins/oauth_client/models/oauth_client_plugin/provider.rb @@ -10,10 +10,6 @@ class OauthClientPlugin::Provider < ActiveRecord::Base settings_items :site, type: String settings_items :client_options, type: Hash - attr_accessible :name, :strategy, :enabled, :site, :image_builder, - :environment, :environment_id, :options, - :client_id, :client_secret, :client_options - scope :enabled, -> { where enabled: true } acts_as_having_image diff --git a/plugins/open_graph/lib/ext/profile.rb b/plugins/open_graph/lib/ext/profile.rb index cd0fe06..8f50825 100644 --- a/plugins/open_graph/lib/ext/profile.rb +++ b/plugins/open_graph/lib/ext/profile.rb @@ -2,11 +2,8 @@ require_dependency 'profile' # hate to wrte this, but without Noosfero::Plugin::Settings is loaded instead require 'open_graph_plugin/settings' -# attr_accessible must be defined on subclasses Profile.descendants.each do |subclass| subclass.class_eval do - attr_accessible :open_graph_settings - has_many :open_graph_tracks, class_name: 'OpenGraphPlugin::Track', source: :tracker_id, foreign_key: :tracker_id has_many :open_graph_activities, class_name: 'OpenGraphPlugin::Activity', source: :tracker_id, foreign_key: :tracker_id @@ -21,9 +18,6 @@ Profile.descendants.each do |subclass| association = klass.association has_many association, class_name: klass.name, foreign_key: :tracker_id accepts_nested_attributes_for association, allow_destroy: true, reject_if: :open_graph_reject_empty_object_type - - attr_accessible attributes - attr_accessible profile_ids end end end diff --git a/plugins/open_graph/models/open_graph_plugin/track.rb b/plugins/open_graph/models/open_graph_plugin/track.rb index 6f8e475..b067f90 100644 --- a/plugins/open_graph/models/open_graph_plugin/track.rb +++ b/plugins/open_graph/models/open_graph_plugin/track.rb @@ -3,10 +3,6 @@ class OpenGraphPlugin::Track < ActiveRecord::Base class_attribute :context self.context = :open_graph - attr_accessible :type, :context, :tracker_id, :tracker, :actor_id, :action, - :object_type, :object_data_id, :object_data_type, :object_data_url, - :story, :object_data, :actor - belongs_to :tracker, class_name: 'Profile' belongs_to :actor, class_name: 'Profile' belongs_to :object_data, polymorphic: true diff --git a/plugins/orders/lib/orders_plugin/date_range_attr.rb b/plugins/orders/lib/orders_plugin/date_range_attr.rb index 0dd5a50..66039e6 100644 --- a/plugins/orders/lib/orders_plugin/date_range_attr.rb +++ b/plugins/orders/lib/orders_plugin/date_range_attr.rb @@ -15,7 +15,6 @@ module OrdersPlugin options[:dummy] = true if options[:dummy].nil? range_attr = self.date_range_attr_for start_field, end_field - attr_accessible range_attr define_method range_attr do return if options[:dummy] diff --git a/plugins/orders/models/orders_plugin/item.rb b/plugins/orders/models/orders_plugin/item.rb index 0c94596..3130347 100644 --- a/plugins/orders/models/orders_plugin/item.rb +++ b/plugins/orders/models/orders_plugin/item.rb @@ -1,9 +1,5 @@ class OrdersPlugin::Item < ActiveRecord::Base - attr_accessible :order, :sale, :purchase, - :product, :product_id, - :price, :name - # flag used by items to compare them with products attr_accessor :product_diff @@ -28,9 +24,6 @@ class OrdersPlugin::Item < ActiveRecord::Base StatusDataMap.each do |status, data| quantity = "quantity_#{data}".to_sym price = "price_#{data}".to_sym - - attr_accessible quantity - attr_accessible price end serialize :data diff --git a/plugins/orders/models/orders_plugin/order.rb b/plugins/orders/models/orders_plugin/order.rb index 60e5714..55b94d9 100644 --- a/plugins/orders/models/orders_plugin/order.rb +++ b/plugins/orders/models/orders_plugin/order.rb @@ -40,9 +40,6 @@ class OrdersPlugin::Order < ActiveRecord::Base supplier: StatusAccessMap.map{ |s, a| s if a == :supplier }.compact, } - attr_accessible :status, :consumer, :profile, - :supplier_delivery_id, :consumer_delivery_id, :supplier_delivery_data, :consumer_delivery_data - belongs_to :profile # may be override by subclasses belongs_to :supplier, foreign_key: :profile_id, class_name: 'Profile' diff --git a/plugins/orders_cycle/models/orders_cycle_plugin/cycle.rb b/plugins/orders_cycle/models/orders_cycle_plugin/cycle.rb index 38638c1..ad109b3 100644 --- a/plugins/orders_cycle/models/orders_cycle_plugin/cycle.rb +++ b/plugins/orders_cycle/models/orders_cycle_plugin/cycle.rb @@ -1,10 +1,5 @@ class OrdersCyclePlugin::Cycle < ActiveRecord::Base - attr_accessible :profile, :status, :name, :description, :opening_message - - attr_accessible :start, :finish, :delivery_start, :delivery_finish - attr_accessible :start_date, :start_time, :finish_date, :finish_time, :delivery_start_date, :delivery_start_time, :delivery_finish_date, :delivery_finish_time, - Statuses = %w[edition orders purchases receipts separation delivery closing] DbStatuses = %w[new] + Statuses UserStatuses = Statuses @@ -72,7 +67,6 @@ class OrdersCyclePlugin::Cycle < ActiveRecord::Base has_many :volunteers_periods, class_name: 'VolunteersPlugin::Period', as: :owner has_many :volunteers, through: :volunteers_periods, source: :profile - attr_accessible :volunteers_periods_attributes accepts_nested_attributes_for :volunteers_periods, allow_destroy: true scope :has_volunteers_periods, -> { distinct.joins :volunteers_periods } diff --git a/plugins/orders_cycle/models/orders_cycle_plugin/order_base.rb b/plugins/orders_cycle/models/orders_cycle_plugin/order_base.rb index 9f47b3b..6b66e69 100644 --- a/plugins/orders_cycle/models/orders_cycle_plugin/order_base.rb +++ b/plugins/orders_cycle/models/orders_cycle_plugin/order_base.rb @@ -4,8 +4,6 @@ module OrdersCyclePlugin::OrderBase extend ActiveSupport::Concern included do - attr_accessible :cycle - has_many :cycle_sales, class_name: 'OrdersCyclePlugin::CycleOrder', foreign_key: :sale_id, dependent: :destroy has_one :cycle_sale, class_name: 'OrdersCyclePlugin::CycleOrder', foreign_key: :sale_id has_many :cycle_purchases, class_name: 'OrdersCyclePlugin::CycleOrder', foreign_key: :purchase_id, dependent: :destroy diff --git a/plugins/organization_ratings/lib/create_organization_rating_comment.rb b/plugins/organization_ratings/lib/create_organization_rating_comment.rb index fe66ab3..f55b076 100644 --- a/plugins/organization_ratings/lib/create_organization_rating_comment.rb +++ b/plugins/organization_ratings/lib/create_organization_rating_comment.rb @@ -6,9 +6,6 @@ class CreateOrganizationRatingComment < Task settings_items :organization_rating_id, :type => Integer, :default => nil settings_items :organization_rating_comment_id, :type => Integer, :default => nil - attr_accessible :organization_rating_id, :body, :requestor - attr_accessible :reject_explanation, :target - DATA_FIELDS = ['body'] DATA_FIELDS.each do |field| settings_items field.to_sym diff --git a/plugins/organization_ratings/lib/organization_rating.rb b/plugins/organization_ratings/lib/organization_rating.rb index feae5db..9d8dd47 100644 --- a/plugins/organization_ratings/lib/organization_rating.rb +++ b/plugins/organization_ratings/lib/organization_rating.rb @@ -3,8 +3,6 @@ class OrganizationRating < ActiveRecord::Base belongs_to :organization belongs_to :comment - attr_accessible :value, :person, :organization, :comment - validates :value, :presence => true, :inclusion => { in: 1..5, message: _("must be between 1 and 5") diff --git a/plugins/organization_ratings/lib/organization_ratings_config.rb b/plugins/organization_ratings/lib/organization_ratings_config.rb index 2d89f40..383392f 100644 --- a/plugins/organization_ratings/lib/organization_ratings_config.rb +++ b/plugins/organization_ratings/lib/organization_ratings_config.rb @@ -2,9 +2,6 @@ class OrganizationRatingsConfig < ActiveRecord::Base belongs_to :environment - attr_accessible :cooldown, :default_rating, :order, :per_page - attr_accessible :vote_once, :are_moderated, :environment_id - ORDER_OPTIONS = {recent: _('More Recent'), best: _('Best Ratings')} MINIMUM_RATING = 1 diff --git a/plugins/people_block/lib/members_block.rb b/plugins/people_block/lib/members_block.rb index 942d64a..a1e57f5 100644 --- a/plugins/people_block/lib/members_block.rb +++ b/plugins/people_block/lib/members_block.rb @@ -1,7 +1,7 @@ class MembersBlock < PeopleBlockBase + settings_items :show_join_leave_button, :type => :boolean, :default => false settings_items :visible_role, :type => :string, :default => nil - attr_accessible :show_join_leave_button, :visible_role def self.description c_('Members') diff --git a/plugins/people_block/lib/people_block_base.rb b/plugins/people_block/lib/people_block_base.rb index 8943437..975220a 100644 --- a/plugins/people_block/lib/people_block_base.rb +++ b/plugins/people_block/lib/people_block_base.rb @@ -3,7 +3,6 @@ class PeopleBlockBase < Block settings_items :limit, :type => :integer, :default => 6 settings_items :name, :type => String, :default => "" settings_items :address, :type => String, :default => "" - attr_accessible :name, :address, :prioritize_profiles_with_image def self.description _('Random people') diff --git a/plugins/piwik/lib/ext/environment.rb b/plugins/piwik/lib/ext/environment.rb index cfca2c5..a702b14 100644 --- a/plugins/piwik/lib/ext/environment.rb +++ b/plugins/piwik/lib/ext/environment.rb @@ -4,5 +4,4 @@ class Environment settings_items :piwik_domain settings_items :piwik_path, :default => 'piwik' settings_items :piwik_site_id - attr_accessible :piwik_domain, :piwik_site_id, :piwik_path end diff --git a/plugins/profile_members_headlines/lib/profile_members_headlines_block.rb b/plugins/profile_members_headlines/lib/profile_members_headlines_block.rb index c3d6c01..11d3500 100644 --- a/plugins/profile_members_headlines/lib/profile_members_headlines_block.rb +++ b/plugins/profile_members_headlines/lib/profile_members_headlines_block.rb @@ -5,8 +5,6 @@ class ProfileMembersHeadlinesBlock < Block settings_items :navigation, :type => 'boolean', :default => true settings_items :filtered_roles, :type => Array, :default => [] - attr_accessible :interval, :limit, :navigation, :filtered_roles - def self.description _('Display headlines from members of a community') end diff --git a/plugins/recent_content/lib/recent_content_block.rb b/plugins/recent_content/lib/recent_content_block.rb index 66a02d7..4aa2844 100644 --- a/plugins/recent_content/lib/recent_content_block.rb +++ b/plugins/recent_content/lib/recent_content_block.rb @@ -5,8 +5,6 @@ class RecentContentBlock < Block settings_items :show_blog_picture, :type => :boolean, :default => false settings_items :selected_folder, :type => Integer - attr_accessible :presentation_mode, :total_items, :show_blog_picture, :selected_folder - VALID_CONTENT = ['RawHTMLArticle', 'TextArticle', 'TextileArticle', 'TinyMceArticle'] def self.description diff --git a/plugins/relevant_content/lib/relevant_content_plugin/relevant_content_block.rb b/plugins/relevant_content/lib/relevant_content_plugin/relevant_content_block.rb index 1a6cb3b..eb6cc5d 100644 --- a/plugins/relevant_content/lib/relevant_content_plugin/relevant_content_block.rb +++ b/plugins/relevant_content/lib/relevant_content_plugin/relevant_content_block.rb @@ -18,8 +18,6 @@ class RelevantContentPlugin::RelevantContentBlock < Block settings_items :show_most_disliked, :type => :boolean, :default => 0 settings_items :show_most_voted, :type => :boolean, :default => 1 - attr_accessible :limit, :show_most_voted, :show_most_disliked, :show_most_liked, :show_most_commented, :show_most_read - include ActionView::Helpers include Rails.application.routes.url_helpers diff --git a/plugins/require_auth_to_comment/lib/ext/profile.rb b/plugins/require_auth_to_comment/lib/ext/profile.rb index c790a6b..61feab1 100644 --- a/plugins/require_auth_to_comment/lib/ext/profile.rb +++ b/plugins/require_auth_to_comment/lib/ext/profile.rb @@ -1,10 +1,7 @@ require_dependency 'profile' class Profile + settings_items :allow_unauthenticated_comments, :type => :boolean - attr_accessible :allow_unauthenticated_comments - descendants.each do |descendant| - descendant.attr_accessible :allow_unauthenticated_comments - end end diff --git a/plugins/send_email/lib/send_email_plugin/core_ext.rb b/plugins/send_email/lib/send_email_plugin/core_ext.rb deleted file mode 100644 index 16929e0..0000000 --- a/plugins/send_email/lib/send_email_plugin/core_ext.rb +++ /dev/null @@ -1,4 +0,0 @@ -Environment.class_eval do - attr_accessible :send_email_plugin_allow_to -end - diff --git a/plugins/site_tour/lib/site_tour_plugin/tour_block.rb b/plugins/site_tour/lib/site_tour_plugin/tour_block.rb index 65db701..22f30a6 100644 --- a/plugins/site_tour/lib/site_tour_plugin/tour_block.rb +++ b/plugins/site_tour/lib/site_tour_plugin/tour_block.rb @@ -4,8 +4,6 @@ class SiteTourPlugin::TourBlock < Block settings_items :group_triggers, :type => Array, :default => [] settings_items :display_button, :type => :boolean, :default => true - attr_accessible :actions, :display_button, :group_triggers - before_save do |block| block.actions.reject! {|i| i[:group_name].blank? && i[:selector].blank? && i[:description].blank?} block.group_triggers.reject! {|i| i[:group_name].blank? && i[:selector].blank?} diff --git a/plugins/spaminator/lib/spaminator_plugin/report.rb b/plugins/spaminator/lib/spaminator_plugin/report.rb index ace4acc..d61c8dd 100644 --- a/plugins/spaminator/lib/spaminator_plugin/report.rb +++ b/plugins/spaminator/lib/spaminator_plugin/report.rb @@ -6,8 +6,6 @@ class SpaminatorPlugin::Report < ActiveRecord::Base validates_presence_of :environment - attr_accessible :environment - scope :from_environment, -> environment { where :environment_id => environment } after_initialize do |report| diff --git a/plugins/spaminator/lib/spaminator_plugin/spaminator.rb b/plugins/spaminator/lib/spaminator_plugin/spaminator.rb index d3f3d4f..001e813 100644 --- a/plugins/spaminator/lib/spaminator_plugin/spaminator.rb +++ b/plugins/spaminator/lib/spaminator_plugin/spaminator.rb @@ -29,10 +29,9 @@ class SpaminatorPlugin::Spaminator def initialize(environment) @environment = environment @settings = Noosfero::Plugin::Settings.new(@environment, SpaminatorPlugin) - @report = SpaminatorPlugin::Report.new({:environment => environment, - :total_people => Person.count, - :total_comments => Comment.count}, - :without_protection => true) + @report = SpaminatorPlugin::Report.new environment: environment, + total_people: Person.count, total_comments: Comment.count + self.class.initialize_logger(environment) end diff --git a/plugins/statistics/lib/statistics_block.rb b/plugins/statistics/lib/statistics_block.rb index 4c391a6..8bf04df 100644 --- a/plugins/statistics/lib/statistics_block.rb +++ b/plugins/statistics/lib/statistics_block.rb @@ -10,8 +10,6 @@ class StatisticsBlock < Block settings_items :hit_counter, :default => false settings_items :templates_ids_counter, type: Hash, default: {} - attr_accessible :comment_counter, :community_counter, :user_counter, :enterprise_counter, :product_counter, :category_counter, :tag_counter, :hit_counter, :templates_ids_counter - USER_COUNTERS = [:community_counter, :user_counter, :enterprise_counter, :tag_counter, :comment_counter, :hit_counter] COMMUNITY_COUNTERS = [:user_counter, :tag_counter, :comment_counter, :hit_counter] ENTERPRISE_COUNTERS = [:user_counter, :tag_counter, :comment_counter, :hit_counter] diff --git a/plugins/stoa/lib/ext/person.rb b/plugins/stoa/lib/ext/person.rb index 9b58f4e..3059ee9 100644 --- a/plugins/stoa/lib/ext/person.rb +++ b/plugins/stoa/lib/ext/person.rb @@ -1,7 +1,6 @@ require_dependency 'person' class Person - attr_accessible :usp_id, :invitation_code SEARCHABLE_FIELDS[:usp_id] = {:label => _('USP Number'), :weight => 5} @@ -23,4 +22,5 @@ class Person Task.pending.where(code: invitation_code.to_s).first or Task.finished.where(code: invitation_code.to_s, target_id: id).first end + end diff --git a/plugins/stoa/test/functional/account_controller_test.rb b/plugins/stoa/test/functional/account_controller_test.rb index 795f56f..ea49746 100644 --- a/plugins/stoa/test/functional/account_controller_test.rb +++ b/plugins/stoa/test/functional/account_controller_test.rb @@ -21,7 +21,7 @@ class AccountControllerTest < ActionController::TestCase @controller = AccountController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new - StoaPlugin::UspUser.create!({:codpes => 12345678, :cpf => Digest::MD5.hexdigest(SALT+'12345678'), :birth_date => '1970-01-30'}, :without_protection => true) + StoaPlugin::UspUser.create! codpes: 12345678, cpf: Digest::MD5.hexdigest(SALT+'12345678'), birth_date: '1970-01-30' Environment.default.enable_plugin(StoaPlugin.name) @user = create_user('joao-stoa', {:password => 'pass', :password_confirmation => 'pass'},:usp_id=>'87654321') @user.activate diff --git a/plugins/stoa/test/unit/usp_user_test.rb b/plugins/stoa/test/unit/usp_user_test.rb index 26580c5..a0ecdca 100644 --- a/plugins/stoa/test/unit/usp_user_test.rb +++ b/plugins/stoa/test/unit/usp_user_test.rb @@ -16,7 +16,7 @@ class StoaPlugin::UspUserTest < ActiveSupport::TestCase ActiveRecord::Base.establish_connection(:test) def setup - StoaPlugin::UspUser.create({:codpes => 123456, :cpf => Digest::MD5.hexdigest(SALT+'12345678'), :birth_date => '1970-01-30'}, :without_protection => true) + StoaPlugin::UspUser.create codpes: 123456, cpf: Digest::MD5.hexdigest(SALT+'12345678'), birth_date: '1970-01-30' end should 'check existence of usp_id' do diff --git a/plugins/sub_organizations/lib/ext/organization.rb b/plugins/sub_organizations/lib/ext/organization.rb index 67975fd..c00e32d 100644 --- a/plugins/sub_organizations/lib/ext/organization.rb +++ b/plugins/sub_organizations/lib/ext/organization.rb @@ -2,8 +2,6 @@ require_dependency 'organization' class Organization settings_items :sub_organizations_plugin_parent_to_be - attr_accessible :sub_organizations_plugin_parent_to_be - after_create do |organization| if organization.sub_organizations_plugin_parent_to_be.present? parent = Organization.find(organization.sub_organizations_plugin_parent_to_be) diff --git a/plugins/sub_organizations/lib/related_organizations_block.rb b/plugins/sub_organizations/lib/related_organizations_block.rb index 7222c69..e71e6c9 100644 --- a/plugins/sub_organizations/lib/related_organizations_block.rb +++ b/plugins/sub_organizations/lib/related_organizations_block.rb @@ -2,8 +2,6 @@ class RelatedOrganizationsBlock < ProfileListBlock settings_items :organization_type, :type => :string, :default => 'both' - attr_accessible :organization_type - def self.description _("Related Organizations") end diff --git a/plugins/sub_organizations/lib/sub_organizations_plugin/approve_paternity_relation.rb b/plugins/sub_organizations/lib/sub_organizations_plugin/approve_paternity_relation.rb index 568b9e9..4741b75 100644 --- a/plugins/sub_organizations/lib/sub_organizations_plugin/approve_paternity_relation.rb +++ b/plugins/sub_organizations/lib/sub_organizations_plugin/approve_paternity_relation.rb @@ -6,8 +6,6 @@ class SubOrganizationsPlugin::ApprovePaternityRelation < ActiveRecord::Base validates_presence_of :task, :parent, :child - attr_accessible :task, :parent, :child - class << self def parent_approval(task) find_by_task_id(task.id).parent diff --git a/plugins/sub_organizations/lib/sub_organizations_plugin/relation.rb b/plugins/sub_organizations/lib/sub_organizations_plugin/relation.rb index 306127f..03e9010 100644 --- a/plugins/sub_organizations/lib/sub_organizations_plugin/relation.rb +++ b/plugins/sub_organizations/lib/sub_organizations_plugin/relation.rb @@ -8,8 +8,6 @@ class SubOrganizationsPlugin::Relation < ActiveRecord::Base validate :no_cyclical_reference, :if => 'parent.present? && child.present?' validate :no_multi_level, :if => 'parent.present? && child.present?' - attr_accessible :parent, :child - def no_self_reference errors.add(:child, c_('self-reference is not allowed.')) if parent == child end diff --git a/plugins/suppliers/lib/ext/price_detail.rb b/plugins/suppliers/lib/ext/price_detail.rb deleted file mode 100644 index 8983a8e..0000000 --- a/plugins/suppliers/lib/ext/price_detail.rb +++ /dev/null @@ -1,8 +0,0 @@ -require_dependency 'price_detail' - -class PriceDetail - - # should be on core, used by SuppliersPlugin::Import - attr_accessible :production_cost - -end diff --git a/plugins/suppliers/lib/ext/product.rb b/plugins/suppliers/lib/ext/product.rb index 75ad780..07663d9 100644 --- a/plugins/suppliers/lib/ext/product.rb +++ b/plugins/suppliers/lib/ext/product.rb @@ -28,18 +28,12 @@ class Product ProductCategory.find products.collect(&:product_category_id).compact.select{ |id| not id.zero? } end - attr_accessible :external_id settings_items :external_id, type: String, default: nil - # should be on core, used by SuppliersPlugin::Import - attr_accessible :price_details - end class Product - attr_accessible :from_products, :from_product, :supplier_id, :supplier - has_many :sources_from_products, foreign_key: :to_product_id, class_name: 'SuppliersPlugin::SourceProduct', dependent: :destroy has_one :sources_from_product, foreign_key: :to_product_id, class_name: 'SuppliersPlugin::SourceProduct' has_many :sources_to_products, foreign_key: :from_product_id, class_name: 'SuppliersPlugin::SourceProduct', dependent: :destroy diff --git a/plugins/suppliers/models/suppliers_plugin/base_product.rb b/plugins/suppliers/models/suppliers_plugin/base_product.rb index 7bf5c76..1cfe19c 100644 --- a/plugins/suppliers/models/suppliers_plugin/base_product.rb +++ b/plugins/suppliers/models/suppliers_plugin/base_product.rb @@ -2,9 +2,6 @@ # cycle.products will go to an infinite loop class SuppliersPlugin::BaseProduct < Product - attr_accessible :default_margin_percentage, :margin_percentage, :default_unit, :unit_detail, - :supplier_product_attributes - accepts_nested_attributes_for :supplier_product default_scope -> { diff --git a/plugins/suppliers/models/suppliers_plugin/distributed_product.rb b/plugins/suppliers/models/suppliers_plugin/distributed_product.rb index afca18c..b1c68b1 100644 --- a/plugins/suppliers/models/suppliers_plugin/distributed_product.rb +++ b/plugins/suppliers/models/suppliers_plugin/distributed_product.rb @@ -1,10 +1,5 @@ class SuppliersPlugin::DistributedProduct < SuppliersPlugin::BaseProduct - attr_accessible :from_products - - # missed from lib/ext/product.rb because of STI - attr_accessible :external_id, :price_details - validates_presence_of :supplier def supplier_price diff --git a/plugins/suppliers/models/suppliers_plugin/source_product.rb b/plugins/suppliers/models/suppliers_plugin/source_product.rb index 23d9c5d..8f256e2 100644 --- a/plugins/suppliers/models/suppliers_plugin/source_product.rb +++ b/plugins/suppliers/models/suppliers_plugin/source_product.rb @@ -1,7 +1,5 @@ class SuppliersPlugin::SourceProduct < ActiveRecord::Base - attr_accessible :from_product, :to_product, :quantity - default_scope -> { includes :from_product, :to_product } belongs_to :from_product, class_name: 'Product' diff --git a/plugins/suppliers/models/suppliers_plugin/supplier.rb b/plugins/suppliers/models/suppliers_plugin/supplier.rb index e3ac8cd..93b11d0 100644 --- a/plugins/suppliers/models/suppliers_plugin/supplier.rb +++ b/plugins/suppliers/models/suppliers_plugin/supplier.rb @@ -2,8 +2,6 @@ class SuppliersPlugin::Supplier < ActiveRecord::Base attr_accessor :distribute_products_on_create, :dont_destroy_dummy, :identifier_from_name - attr_accessible :profile_id, :profile, :consumer, :consumer_id, :name, :name_abbreviation, :description - belongs_to :profile belongs_to :consumer, class_name: 'Profile' alias_method :supplier, :profile diff --git a/plugins/tolerance_time/lib/tolerance_time_plugin/publication.rb b/plugins/tolerance_time/lib/tolerance_time_plugin/publication.rb index 24fae23..068d1bd 100644 --- a/plugins/tolerance_time/lib/tolerance_time_plugin/publication.rb +++ b/plugins/tolerance_time/lib/tolerance_time_plugin/publication.rb @@ -1,9 +1,9 @@ class ToleranceTimePlugin::Publication < ActiveRecord::Base belongs_to :target, :polymorphic => true + validates_presence_of :target_id, :target_type validates_uniqueness_of :target_id, :scope => :target_type - attr_accessible :target class << self def find_by_target(target) diff --git a/plugins/tolerance_time/lib/tolerance_time_plugin/tolerance.rb b/plugins/tolerance_time/lib/tolerance_time_plugin/tolerance.rb index c938a23..b0e1d91 100644 --- a/plugins/tolerance_time/lib/tolerance_time_plugin/tolerance.rb +++ b/plugins/tolerance_time/lib/tolerance_time_plugin/tolerance.rb @@ -1,10 +1,10 @@ class ToleranceTimePlugin::Tolerance < ActiveRecord::Base belongs_to :profile + validates_presence_of :profile_id validates_uniqueness_of :profile_id validates_numericality_of :content_tolerance, :only_integer => true, :allow_nil => true validates_numericality_of :comment_tolerance, :only_integer => true, :allow_nil => true - attr_accessible :profile, :content_tolerance, :comment_tolerance end diff --git a/plugins/video/lib/video_plugin/video_block.rb b/plugins/video/lib/video_plugin/video_block.rb index fac16d7..d89161e 100644 --- a/plugins/video/lib/video_plugin/video_block.rb +++ b/plugins/video/lib/video_plugin/video_block.rb @@ -1,7 +1,5 @@ class VideoPlugin::VideoBlock < Block - attr_accessible :url, :width, :height - settings_items :url, :type => :string, :default => "" settings_items :width, :type => :integer, :default => 400 settings_items :height, :type => :integer, :default => 315 diff --git a/plugins/volunteers/lib/ext/profile.rb b/plugins/volunteers/lib/ext/profile.rb index 068594c..fdc12bc 100644 --- a/plugins/volunteers/lib/ext/profile.rb +++ b/plugins/volunteers/lib/ext/profile.rb @@ -1,12 +1,5 @@ require_dependency 'profile' -# attr_accessible must be defined on subclasses -Profile.descendants.each do |subclass| - subclass.class_eval do - attr_accessible :volunteers_settings - end -end - class Profile def volunteers_settings attrs = {} diff --git a/plugins/volunteers/models/volunteers_plugin/assignment.rb b/plugins/volunteers/models/volunteers_plugin/assignment.rb index 2542ced..e7cbcc4 100644 --- a/plugins/volunteers/models/volunteers_plugin/assignment.rb +++ b/plugins/volunteers/models/volunteers_plugin/assignment.rb @@ -1,7 +1,5 @@ class VolunteersPlugin::Assignment < ActiveRecord::Base - attr_accessible :profile_id - belongs_to :profile belongs_to :period, class_name: 'VolunteersPlugin::Period' diff --git a/plugins/volunteers/models/volunteers_plugin/period.rb b/plugins/volunteers/models/volunteers_plugin/period.rb index ff3091c..c44c505 100644 --- a/plugins/volunteers/models/volunteers_plugin/period.rb +++ b/plugins/volunteers/models/volunteers_plugin/period.rb @@ -1,11 +1,5 @@ class VolunteersPlugin::Period < ActiveRecord::Base - attr_accessible :name - attr_accessible :start, :end - attr_accessible :owner_type - attr_accessible :minimum_assigments - attr_accessible :maximum_assigments - belongs_to :owner, polymorphic: true has_many :assignments, class_name: 'VolunteersPlugin::Assignment', foreign_key: :period_id, include: [:profile], dependent: :destroy diff --git a/plugins/work_assignment/lib/work_assignment_plugin/work_assignment.rb b/plugins/work_assignment/lib/work_assignment_plugin/work_assignment.rb index b5e285f..c8cbace 100644 --- a/plugins/work_assignment/lib/work_assignment_plugin/work_assignment.rb +++ b/plugins/work_assignment/lib/work_assignment_plugin/work_assignment.rb @@ -4,10 +4,6 @@ class WorkAssignmentPlugin::WorkAssignment < Folder settings_items :default_email, :type => :string, :default => "" settings_items :allow_visibility_edition, :type => :boolean, :default => false - attr_accessible :publish_submissions - attr_accessible :default_email - attr_accessible :allow_visibility_edition - def self.icon_name(article = nil) 'work-assignment' end @@ -39,16 +35,13 @@ class WorkAssignmentPlugin::WorkAssignment < Folder end def find_or_create_author_folder(author) - children.find_by(slug: author.name.to_slug) || Folder.create!( - { - :name => author.name, - :parent => self, - :profile => profile, - :author => author, - :published => publish_submissions, - }, - :without_protection => true - ) + children.find_by_slug(author.name.to_slug) || Folder.create!( + name: author.name, + parent: self, + profile: profile, + author: author, + published: publish_submissions, + ) end def submissions diff --git a/plugins/work_assignment/test/functional/work_assignment_plugin_myprofile_controller_test.rb b/plugins/work_assignment/test/functional/work_assignment_plugin_myprofile_controller_test.rb index 99cca57..f57cff8 100644 --- a/plugins/work_assignment/test/functional/work_assignment_plugin_myprofile_controller_test.rb +++ b/plugins/work_assignment/test/functional/work_assignment_plugin_myprofile_controller_test.rb @@ -22,16 +22,7 @@ class WorkAssignmentPluginMyprofileControllerTest < ActionController::TestCase work_assignment.save! assert_equal false, work_assignment.allow_visibility_edition parent = work_assignment.find_or_create_author_folder(@person) - UploadedFile.create( - { - :uploaded_data => fixture_file_upload('/files/test.txt', 'text/plain'), - :profile => @organization, - :parent => parent, - :last_changed_by => @person, - :author => @person, - }, - :without_protection => true - ) + create_uploaded_file submission = UploadedFile.find_by filename: 'test.txt' assert_equal false, submission.published assert_equal false, submission.parent.published @@ -67,16 +58,7 @@ class WorkAssignmentPluginMyprofileControllerTest < ActionController::TestCase assert_equal true, work_assignment.allow_visibility_edition work_assignment.save! parent = work_assignment.find_or_create_author_folder(@person) - UploadedFile.create( - { - :uploaded_data => fixture_file_upload('/files/test.txt', 'text/plain'), - :profile => @organization, - :parent => parent, - :last_changed_by => @person, - :author => @person, - }, - :without_protection => true - ) + create_uploaded_file logout submission = UploadedFile.find_by filename: 'test.txt' assert_equal false, submission.parent.published @@ -95,19 +77,9 @@ class WorkAssignmentPluginMyprofileControllerTest < ActionController::TestCase @organization.add_member(@person) # current_user is a member work_assignment = create_work_assignment('Another Work Assignment', @organization, nil, true) parent = work_assignment.find_or_create_author_folder(@person) - UploadedFile.create( - { - :uploaded_data => fixture_file_upload('/files/test.txt', 'text/plain'), - :profile => @organization, - :parent => parent, - :last_changed_by => @person, - :author => @person, - }, - :without_protection => true - ) + create_uploaded_file logout - other_person = create_user('other_user').person @organization.add_member(other_person) login_as :other_user @@ -133,16 +105,7 @@ class WorkAssignmentPluginMyprofileControllerTest < ActionController::TestCase @organization.add_member(other_person) work_assignment = create_work_assignment('Another Work Assignment', @organization, false, true) parent = work_assignment.find_or_create_author_folder(@person) - UploadedFile.create( - { - :uploaded_data => fixture_file_upload('/files/test.txt', 'text/plain'), - :profile => @organization, - :parent => parent, - :last_changed_by => @person, - :author => @person, - }, - :without_protection => true - ) + create_uploaded_file submission = UploadedFile.find_by filename: 'test.txt' assert_equal false, submission.article_privacy_exceptions.include?(other_person) post :edit_visibility, :profile => @organization.identifier, :article_id => parent.id, :article => { :published => false }, :q => other_person.id @@ -155,16 +118,7 @@ class WorkAssignmentPluginMyprofileControllerTest < ActionController::TestCase @organization.add_member(@person) # current_user is a member work_assignment = create_work_assignment('Work Assignment', @organization, nil, true) parent = work_assignment.find_or_create_author_folder(@person) - UploadedFile.create( - { - :uploaded_data => fixture_file_upload('/files/test.txt', 'text/plain'), - :profile => @organization, - :parent => parent, - :last_changed_by => @person, - :author => @person, - }, - :without_protection => true - ) + create_uploaded_file @organization.remove_member(@person) submission = UploadedFile.find_by filename: 'test.txt' @@ -182,7 +136,18 @@ class WorkAssignmentPluginMyprofileControllerTest < ActionController::TestCase end private - def create_work_assignment(name = nil, profile = nil, publish_submissions = nil, allow_visibility_edition = nil) - @work_assignment = WorkAssignmentPlugin::WorkAssignment.create!(:name => name, :profile => profile, :publish_submissions => publish_submissions, :allow_visibility_edition => allow_visibility_edition) - end + + def create_work_assignment(name = nil, profile = nil, publish_submissions = nil, allow_visibility_edition = nil) + @work_assignment = WorkAssignmentPlugin::WorkAssignment.create!(:name => name, :profile => profile, :publish_submissions => publish_submissions, :allow_visibility_edition => allow_visibility_edition) + end + + def create_uploaded_file + UploadedFile.create( + uploaded_data: fixture_file_upload('/files/test.txt', 'text/plain'), + profile: @organization, + parent: parent, + last_changed_by: @person, + author: @person, + ) + end end diff --git a/plugins/work_assignment/test/unit/work_assingment_plugin_test.rb b/plugins/work_assignment/test/unit/work_assingment_plugin_test.rb index dd15087..d2c0d9f 100644 --- a/plugins/work_assignment/test/unit/work_assingment_plugin_test.rb +++ b/plugins/work_assignment/test/unit/work_assingment_plugin_test.rb @@ -1,20 +1,13 @@ require 'test_helper' class WorkAssignmentPluginTest < ActiveSupport::TestCase + should 'verify if a content is a work_assignment submission' do organization = fast_create(Organization) folder = fast_create(Folder) person = fast_create(Person) - content = UploadedFile.create( - { - :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), - :profile => organization, - :parent => folder, - :last_changed_by => person, - :author => person, - }, - :without_protection => true - ) + + create_uploaded_file organization, folder, person refute WorkAssignmentPlugin.is_submission?(content) work_assignment = WorkAssignmentPlugin::WorkAssignment.create!(:name => 'Work Assignment', :profile => organization) @@ -64,15 +57,16 @@ class WorkAssignmentPluginTest < ActiveSupport::TestCase organization.add_member(author) work_assignment ||= WorkAssignmentPlugin::WorkAssignment.create!(:name => 'Work Assignment', :profile => organization) author_folder = work_assignment.find_or_create_author_folder(author) - content = UploadedFile.create( - { - :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), - :profile => organization, - :parent => author_folder, - :last_changed_by => author, - :author => author, - }, - :without_protection => true - ) + create_uploaded_file organization, author_folder, author + end + + def create_uploaded_file organization, parent, author + UploadedFile.create( + uploaded_data: fixture_file_upload('/files/rails.png', 'image/png'), + profile: organization, + parent: parent, + last_changed_by: author, + author: author, + ) end end diff --git a/test/functional/content_viewer_controller_test.rb b/test/functional/content_viewer_controller_test.rb index 9b85802..c0f9d16 100644 --- a/test/functional/content_viewer_controller_test.rb +++ b/test/functional/content_viewer_controller_test.rb @@ -143,7 +143,7 @@ class ContentViewerControllerTest < ActionController::TestCase should 'not display forbidden articles' do profile.articles.create!(:name => 'test') - profile.update!({:public_content => false}, :without_protection => true) + profile.update! public_content: false Article.any_instance.expects(:display_to?).with(anything).returns(false) get :view_page, :profile => profile.identifier, :page => [ 'test' ] @@ -152,7 +152,7 @@ class ContentViewerControllerTest < ActionController::TestCase should 'display allowed articles' do profile.articles.create!(:name => 'test') - profile.update!({:public_content => false}, :without_protection => true) + profile.update! public_content: false Article.any_instance.expects(:display_to?).with(anything).returns(true) get :view_page, :profile => profile.identifier, :page => [ 'test' ] diff --git a/test/functional/profile_roles_controller_test.rb b/test/functional/profile_roles_controller_test.rb index bb007e4..a9f3452 100644 --- a/test/functional/profile_roles_controller_test.rb +++ b/test/functional/profile_roles_controller_test.rb @@ -40,7 +40,8 @@ class ProfileRolesControllerTest < ActionController::TestCase community = fast_create(Community) admin = create_user_with_permission('admin_user', 'manage_custom_roles', community) login_as :admin_user - role = Role.create!({:name => 'delete_article', :key => 'profile_delete_article', :profile_id => community.id, :environment => Environment.default}, :without_protection => true) + role = Role.create! name: 'delete_article', key: 'profile_delete_article', + profile_id: community.id, environment: Environment.default post :remove , :profile => community.identifier, :id => role.id assert_response :redirect @@ -53,7 +54,8 @@ class ProfileRolesControllerTest < ActionController::TestCase community = fast_create(Community) admin = create_user_with_permission('admin_user', 'manage_custom_roles', community) login_as :admin_user - role = Role.create!({:name => 'delete_article', :key => 'profile_delete_article', :profile_id => community.id, :environment => Environment.default}, :without_protection => true) + role = Role.create! name: 'delete_article', key: 'profile_delete_article', + profile_id: community.id, environment: Environment.default admin.add_role(role, community) moderator_role = Role.find_by(name: "moderator") @@ -72,7 +74,8 @@ class ProfileRolesControllerTest < ActionController::TestCase community = fast_create(Community) admin = create_user_with_permission('admin_user', 'manage_custom_roles', community) login_as :admin_user - role = Role.create!({:name => 'delete_article', :key => 'profile_delete_article', :profile_id => community.id, :environment => Environment.default}, :without_protection => true) + role = Role.create! name: 'delete_article', key: 'profile_delete_article', + profile_id: community.id, environment: Environment.default assert_not_includes community.members_by_role(role), admin @@ -86,7 +89,8 @@ class ProfileRolesControllerTest < ActionController::TestCase admin = create_user_with_permission('admin_user', 'manage_custom_roles', community) moderator = create_user_with_permission('profile_admin', 'edit_profile', community) login_as :admin_user - role = Role.create!({:name => 'delete_article', :key => 'profile_delete_article', :profile_id => community.id, :environment => Environment.default}, :without_protection => true) + role = Role.create! name: 'delete_article', key: 'profile_delete_article', + profile_id: community.id, environment: Environment.default moderator_role = Role.find_by(name: "moderator") admin.add_role(moderator_role, community) diff --git a/test/support/factories.rb b/test/support/factories.rb index a807048..ccbac85 100644 --- a/test/support/factories.rb +++ b/test/support/factories.rb @@ -44,7 +44,7 @@ module Noosfero::Factory data = defaults_for(name).merge(attrs) object = name.to_s.camelize.constantize.new if object.respond_to?(:assign_attributes) - object.assign_attributes(data, :without_protection => true) + object.assign_attributes data else data.each { |attribute, value| object.send(attribute.to_s+'=', value) } end diff --git a/test/unit/acts_as_having_settings_test.rb b/test/unit/acts_as_having_settings_test.rb index fe6dad9..0a0e96e 100644 --- a/test/unit/acts_as_having_settings_test.rb +++ b/test/unit/acts_as_having_settings_test.rb @@ -8,7 +8,6 @@ class ActsAsHavingSettingsTest < ActiveSupport::TestCase settings_items :flag_disabled_by_default, type: :boolean, default: false # to test that 'name' will be symbolized (see below) settings_items 'name', type: :string, default: N_('ENGLISH TEXT') - attr_accessible :flag, :name, :flag_disabled_by_default end should 'store settings in a hash' do diff --git a/test/unit/profile_activity_test.rb b/test/unit/profile_activity_test.rb index ebf9a90..6a4749e 100644 --- a/test/unit/profile_activity_test.rb +++ b/test/unit/profile_activity_test.rb @@ -10,7 +10,6 @@ class ProfileActivityTest < ActiveSupport::TestCase profile = fast_create Person target = fast_create Person - ActionTracker::Record.attr_accessible :created_at, :updated_at tracker = ActionTracker::Record.create! verb: :leave_scrap, user: profile, target: target, created_at: Time.now-2.days, updated_at: Time.now-1.day pa = ProfileActivity.create! profile: profile, activity: tracker diff --git a/vendor/plugins/access_control/lib/role.rb b/vendor/plugins/access_control/lib/role.rb index 0b8141a..c57968e 100644 --- a/vendor/plugins/access_control/lib/role.rb +++ b/vendor/plugins/access_control/lib/role.rb @@ -1,14 +1,16 @@ class Role < ActiveRecord::Base - attr_accessible :key, :name, :environment, :permissions - has_many :role_assignments, :dependent => :destroy + belongs_to :environment belongs_to :organization + serialize :permissions, Array + validates_presence_of :name validates_uniqueness_of :name, :scope => :environment_id validates_uniqueness_of :key, :if => lambda { |role| !role.key.blank? }, :scope => :environment_id + before_validation :create_key, :on => :create def initialize(*args) diff --git a/vendor/plugins/access_control/lib/role_assignment.rb b/vendor/plugins/access_control/lib/role_assignment.rb index 7e53cac..5aa7bde 100644 --- a/vendor/plugins/access_control/lib/role_assignment.rb +++ b/vendor/plugins/access_control/lib/role_assignment.rb @@ -1,7 +1,5 @@ class RoleAssignment < ActiveRecord::Base - attr_accessible :accessor_id, :accessor_type, :role_id, :resource_id, :resource_type, :created_at - belongs_to :role belongs_to :accessor, :polymorphic => true belongs_to :resource, :polymorphic => true diff --git a/vendor/plugins/access_control/test/acts_as_accessor_test.rb b/vendor/plugins/access_control/test/acts_as_accessor_test.rb index 9f6d408..4264169 100644 --- a/vendor/plugins/access_control/test/acts_as_accessor_test.rb +++ b/vendor/plugins/access_control/test/acts_as_accessor_test.rb @@ -3,10 +3,6 @@ require File.dirname(__FILE__) + '/test_helper' class ActAsAccessorTest < Test::Unit::TestCase - def setup - RoleAssignment.attr_accessible :accessor - end - def test_can_have_role_in_respect_to_an_resource res = AccessControlTestResource.create!(:name => 'bla') a = AccessControlTestAccessor.create!(:name => 'ze') @@ -57,7 +53,7 @@ class ActAsAccessorTest < Test::Unit::TestCase a = AccessControlTestAccessor.create!(:name => 'ze') role = Role.create!(:name => 'an_author', :permissions => ['bli']) - assert !a.role_assignments.map{|ra|[ra.role, ra.accessor, ra.resource]}.include?([role, a, res]) + assert !a.role_assignments.map{|ra|[ra.role, ra.accessor, ra.resource]}.include?([role, a, res]) assert !a.remove_role(role, res) end diff --git a/vendor/plugins/access_control/test/role_assignment_test.rb b/vendor/plugins/access_control/test/role_assignment_test.rb index a933e79..d1f0f9d 100644 --- a/vendor/plugins/access_control/test/role_assignment_test.rb +++ b/vendor/plugins/access_control/test/role_assignment_test.rb @@ -2,17 +2,13 @@ require File.dirname(__FILE__) + '/test_helper' class RoleAssignmentTest < Test::Unit::TestCase - def setup - RoleAssignment.attr_accessible :is_global, :role, :accessor, :resource - end - def test_has_global_permission role = Role.create(:name => 'new_role', :permissions => ['permission']) ra = RoleAssignment.create(:role_id => role.id, :is_global => true) assert ra.has_permission?('permission', 'global') assert !ra.has_permission?('not_permitted', 'global') - end - + end + def test_has_global_permission_with_global_resource role = Role.create(:name => 'new_role', :permissions => ['permission']) accessor = AccessControlTestAccessor.create(:name => 'accessor') diff --git a/vendor/plugins/access_control/test/role_test.rb b/vendor/plugins/access_control/test/role_test.rb index 7775d4c..e39198d 100644 --- a/vendor/plugins/access_control/test/role_test.rb +++ b/vendor/plugins/access_control/test/role_test.rb @@ -4,8 +4,6 @@ require File.join(File.dirname(__FILE__), 'test_helper') class RoleTest < Test::Unit::TestCase def setup - RoleAssignment.attr_accessible :role, :accessor - Role.attr_accessible :system Role.delete_all end @@ -15,11 +13,11 @@ class RoleTest < Test::Unit::TestCase assert role.save assert_equal count + 1, Role.count end - + def test_uniqueness_of_name Role.create(:name => 'role_name') role = Role.new(:name => 'role_name') - assert ! role.save + assert ! role.save end def test_uniqueness_of_key diff --git a/vendor/plugins/access_control/test/test_helper.rb b/vendor/plugins/access_control/test/test_helper.rb index 8008f05..0be4175 100644 --- a/vendor/plugins/access_control/test/test_helper.rb +++ b/vendor/plugins/access_control/test/test_helper.rb @@ -18,7 +18,6 @@ RoleAssignment.table_name = 'access_control_test_role_assignments' class AccessControlTestAccessor < ActiveRecord::Base self.table_name = 'access_control_test_accessors' acts_as_accessor - attr_accessible :name def cache_keys(arg) [] end @@ -32,8 +31,6 @@ class AccessControlTestResource < ActiveRecord::Base self.table_name = 'access_control_test_resources' acts_as_accessible PERMISSIONS[self.class.name] = {'bla' => N_('Bla')} - - attr_accessible :name end # controller to test protection diff --git a/vendor/plugins/action_tracker/lib/action_tracker_model.rb b/vendor/plugins/action_tracker/lib/action_tracker_model.rb index 447dfd9..1d35ebb 100644 --- a/vendor/plugins/action_tracker/lib/action_tracker_model.rb +++ b/vendor/plugins/action_tracker/lib/action_tracker_model.rb @@ -1,6 +1,5 @@ module ActionTracker class Record < ActiveRecord::Base - attr_accessible :verb, :params, :user, :target self.table_name = 'action_tracker' diff --git a/vendor/plugins/kandadaboggu-vote_fu/lib/models/vote.rb b/vendor/plugins/kandadaboggu-vote_fu/lib/models/vote.rb index c3f04ba..603cadf 100644 --- a/vendor/plugins/kandadaboggu-vote_fu/lib/models/vote.rb +++ b/vendor/plugins/kandadaboggu-vote_fu/lib/models/vote.rb @@ -15,8 +15,6 @@ class Vote < ActiveRecord::Base belongs_to :voteable, :polymorphic => true belongs_to :voter, :polymorphic => true - attr_accessible :vote, :voter, :voteable - # Uncomment this to limit users to a single vote on each item. #validates_uniqueness_of :voteable_id, :scope => [:voteable_type, :voter_type, :voter_id] -- libgit2 0.21.2