Commit 295914e1c02f1f6066d2a7165f479ff649a90587
1 parent
b3ca57de
Exists in
rails5
rails5: drop unsecure and unsupported protected_attributes
Showing
173 changed files
with
99 additions
and
530 deletions
Show diff stats
Gemfile
... | ... | @@ -49,7 +49,6 @@ gem 'sass-rails' |
49 | 49 | gem 'sprockets-rails', '~> 2.1' |
50 | 50 | |
51 | 51 | # gems to enable rails3 behaviour |
52 | -gem 'protected_attributes' | |
53 | 52 | gem 'rails-observers', github: 'rails/rails-observers' |
54 | 53 | gem 'actionpack-page_caching' |
55 | 54 | gem 'actionpack-action_caching' | ... | ... |
app/controllers/my_profile/cms_controller.rb
... | ... | @@ -207,14 +207,11 @@ class CmsController < MyProfileController |
207 | 207 | params[:uploaded_files].each do |file| |
208 | 208 | unless file == '' |
209 | 209 | @uploaded_files << UploadedFile.create( |
210 | - { | |
211 | - :uploaded_data => file, | |
212 | - :profile => profile, | |
213 | - :parent => @parent, | |
214 | - :last_changed_by => user, | |
215 | - :author => user, | |
216 | - }, | |
217 | - :without_protection => true | |
210 | + uploaded_data: file, | |
211 | + profile: profile, | |
212 | + parent: @parent, | |
213 | + last_changed_by: user, | |
214 | + author: user, | |
218 | 215 | ) |
219 | 216 | end |
220 | 217 | end | ... | ... |
app/controllers/my_profile/manage_products_controller.rb
... | ... | @@ -86,7 +86,7 @@ class ManageProductsController < ApplicationController |
86 | 86 | @edit = true |
87 | 87 | @level = @category.level |
88 | 88 | if request.post? |
89 | - if @product.update({:product_category_id => params[:selected_category_id]}, :without_protection => true) | |
89 | + if @product.update product_category_id: params[:selected_category_id] | |
90 | 90 | render :partial => 'shared/redirect_via_javascript', |
91 | 91 | :locals => { :url => url_for(:controller => 'manage_products', :action => 'show', :id => @product) } |
92 | 92 | else | ... | ... |
app/controllers/my_profile/profile_roles_controller.rb
... | ... | @@ -12,7 +12,7 @@ class ProfileRolesController < MyProfileController |
12 | 12 | end |
13 | 13 | |
14 | 14 | def create |
15 | - @role = Role.new({:name => params[:role][:name], :permissions => params[:role][:permissions], :environment => environment }, :without_protection => true) | |
15 | + @role = Role.new name: params[:role][:name], permissions: params[:role][:permissions], environment: environment | |
16 | 16 | if @role.save |
17 | 17 | profile.custom_roles << @role |
18 | 18 | redirect_to :action => 'show', :id => @role | ... | ... |
app/mailers/mailing.rb
... | ... | @@ -4,8 +4,6 @@ class Mailing < ActiveRecord::Base |
4 | 4 | |
5 | 5 | acts_as_having_settings :field => :data |
6 | 6 | |
7 | - attr_accessible :subject, :body, :data | |
8 | - | |
9 | 7 | validates_presence_of :source_id, :subject, :body |
10 | 8 | belongs_to :source, :foreign_key => :source_id, :polymorphic => true |
11 | 9 | belongs_to :person | ... | ... |
app/models/abuse_report.rb
app/models/action_tracker_notification.rb
... | ... | @@ -8,8 +8,6 @@ class ActionTrackerNotification < ActiveRecord::Base |
8 | 8 | validates_presence_of :profile_id, :action_tracker_id |
9 | 9 | validates_uniqueness_of :action_tracker_id, :scope => :profile_id |
10 | 10 | |
11 | - attr_accessible :profile_id, :action_tracker_id | |
12 | - | |
13 | 11 | end |
14 | 12 | |
15 | 13 | ActionTracker::Record.has_many :action_tracker_notifications, :class_name => 'ActionTrackerNotification', :foreign_key => 'action_tracker_id', :dependent => :destroy | ... | ... |
app/models/approve_comment.rb
... | ... | @@ -8,7 +8,7 @@ class ApproveComment < Task |
8 | 8 | def comment |
9 | 9 | unless @comment || self.comment_attributes.nil? |
10 | 10 | @comment = Comment.new |
11 | - @comment.assign_attributes(ActiveSupport::JSON.decode(self.comment_attributes.to_s), :without_protection => true) | |
11 | + @comment.assign_attributes ActiveSupport::JSON.decode(self.comment_attributes.to_s) | |
12 | 12 | end |
13 | 13 | @comment |
14 | 14 | end | ... | ... |
app/models/article.rb
1 | 1 | |
2 | 2 | class Article < ActiveRecord::Base |
3 | 3 | |
4 | - attr_accessible :name, :body, :abstract, :profile, :tag_list, :parent, | |
5 | - :allow_members_to_edit, :translation_of_id, :language, | |
6 | - :license_id, :parent_id, :display_posts_in_current_language, | |
7 | - :category_ids, :posts_per_page, :moderate_comments, | |
8 | - :accept_comments, :feed, :published, :source, :source_name, | |
9 | - :highlighted, :notify_comments, :display_hits, :slug, | |
10 | - :external_feed_builder, :display_versions, :external_link, | |
11 | - :image_builder, :show_to_followers, | |
12 | - :author, :display_preview, :published_at, :person_followers | |
13 | - | |
14 | 4 | acts_as_having_image |
15 | 5 | include Noosfero::Plugin::HotSpot |
16 | 6 | ... | ... |
app/models/article_block.rb
app/models/block.rb
1 | 1 | class Block < ActiveRecord::Base |
2 | 2 | |
3 | - attr_accessible :title, :subtitle, :display, :limit, :box_id, :posts_per_page, | |
4 | - :visualization_format, :language, :display_user, | |
5 | - :box, :edit_modes, :move_modes, :mirror | |
6 | - | |
7 | 3 | include ActionView::Helpers::TagHelper |
8 | 4 | |
9 | 5 | # Block-specific stuff | ... | ... |
app/models/blog.rb
1 | 1 | class Blog < Folder |
2 | 2 | |
3 | - attr_accessible :visualization_format | |
4 | - | |
5 | 3 | acts_as_having_posts |
6 | 4 | include PostsLimit |
7 | 5 | |
... | ... | @@ -55,7 +53,7 @@ class Blog < Folder |
55 | 53 | if self.external_feed(true) && self.external_feed.id == self.external_feed_data[:id].to_i |
56 | 54 | self.external_feed.attributes = self.external_feed_data.except(:id) |
57 | 55 | else |
58 | - self.build_external_feed(self.external_feed_data, :without_protection => true) | |
56 | + self.build_external_feed self.external_feed_data | |
59 | 57 | end |
60 | 58 | self.external_feed.valid? |
61 | 59 | self.external_feed.errors.delete(:blog_id) # dont validate here relation: external_feed <-> blog | ... | ... |
app/models/box.rb
... | ... | @@ -5,8 +5,6 @@ class Box < ActiveRecord::Base |
5 | 5 | belongs_to :owner, :polymorphic => true |
6 | 6 | has_many :blocks, -> { order 'position' }, dependent: :destroy |
7 | 7 | |
8 | - attr_accessible :owner | |
9 | - | |
10 | 8 | include Noosfero::Plugin::HotSpot |
11 | 9 | |
12 | 10 | scope :with_position, -> { where 'boxes.position > 0' } | ... | ... |
app/models/categories_block.rb
app/models/category.rb
app/models/certifier.rb
app/models/chat_message.rb
app/models/city.rb
app/models/comment.rb
... | ... | @@ -6,8 +6,6 @@ class Comment < ActiveRecord::Base |
6 | 6 | :body => {:label => _('Content'), :weight => 2}, |
7 | 7 | } |
8 | 8 | |
9 | - attr_accessible :body, :author, :name, :email, :title, :reply_of_id, :source, :follow_article | |
10 | - | |
11 | 9 | validates_presence_of :body |
12 | 10 | |
13 | 11 | belongs_to :source, :counter_cache => true, :polymorphic => true | ... | ... |
app/models/communities_block.rb
1 | 1 | class CommunitiesBlock < ProfileListBlock |
2 | 2 | |
3 | - attr_accessible :accessor_id, :accessor_type, :role_id, :resource_id, :resource_type | |
4 | - | |
5 | 3 | def self.description |
6 | 4 | _("<p>Display all of your communities.</p><p>You could choose the amount of communities will be displayed and you could priorize that profiles with images.</p> <p>The view all button is always present in the block.</p>") |
7 | 5 | end | ... | ... |
app/models/community.rb
app/models/create_community.rb
... | ... | @@ -9,15 +9,11 @@ class CreateCommunity < Task |
9 | 9 | alias :environment :target |
10 | 10 | alias :environment= :target= |
11 | 11 | |
12 | - attr_accessible :environment, :requestor, :target | |
13 | - attr_accessible :reject_explanation, :template_id | |
14 | - | |
15 | 12 | acts_as_having_image |
16 | 13 | |
17 | 14 | DATA_FIELDS = Community.fields + ['name', 'closed', 'description'] |
18 | 15 | DATA_FIELDS.each do |field| |
19 | 16 | settings_items field.to_sym |
20 | - attr_accessible field.to_sym | |
21 | 17 | end |
22 | 18 | |
23 | 19 | settings_items :custom_values | ... | ... |
app/models/custom_field.rb
1 | 1 | class CustomField < ActiveRecord::Base |
2 | - attr_accessible :name, :default_value, :format, :extras, :customized_type, :active, :required, :signup, :environment, :moderation_task | |
2 | + | |
3 | 3 | serialize :customized_type |
4 | 4 | serialize :extras |
5 | 5 | has_many :custom_field_values, :dependent => :delete_all | ... | ... |
app/models/custom_field_value.rb
app/models/domain.rb
app/models/enterprise.rb
... | ... | @@ -2,8 +2,6 @@ |
2 | 2 | # only enterprises can offer products and services. |
3 | 3 | class Enterprise < Organization |
4 | 4 | |
5 | - attr_accessible :business_name, :address_reference, :district, :tag_list, :organization_website, :historic_and_current_context, :activities_short_description, :products_per_catalog_page | |
6 | - | |
7 | 5 | SEARCH_FILTERS = { |
8 | 6 | :order => %w[more_recent more_popular more_active], |
9 | 7 | :display => %w[compact full map] | ... | ... |
app/models/environment.rb
... | ... | @@ -3,18 +3,6 @@ |
3 | 3 | # domains. |
4 | 4 | class Environment < ActiveRecord::Base |
5 | 5 | |
6 | - attr_accessible :name, :is_default, :signup_welcome_text_subject, | |
7 | - :signup_welcome_text_body, :terms_of_use, | |
8 | - :message_for_disabled_enterprise, :news_amount_by_folder, | |
9 | - :default_language, :languages, :description, | |
10 | - :organization_approval_method, :enabled_plugins, | |
11 | - :enabled_features, :redirection_after_login, | |
12 | - :redirection_after_signup, :contact_email, :theme, | |
13 | - :reports_lower_bound, :noreply_email, | |
14 | - :signup_welcome_screen_body, :members_whitelist_enabled, | |
15 | - :members_whitelist, :highlighted_news_amount, | |
16 | - :portal_news_amount, :date_format, :signup_intro | |
17 | - | |
18 | 6 | has_many :users |
19 | 7 | |
20 | 8 | # allow roles use | ... | ... |
app/models/event.rb
app/models/external_feed.rb
... | ... | @@ -10,8 +10,6 @@ class ExternalFeed < ActiveRecord::Base |
10 | 10 | where '(fetched_at is NULL) OR (fetched_at < ?)', Time.now - FeedUpdater.update_interval |
11 | 11 | } |
12 | 12 | |
13 | - attr_accessible :address, :enabled, :only_once | |
14 | - | |
15 | 13 | def add_item(title, link, date, content) |
16 | 14 | return if content.blank? |
17 | 15 | doc = Nokogiri::HTML.fragment content | ... | ... |
app/models/favorite_enterprise_person.rb
app/models/featured_products_block.rb
1 | 1 | class FeaturedProductsBlock < Block |
2 | 2 | |
3 | - attr_accessible :product_ids, :groups_of, :speed, :reflect | |
4 | - | |
5 | 3 | settings_items :product_ids, :type => Array, :default => [] |
6 | 4 | settings_items :groups_of, :type => :integer, :default => 3 |
7 | 5 | settings_items :speed, :type => :integer, :default => 1000 | ... | ... |
app/models/feed_reader_block.rb
app/models/forum.rb
... | ... | @@ -3,8 +3,6 @@ class Forum < Folder |
3 | 3 | acts_as_having_posts -> { reorder 'updated_at DESC' } |
4 | 4 | include PostsLimit |
5 | 5 | |
6 | - attr_accessible :has_terms_of_use, :terms_of_use, :topic_creation | |
7 | - | |
8 | 6 | settings_items :terms_of_use, :type => :string, :default => "" |
9 | 7 | settings_items :has_terms_of_use, :type => :boolean, :default => false |
10 | 8 | settings_items :topic_creation, :type => :string, :default => 'self' | ... | ... |
app/models/highlights_block.rb
1 | 1 | class HighlightsBlock < Block |
2 | 2 | |
3 | - attr_accessible :images, :interval, :shuffle, :navigation | |
4 | - | |
5 | 3 | settings_items :images, :type => Array, :default => [] |
6 | 4 | settings_items :interval, :type => 'integer', :default => 4 |
7 | 5 | settings_items :shuffle, :type => 'boolean', :default => false | ... | ... |
app/models/image.rb
app/models/input.rb
app/models/license.rb
1 | 1 | class License < ActiveRecord::Base |
2 | 2 | |
3 | - attr_accessible :name, :url | |
4 | - | |
5 | 3 | SEARCHABLE_FIELDS = { |
6 | 4 | :name => {:label => _('Name'), :weight => 10}, |
7 | 5 | :url => {:label => _('URL'), :weight => 5}, |
... | ... | @@ -14,8 +12,6 @@ class License < ActiveRecord::Base |
14 | 12 | validates_presence_of :slug, :if => lambda {|license| license.name.present?} |
15 | 13 | validates_uniqueness_of :slug, :scope => :environment_id |
16 | 14 | |
17 | - attr_accessible :environment, :slug | |
18 | - | |
19 | 15 | before_validation do |license| |
20 | 16 | license.slug ||= license.name.to_slug if license.name.present? |
21 | 17 | end | ... | ... |
app/models/link_article.rb
app/models/link_list_block.rb
app/models/location_block.rb
app/models/mailing_sent.rb
app/models/my_network_block.rb
app/models/organization.rb
1 | 1 | # Represents any organization of the system |
2 | 2 | class Organization < Profile |
3 | 3 | |
4 | - attr_accessible :moderated_articles, :foundation_year, :contact_person, :acronym, :legal_form, :economic_activity, :management_information, :cnpj, :display_name, :enable_contact_us | |
5 | - | |
6 | 4 | SEARCH_FILTERS = { |
7 | 5 | :order => %w[more_recent more_popular more_active], |
8 | 6 | :display => %w[compact] | ... | ... |
app/models/person.rb
1 | 1 | # A person is the profile of an user holding all relationships with the rest of the system |
2 | 2 | class Person < Profile |
3 | 3 | |
4 | - attr_accessible :organization, :contact_information, :sex, :birth_date, :cell_phone, :comercial_phone, :jabber_id, :personal_website, :nationality, :address_reference, :district, :schooling, :schooling_status, :formation, :custom_formation, :area_of_study, :custom_area_of_study, :professional_activity, :organization_website, :following_articles | |
5 | - | |
6 | 4 | SEARCH_FILTERS = { |
7 | 5 | :order => %w[more_recent more_popular more_active], |
8 | 6 | :display => %w[compact] |
9 | 7 | } |
10 | 8 | |
11 | - | |
12 | 9 | def self.type_name |
13 | 10 | _('Person') |
14 | 11 | end | ... | ... |
app/models/price_detail.rb
app/models/product.rb
... | ... | @@ -10,9 +10,6 @@ class Product < ActiveRecord::Base |
10 | 10 | :display => %w[full map] |
11 | 11 | } |
12 | 12 | |
13 | - attr_accessible :name, :product_category, :profile, :profile_id, :enterprise, | |
14 | - :highlighted, :price, :image_builder, :description, :available, :qualifiers, :unit_id, :discount, :inputs, :qualifiers_list | |
15 | - | |
16 | 13 | def self.default_search_display |
17 | 14 | 'full' |
18 | 15 | end | ... | ... |
app/models/product_category.rb
... | ... | @@ -3,8 +3,6 @@ class ProductCategory < Category |
3 | 3 | has_many :products |
4 | 4 | has_many :inputs |
5 | 5 | |
6 | - attr_accessible :name, :parent, :environment | |
7 | - | |
8 | 6 | scope :unique, -> { select 'DISTINCT ON (path) categories.*' } |
9 | 7 | scope :by_enterprise, -> enterprise { |
10 | 8 | distinct.joins(:products). | ... | ... |
app/models/product_qualifier.rb
app/models/production_cost.rb
app/models/products_block.rb
app/models/profile.rb
... | ... | @@ -3,10 +3,6 @@ |
3 | 3 | # which by default is the one returned by Environment:default. |
4 | 4 | class Profile < ActiveRecord::Base |
5 | 5 | |
6 | - attr_accessible :name, :identifier, :public_profile, :nickname, :custom_footer, :custom_header, :address, :zip_code, :contact_phone, :image_builder, :description, :closed, :template_id, :environment, :lat, :lng, :is_template, :fields_privacy, :preferred_domain_id, :category_ids, :country, :city, :state, :national_region_code, :email, :contact_email, :redirect_l10n, :notification_time, | |
7 | - :redirection_after_login, :custom_url_redirection, | |
8 | - :email_suggestions, :allow_members_to_invite, :invite_friends_only, :secret, :profile_admin_mail_notification | |
9 | - | |
10 | 6 | # use for internationalizable human type names in search facets |
11 | 7 | # reimplement on subclasses |
12 | 8 | def self.type_name | ... | ... |
app/models/profile_activity.rb
app/models/profile_image_block.rb
app/models/profile_list_block.rb
app/models/profile_suggestion.rb
1 | 1 | class ProfileSuggestion < ActiveRecord::Base |
2 | + | |
2 | 3 | belongs_to :person |
3 | 4 | belongs_to :suggestion, :class_name => 'Profile', :foreign_key => :suggestion_id |
4 | 5 | |
5 | - attr_accessible :person, :suggestion, :suggestion_type, :categories, :enabled | |
6 | - | |
7 | 6 | has_many :suggestion_connections, :foreign_key => 'suggestion_id' |
8 | 7 | has_many :profile_connections, :through => :suggestion_connections, :source => :connection, :source_type => 'Profile' |
9 | 8 | has_many :tag_connections, :through => :suggestion_connections, :source => :connection, :source_type => 'ActsAsTaggableOn::Tag' |
... | ... | @@ -67,7 +66,6 @@ class ProfileSuggestion < ActiveRecord::Base |
67 | 66 | |
68 | 67 | RULES.keys.each do |rule| |
69 | 68 | settings_items rule |
70 | - attr_accessible rule | |
71 | 69 | end |
72 | 70 | |
73 | 71 | # Number of suggestions by rule | ... | ... |
app/models/qualifier.rb
app/models/raw_html_block.rb
app/models/region.rb
1 | 1 | # Region is a special type of category that is related to geographical issues. |
2 | 2 | class Region < Category |
3 | 3 | |
4 | - attr_accessible :name | |
5 | - | |
6 | 4 | has_and_belongs_to_many :validators, :class_name => 'Organization', :join_table => :region_validators |
7 | 5 | |
8 | 6 | require_dependency 'enterprise' # enterprises can also be validators | ... | ... |
app/models/rss_feed.rb
app/models/scrap.rb
app/models/search_term.rb
... | ... | @@ -5,8 +5,6 @@ class SearchTerm < ActiveRecord::Base |
5 | 5 | belongs_to :context, :polymorphic => true |
6 | 6 | has_many :occurrences, :class_name => 'SearchTermOccurrence' |
7 | 7 | |
8 | - attr_accessible :term, :context, :asset | |
9 | - | |
10 | 8 | def self.calculate_scores |
11 | 9 | os = occurrences_scores |
12 | 10 | find_each { |search_term| search_term.calculate_score(os) } | ... | ... |
app/models/search_term_occurrence.rb
app/models/sellers_search_block.rb
app/models/slideshow_block.rb
... | ... | @@ -6,8 +6,6 @@ class SlideshowBlock < Block |
6 | 6 | settings_items :navigation, :type => 'boolean', :default => false |
7 | 7 | settings_items :image_size, :type => 'string', :default => 'thumb' |
8 | 8 | |
9 | - attr_accessible :gallery_id, :image_size, :interval, :shuffle, :navigation | |
10 | - | |
11 | 9 | def self.description |
12 | 10 | _('Slideshow') |
13 | 11 | end | ... | ... |
app/models/state.rb
app/models/suggestion_connection.rb
1 | 1 | class SuggestionConnection < ActiveRecord::Base |
2 | - attr_accessible :suggestion, :suggestion_id, :connection_type, :connection_id | |
3 | 2 | |
4 | 3 | belongs_to :suggestion, :class_name => 'ProfileSuggestion', :foreign_key => 'suggestion_id' |
5 | 4 | belongs_to :connection, :polymorphic => true |
5 | + | |
6 | 6 | end | ... | ... |
app/models/tag.rb
app/models/task.rb
app/models/thumbnail.rb
1 | 1 | class Thumbnail < ActiveRecord::Base |
2 | 2 | |
3 | - attr_accessible :uploaded_data | |
4 | - # mass assigned by attachment_fu | |
5 | - attr_accessible :content_type, :filename, :thumbnail_resize_options, :thumbnail, :parent_id | |
6 | - | |
7 | 3 | has_attachment :storage => :file_system, |
8 | 4 | :content_type => :image, :max_size => UploadedFile.max_size, processor: 'Rmagick' |
9 | 5 | validates_as_attachment | ... | ... |
app/models/unit.rb
app/models/uploaded_file.rb
app/models/user.rb
... | ... | @@ -6,8 +6,6 @@ require 'securerandom' |
6 | 6 | # Rails generator. |
7 | 7 | class User < ActiveRecord::Base |
8 | 8 | |
9 | - attr_accessible :login, :email, :password, :password_confirmation, :activated_at | |
10 | - | |
11 | 9 | N_('Password') |
12 | 10 | N_('Password confirmation') |
13 | 11 | N_('Terms accepted') |
... | ... | @@ -110,8 +108,6 @@ class User < ActiveRecord::Base |
110 | 108 | # holds the current session, see lib/authenticated_system.rb |
111 | 109 | attr_accessor :session |
112 | 110 | |
113 | - attr_protected :activated_at | |
114 | - | |
115 | 111 | # Virtual attribute for the unencrypted password |
116 | 112 | attr_accessor :password, :name |
117 | 113 | ... | ... |
app/models/validation_info.rb
config/application.rb
... | ... | @@ -72,12 +72,6 @@ module Noosfero |
72 | 72 | # like if you have constraints or database-specific column types |
73 | 73 | # config.active_record.schema_format = :sql |
74 | 74 | |
75 | - # Enforce whitelist mode for mass assignment. | |
76 | - # This will create an empty whitelist of attributes available for mass-assignment for all models | |
77 | - # in your app. As such, your models will need to explicitly whitelist or blacklist accessible | |
78 | - # parameters by using an attr_accessible or attr_protected declaration. | |
79 | - config.active_record.whitelist_attributes = true | |
80 | - | |
81 | 75 | # Asset pipeline |
82 | 76 | config.assets.paths = |
83 | 77 | Dir.glob("app/assets/plugins/*/{,stylesheets,javascripts}") + | ... | ... |
config/environments/development.rb
... | ... | @@ -20,9 +20,6 @@ Noosfero::Application.configure do |
20 | 20 | # Only use best-standards-support built into browsers |
21 | 21 | config.action_dispatch.best_standards_support = :builtin |
22 | 22 | |
23 | - # Raise exception on mass assignment protection for Active Record models | |
24 | - config.active_record.mass_assignment_sanitizer = :strict | |
25 | - | |
26 | 23 | # Do not compress assets |
27 | 24 | config.assets.compress = false |
28 | 25 | config.assets.digest = false | ... | ... |
config/environments/test.rb
... | ... | @@ -25,9 +25,6 @@ Noosfero::Application.configure do |
25 | 25 | # ActionMailer::Base.deliveries array. |
26 | 26 | config.action_mailer.delivery_method = :test |
27 | 27 | |
28 | - # Raise exception on mass assignment protection for Active Record models | |
29 | - config.active_record.mass_assignment_sanitizer = :strict | |
30 | - | |
31 | 28 | # Print deprecation notices to the stderr |
32 | 29 | config.active_support.deprecation = :stderr |
33 | 30 | end | ... | ... |
config/initializers/03_protected_attributes.rb
features/step_definitions/noosfero_steps.rb
... | ... | @@ -31,7 +31,7 @@ Given /^the following (community|communities|enterprises?|organizations?)$/ do | |
31 | 31 | category = row.delete("category") |
32 | 32 | img_name = row.delete("img") |
33 | 33 | city = row.delete("region") |
34 | - organization = klass.create!(row, :without_protection => true) | |
34 | + organization = klass.create! row | |
35 | 35 | if owner |
36 | 36 | organization.add_admin(Profile[owner]) |
37 | 37 | end |
... | ... | @@ -204,7 +204,7 @@ Given /^the following products?$/ do |table| |
204 | 204 | qualifier = Qualifier.find_by name: data.delete("qualifier") |
205 | 205 | data.merge!(:qualifiers => [qualifier]) |
206 | 206 | end |
207 | - product = Product.create!(data, :without_protection => true) | |
207 | + product = Product.create! data | |
208 | 208 | end |
209 | 209 | end |
210 | 210 | |
... | ... | @@ -215,8 +215,8 @@ Given /^the following inputs?$/ do |table| |
215 | 215 | category = Category.find_by slug: data.delete("category").to_slug |
216 | 216 | unit = Unit.find_by singular: data.delete("unit") |
217 | 217 | solidary = data.delete("solidary") |
218 | - input = Input.create!(data.merge(:product => product, :product_category => category, :unit => unit, | |
219 | - :is_from_solidarity_economy => solidary), :without_protection => true) | |
218 | + input = Input.create! data.merge(product: product, product_category: category, unit: unit, | |
219 | + is_from_solidarity_economy: solidary) | |
220 | 220 | input.update_attribute(:position, data['position']) |
221 | 221 | end |
222 | 222 | end |
... | ... | @@ -254,7 +254,7 @@ end |
254 | 254 | |
255 | 255 | Given /^the following qualifiers$/ do |table| |
256 | 256 | table.hashes.each do |row| |
257 | - Qualifier.create!(row.merge(:environment_id => 1), :without_protection => true) | |
257 | + Qualifier.create! row.merge(environment_id: 1) | |
258 | 258 | end |
259 | 259 | end |
260 | 260 | |
... | ... | @@ -265,7 +265,7 @@ Given /^the following certifiers$/ do |table| |
265 | 265 | if qualifiers_list |
266 | 266 | row["qualifiers"] = qualifiers_list.split(', ').map{|i| Qualifier.find_by name: i } |
267 | 267 | end |
268 | - Certifier.create!(row.merge(:environment_id => 1), :without_protection => true) | |
268 | + Certifier.create! row.merge(environment_id: 1) | |
269 | 269 | end |
270 | 270 | end |
271 | 271 | |
... | ... | @@ -505,7 +505,7 @@ end |
505 | 505 | |
506 | 506 | Given /^the following units?$/ do |table| |
507 | 507 | table.hashes.each do |row| |
508 | - Unit.create!(row.merge(:environment_id => 1), :without_protection => true) | |
508 | + Unit.create! row.merge(environment_id: 1) | |
509 | 509 | end |
510 | 510 | end |
511 | 511 | ... | ... |
lib/acts_as_customizable.rb
lib/acts_as_having_image.rb
... | ... | @@ -5,7 +5,6 @@ module ActsAsHavingImage |
5 | 5 | belongs_to :image, dependent: :destroy |
6 | 6 | scope :with_image, -> { where "#{table_name}.image_id IS NOT NULL" } |
7 | 7 | scope :without_image, -> { where "#{table_name}.image_id IS NULL" } |
8 | - attr_accessible :image_builder | |
9 | 8 | include ActsAsHavingImage |
10 | 9 | end |
11 | 10 | end | ... | ... |
plugins/analytics/models/analytics_plugin/page_view.rb
... | ... | @@ -2,11 +2,7 @@ class AnalyticsPlugin::PageView < ActiveRecord::Base |
2 | 2 | |
3 | 3 | serialize :data |
4 | 4 | |
5 | - attr_accessible *self.column_names | |
6 | - attr_accessible :user, :profile | |
7 | - | |
8 | 5 | attr_accessor :request |
9 | - attr_accessible :request | |
10 | 6 | |
11 | 7 | acts_as_having_settings field: :options |
12 | 8 | ... | ... |
plugins/analytics/models/analytics_plugin/visit.rb
plugins/breadcrumbs/lib/breadcrumbs_plugin/content_breadcrumbs_block.rb
... | ... | @@ -4,8 +4,6 @@ class BreadcrumbsPlugin::ContentBreadcrumbsBlock < Block |
4 | 4 | settings_items :show_profile, :type => :boolean, :default => true |
5 | 5 | settings_items :show_section_name, :type => :boolean, :default => true |
6 | 6 | |
7 | - attr_accessible :show_cms_action, :show_profile, :show_section_name | |
8 | - | |
9 | 7 | def self.description |
10 | 8 | _("<p>Display a breadcrumb of the current content navigation.</p><p>You could choose if the breadcrumb is going to appear in the cms editing or not.</p> <p>There is either the option of display the profile location in the breadcrumb path.</p>") |
11 | 9 | end | ... | ... |
plugins/comment_classification/lib/comment_classification_plugin/comment_label_user.rb
... | ... | @@ -5,8 +5,6 @@ class CommentClassificationPlugin::CommentLabelUser < ActiveRecord::Base |
5 | 5 | belongs_to :comment |
6 | 6 | belongs_to :label, :class_name => 'CommentClassificationPlugin::Label' |
7 | 7 | |
8 | - attr_accessible :profile, :comment, :label | |
9 | - | |
10 | 8 | validates_presence_of :profile |
11 | 9 | validates_presence_of :comment |
12 | 10 | validates_presence_of :label | ... | ... |
plugins/comment_classification/lib/comment_classification_plugin/comment_status_user.rb
... | ... | @@ -5,8 +5,6 @@ class CommentClassificationPlugin::CommentStatusUser < ActiveRecord::Base |
5 | 5 | belongs_to :comment |
6 | 6 | belongs_to :status, :class_name => 'CommentClassificationPlugin::Status' |
7 | 7 | |
8 | - attr_accessible :name, :enabled, :profile, :comment, :status_id, :reason | |
9 | - | |
10 | 8 | validates_presence_of :profile |
11 | 9 | validates_presence_of :comment |
12 | 10 | validates_presence_of :status | ... | ... |
plugins/comment_classification/lib/comment_classification_plugin/label.rb
plugins/comment_classification/lib/comment_classification_plugin/status.rb
plugins/comment_group/lib/ext/comment.rb
plugins/comment_paragraph/lib/ext/comment.rb
... | ... | @@ -11,8 +11,6 @@ class Comment |
11 | 11 | where 'paragraph_uuid = ?', paragraph_uuid |
12 | 12 | } |
13 | 13 | |
14 | - attr_accessible :paragraph_uuid, :comment_paragraph_selected_area, :id, :comment_paragraph_selected_content | |
15 | - | |
16 | 14 | before_validation do |comment| |
17 | 15 | comment.comment_paragraph_selected_area = nil if comment.comment_paragraph_selected_area.blank? |
18 | 16 | comment.comment_paragraph_selected_content = nil if comment_paragraph_selected_content.blank? | ... | ... |
plugins/community_track/lib/community_track_plugin/step.rb
... | ... | @@ -3,8 +3,6 @@ class CommunityTrackPlugin::Step < Folder |
3 | 3 | settings_items :hidden, :type => :boolean, :default => false |
4 | 4 | settings_items :tool_type, :type => String |
5 | 5 | |
6 | - attr_accessible :start_date, :end_date, :tool_type, :hidden | |
7 | - | |
8 | 6 | alias :tools :children |
9 | 7 | |
10 | 8 | acts_as_list scope: -> step { where parent_id: step.parent_id } | ... | ... |
plugins/community_track/lib/community_track_plugin/track.rb
plugins/context_content/lib/context_content_plugin/context_content_block.rb
... | ... | @@ -7,8 +7,6 @@ class ContextContentPlugin::ContextContentBlock < Block |
7 | 7 | settings_items :types, :type => Array, :default => ['UploadedFile'] |
8 | 8 | settings_items :limit, :type => :integer, :default => 6 |
9 | 9 | |
10 | - attr_accessible :show_image, :show_name, :use_parent_title, :show_parent_content, :types | |
11 | - | |
12 | 10 | alias :profile :owner |
13 | 11 | |
14 | 12 | include Noosfero::Plugin::HotSpot | ... | ... |
plugins/custom_forms/lib/custom_forms_plugin/alternative.rb
plugins/custom_forms/lib/custom_forms_plugin/answer.rb
... | ... | @@ -6,8 +6,6 @@ class CustomFormsPlugin::Answer < ActiveRecord::Base |
6 | 6 | validates_presence_of :field |
7 | 7 | validate :value_mandatory, :if => 'field.present?' |
8 | 8 | |
9 | - attr_accessible :field, :value, :submission | |
10 | - | |
11 | 9 | def value_mandatory |
12 | 10 | if field.mandatory && value.blank? |
13 | 11 | errors.add(:value, _("is mandatory.").fix_i18n) | ... | ... |
plugins/custom_forms/lib/custom_forms_plugin/field.rb
... | ... | @@ -4,8 +4,6 @@ class CustomFormsPlugin::Field < ActiveRecord::Base |
4 | 4 | validates_presence_of :name |
5 | 5 | validates_length_of :default_value, :maximum => 255 |
6 | 6 | |
7 | - attr_accessible :name, :form, :mandatory, :type, :position, :default_value, :show_as, :alternatives_attributes | |
8 | - | |
9 | 7 | belongs_to :form, :class_name => 'CustomFormsPlugin::Form' |
10 | 8 | has_many :answers, :class_name => 'CustomFormsPlugin::Answer', :dependent => :destroy |
11 | 9 | ... | ... |
plugins/custom_forms/lib/custom_forms_plugin/form.rb
... | ... | @@ -14,8 +14,6 @@ class CustomFormsPlugin::Form < ActiveRecord::Base |
14 | 14 | validate :period_range, :if => Proc.new { |f| f.begining.present? && f.ending.present? } |
15 | 15 | validate :access_format |
16 | 16 | |
17 | - attr_accessible :name, :profile, :for_admission, :access, :begining, :ending, :description, :fields_attributes, :profile_id, :on_membership | |
18 | - | |
19 | 17 | before_validation do |form| |
20 | 18 | form.slug = form.name.to_slug if form.name.present? |
21 | 19 | form.access = nil if form.access.blank? | ... | ... |
plugins/custom_forms/lib/custom_forms_plugin/submission.rb
... | ... | @@ -6,8 +6,6 @@ class CustomFormsPlugin::Submission < ActiveRecord::Base |
6 | 6 | # validation is done manually, see below |
7 | 7 | has_many :answers, :class_name => 'CustomFormsPlugin::Answer', :dependent => :destroy, :validate => false |
8 | 8 | |
9 | - attr_accessible :form, :profile, :author_name, :author_email | |
10 | - | |
11 | 9 | validates_presence_of :form |
12 | 10 | validates_presence_of :author_name, :author_email, :if => lambda {|submission| submission.profile.nil?} |
13 | 11 | validates_uniqueness_of :author_email, :scope => :form_id, :allow_nil => true | ... | ... |
plugins/delivery/models/delivery_plugin/method.rb
... | ... | @@ -7,9 +7,6 @@ class DeliveryPlugin::Method < ActiveRecord::Base |
7 | 7 | address address_line2 address_reference district city state country_name zip_code |
8 | 8 | ].map(&:to_sym) |
9 | 9 | |
10 | - attr_accessible :profile, :delivery_type, :name, :description, | |
11 | - :fixed_cost, :free_over_price, :distribution_margin_percentage, :distribution_margin_fixed | |
12 | - | |
13 | 10 | belongs_to :profile |
14 | 11 | |
15 | 12 | has_many :delivery_options, class_name: 'DeliveryPlugin::Option', foreign_key: :delivery_method_id, dependent: :destroy | ... | ... |
plugins/delivery/models/delivery_plugin/option.rb
plugins/display_content/lib/display_content_block.rb
... | ... | @@ -29,8 +29,6 @@ class DisplayContentBlock < Block |
29 | 29 | settings_items :content_with_translations, :type => :boolean, :default => :true |
30 | 30 | settings_items :limit_to_show, :type => :integer, :default => 6 |
31 | 31 | |
32 | - attr_accessible :sections, :checked_nodes, :display_folder_children, :types, :order_by_recent, :limit_to_show, :content_with_translations | |
33 | - | |
34 | 32 | def self.description |
35 | 33 | _('Display your contents') |
36 | 34 | end | ... | ... |
plugins/driven_signup/models/driven_signup_plugin/auth.rb
plugins/environment_notification/lib/environment_notifications_user.rb
... | ... | @@ -4,7 +4,5 @@ class EnvironmentNotificationsUser < ActiveRecord::Base |
4 | 4 | belongs_to :user |
5 | 5 | belongs_to :environment_notification, class_name: 'EnvironmentNotificationPlugin::EnvironmentNotification' |
6 | 6 | |
7 | - attr_accessible :user_id, :environment_notification_id | |
8 | - | |
9 | 7 | validates_uniqueness_of :user_id, :scope => :environment_notification_id |
10 | 8 | end | ... | ... |
plugins/environment_notification/models/environment_notification_plugin/environment_notification.rb
... | ... | @@ -9,8 +9,6 @@ class EnvironmentNotificationPlugin::EnvironmentNotification < ActiveRecord::Bas |
9 | 9 | "EnvironmentNotificationPlugin::DangerNotification" |
10 | 10 | ] |
11 | 11 | |
12 | - attr_accessible :message, :environment_id, :active, :type, :display_only_in_homepage, :display_to_all_users, :display_popup, :title | |
13 | - | |
14 | 12 | has_many :environment_notifications_users |
15 | 13 | has_many :users, :through => :environment_notifications_users |
16 | 14 | ... | ... |
plugins/event/lib/event_plugin/event_block.rb
1 | 1 | class EventPlugin::EventBlock < Block |
2 | 2 | include DatesHelper |
3 | 3 | |
4 | - attr_accessible :all_env_events, :limit, :future_only, :date_distance_limit | |
5 | - | |
6 | 4 | settings_items :all_env_events, :type => :boolean, :default => false |
7 | 5 | settings_items :limit, :type => :integer, :default => 4 |
8 | 6 | settings_items :future_only, :type => :boolean, :default => true | ... | ... |
plugins/fb_app/lib/ext/profile.rb
... | ... | @@ -2,13 +2,6 @@ require_dependency 'profile' |
2 | 2 | # hate to wrte this, but without Noosfero::Plugin::Settings is loaded instead |
3 | 3 | require 'fb_app_plugin/settings' |
4 | 4 | |
5 | -# attr_accessible must be defined on subclasses | |
6 | -Profile.descendants.each do |subclass| | |
7 | - subclass.class_eval do | |
8 | - attr_accessible :fb_app_settings | |
9 | - end | |
10 | -end | |
11 | - | |
12 | 5 | class Profile |
13 | 6 | |
14 | 7 | def fb_app_settings attrs = {} | ... | ... |
plugins/fb_app/models/fb_app_plugin/auth.rb
... | ... | @@ -9,8 +9,6 @@ class FbAppPlugin::Auth < OauthClientPlugin::Auth |
9 | 9 | settings_items :signed_request |
10 | 10 | settings_items :fb_user |
11 | 11 | |
12 | - attr_accessible :provider_user_id, :signed_request | |
13 | - | |
14 | 12 | before_create :update_user |
15 | 13 | before_create :exchange_token |
16 | 14 | after_create :schedule_exchange_token | ... | ... |
plugins/fb_app/models/fb_app_plugin/page_tab.rb
... | ... | @@ -3,10 +3,6 @@ class FbAppPlugin::PageTab < ActiveRecord::Base |
3 | 3 | # FIXME: rename table to match model |
4 | 4 | self.table_name = :fb_app_plugin_page_tab_configs |
5 | 5 | |
6 | - attr_accessible :owner_profile, :profile_id, :page_id, | |
7 | - :config_type, :profile_ids, :query, | |
8 | - :title, :subtitle | |
9 | - | |
10 | 6 | belongs_to :owner_profile, foreign_key: :profile_id, class_name: 'Profile' |
11 | 7 | |
12 | 8 | acts_as_having_settings field: :config | ... | ... |
plugins/gallery_block/lib/gallery_block.rb
plugins/google_analytics/lib/ext/profile.rb
plugins/lattes_curriculum/lib/academic_info.rb
plugins/lattes_curriculum/lib/ext/person.rb
plugins/ldap/lib/ext/environment.rb
... | ... | @@ -6,8 +6,6 @@ class Environment |
6 | 6 | |
7 | 7 | validates_presence_of :ldap_plugin_host, :if => lambda {|env| !env.ldap_plugin.blank? } |
8 | 8 | |
9 | - 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 | |
10 | - | |
11 | 9 | def ldap_plugin_attributes |
12 | 10 | self.ldap_plugin || {} |
13 | 11 | end | ... | ... |
plugins/newsletter/lib/newsletter_plugin/newsletter.rb
... | ... | @@ -9,8 +9,6 @@ class NewsletterPlugin::Newsletter < ActiveRecord::Base |
9 | 9 | validates_numericality_of :periodicity, only_integer: true, greater_than: -1, message: _('must be a positive number') |
10 | 10 | validates_numericality_of :posts_per_blog, only_integer: true, greater_than: -1, message: _('must be a positive number') |
11 | 11 | |
12 | - attr_accessible :environment, :enabled, :periodicity, :subject, :posts_per_blog, :footer, :blog_ids, :additional_recipients, :person, :person_id, :moderated | |
13 | - | |
14 | 12 | scope :enabled, -> { where enabled: true } |
15 | 13 | |
16 | 14 | # These methods are used by NewsletterMailing | ... | ... |
plugins/newsletter/lib/newsletter_plugin/newsletter_mailing.rb
plugins/oauth_client/models/oauth_client_plugin/auth.rb
plugins/oauth_client/models/oauth_client_plugin/provider.rb
... | ... | @@ -10,10 +10,6 @@ class OauthClientPlugin::Provider < ActiveRecord::Base |
10 | 10 | settings_items :site, type: String |
11 | 11 | settings_items :client_options, type: Hash |
12 | 12 | |
13 | - attr_accessible :name, :strategy, :enabled, :site, :image_builder, | |
14 | - :environment, :environment_id, :options, | |
15 | - :client_id, :client_secret, :client_options | |
16 | - | |
17 | 13 | scope :enabled, -> { where enabled: true } |
18 | 14 | |
19 | 15 | acts_as_having_image | ... | ... |
plugins/open_graph/lib/ext/profile.rb
... | ... | @@ -2,11 +2,8 @@ require_dependency 'profile' |
2 | 2 | # hate to wrte this, but without Noosfero::Plugin::Settings is loaded instead |
3 | 3 | require 'open_graph_plugin/settings' |
4 | 4 | |
5 | -# attr_accessible must be defined on subclasses | |
6 | 5 | Profile.descendants.each do |subclass| |
7 | 6 | subclass.class_eval do |
8 | - attr_accessible :open_graph_settings | |
9 | - | |
10 | 7 | has_many :open_graph_tracks, class_name: 'OpenGraphPlugin::Track', source: :tracker_id, foreign_key: :tracker_id |
11 | 8 | |
12 | 9 | 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| |
21 | 18 | association = klass.association |
22 | 19 | has_many association, class_name: klass.name, foreign_key: :tracker_id |
23 | 20 | accepts_nested_attributes_for association, allow_destroy: true, reject_if: :open_graph_reject_empty_object_type |
24 | - | |
25 | - attr_accessible attributes | |
26 | - attr_accessible profile_ids | |
27 | 21 | end |
28 | 22 | end |
29 | 23 | end | ... | ... |
plugins/open_graph/models/open_graph_plugin/track.rb
... | ... | @@ -3,10 +3,6 @@ class OpenGraphPlugin::Track < ActiveRecord::Base |
3 | 3 | class_attribute :context |
4 | 4 | self.context = :open_graph |
5 | 5 | |
6 | - attr_accessible :type, :context, :tracker_id, :tracker, :actor_id, :action, | |
7 | - :object_type, :object_data_id, :object_data_type, :object_data_url, | |
8 | - :story, :object_data, :actor | |
9 | - | |
10 | 6 | belongs_to :tracker, class_name: 'Profile' |
11 | 7 | belongs_to :actor, class_name: 'Profile' |
12 | 8 | belongs_to :object_data, polymorphic: true | ... | ... |
plugins/orders/lib/orders_plugin/date_range_attr.rb
plugins/orders/models/orders_plugin/item.rb
1 | 1 | class OrdersPlugin::Item < ActiveRecord::Base |
2 | 2 | |
3 | - attr_accessible :order, :sale, :purchase, | |
4 | - :product, :product_id, | |
5 | - :price, :name | |
6 | - | |
7 | 3 | # flag used by items to compare them with products |
8 | 4 | attr_accessor :product_diff |
9 | 5 | |
... | ... | @@ -28,9 +24,6 @@ class OrdersPlugin::Item < ActiveRecord::Base |
28 | 24 | StatusDataMap.each do |status, data| |
29 | 25 | quantity = "quantity_#{data}".to_sym |
30 | 26 | price = "price_#{data}".to_sym |
31 | - | |
32 | - attr_accessible quantity | |
33 | - attr_accessible price | |
34 | 27 | end |
35 | 28 | |
36 | 29 | serialize :data | ... | ... |
plugins/orders/models/orders_plugin/order.rb
... | ... | @@ -40,9 +40,6 @@ class OrdersPlugin::Order < ActiveRecord::Base |
40 | 40 | supplier: StatusAccessMap.map{ |s, a| s if a == :supplier }.compact, |
41 | 41 | } |
42 | 42 | |
43 | - attr_accessible :status, :consumer, :profile, | |
44 | - :supplier_delivery_id, :consumer_delivery_id, :supplier_delivery_data, :consumer_delivery_data | |
45 | - | |
46 | 43 | belongs_to :profile |
47 | 44 | # may be override by subclasses |
48 | 45 | belongs_to :supplier, foreign_key: :profile_id, class_name: 'Profile' | ... | ... |
plugins/orders_cycle/models/orders_cycle_plugin/cycle.rb
1 | 1 | class OrdersCyclePlugin::Cycle < ActiveRecord::Base |
2 | 2 | |
3 | - attr_accessible :profile, :status, :name, :description, :opening_message | |
4 | - | |
5 | - attr_accessible :start, :finish, :delivery_start, :delivery_finish | |
6 | - attr_accessible :start_date, :start_time, :finish_date, :finish_time, :delivery_start_date, :delivery_start_time, :delivery_finish_date, :delivery_finish_time, | |
7 | - | |
8 | 3 | Statuses = %w[edition orders purchases receipts separation delivery closing] |
9 | 4 | DbStatuses = %w[new] + Statuses |
10 | 5 | UserStatuses = Statuses |
... | ... | @@ -72,7 +67,6 @@ class OrdersCyclePlugin::Cycle < ActiveRecord::Base |
72 | 67 | |
73 | 68 | has_many :volunteers_periods, class_name: 'VolunteersPlugin::Period', as: :owner |
74 | 69 | has_many :volunteers, through: :volunteers_periods, source: :profile |
75 | - attr_accessible :volunteers_periods_attributes | |
76 | 70 | accepts_nested_attributes_for :volunteers_periods, allow_destroy: true |
77 | 71 | |
78 | 72 | scope :has_volunteers_periods, -> { distinct.joins :volunteers_periods } | ... | ... |
plugins/orders_cycle/models/orders_cycle_plugin/order_base.rb
... | ... | @@ -4,8 +4,6 @@ module OrdersCyclePlugin::OrderBase |
4 | 4 | extend ActiveSupport::Concern |
5 | 5 | included do |
6 | 6 | |
7 | - attr_accessible :cycle | |
8 | - | |
9 | 7 | has_many :cycle_sales, class_name: 'OrdersCyclePlugin::CycleOrder', foreign_key: :sale_id, dependent: :destroy |
10 | 8 | has_one :cycle_sale, class_name: 'OrdersCyclePlugin::CycleOrder', foreign_key: :sale_id |
11 | 9 | has_many :cycle_purchases, class_name: 'OrdersCyclePlugin::CycleOrder', foreign_key: :purchase_id, dependent: :destroy | ... | ... |
plugins/organization_ratings/lib/create_organization_rating_comment.rb
... | ... | @@ -6,9 +6,6 @@ class CreateOrganizationRatingComment < Task |
6 | 6 | settings_items :organization_rating_id, :type => Integer, :default => nil |
7 | 7 | settings_items :organization_rating_comment_id, :type => Integer, :default => nil |
8 | 8 | |
9 | - attr_accessible :organization_rating_id, :body, :requestor | |
10 | - attr_accessible :reject_explanation, :target | |
11 | - | |
12 | 9 | DATA_FIELDS = ['body'] |
13 | 10 | DATA_FIELDS.each do |field| |
14 | 11 | settings_items field.to_sym | ... | ... |
plugins/organization_ratings/lib/organization_rating.rb
... | ... | @@ -3,8 +3,6 @@ class OrganizationRating < ActiveRecord::Base |
3 | 3 | belongs_to :organization |
4 | 4 | belongs_to :comment |
5 | 5 | |
6 | - attr_accessible :value, :person, :organization, :comment | |
7 | - | |
8 | 6 | validates :value, |
9 | 7 | :presence => true, :inclusion => { |
10 | 8 | in: 1..5, message: _("must be between 1 and 5") | ... | ... |
plugins/organization_ratings/lib/organization_ratings_config.rb
... | ... | @@ -2,9 +2,6 @@ class OrganizationRatingsConfig < ActiveRecord::Base |
2 | 2 | |
3 | 3 | belongs_to :environment |
4 | 4 | |
5 | - attr_accessible :cooldown, :default_rating, :order, :per_page | |
6 | - attr_accessible :vote_once, :are_moderated, :environment_id | |
7 | - | |
8 | 5 | ORDER_OPTIONS = {recent: _('More Recent'), best: _('Best Ratings')} |
9 | 6 | |
10 | 7 | MINIMUM_RATING = 1 | ... | ... |
plugins/people_block/lib/members_block.rb
1 | 1 | class MembersBlock < PeopleBlockBase |
2 | + | |
2 | 3 | settings_items :show_join_leave_button, :type => :boolean, :default => false |
3 | 4 | settings_items :visible_role, :type => :string, :default => nil |
4 | - attr_accessible :show_join_leave_button, :visible_role | |
5 | 5 | |
6 | 6 | def self.description |
7 | 7 | c_('Members') | ... | ... |
plugins/people_block/lib/people_block_base.rb
... | ... | @@ -3,7 +3,6 @@ class PeopleBlockBase < Block |
3 | 3 | settings_items :limit, :type => :integer, :default => 6 |
4 | 4 | settings_items :name, :type => String, :default => "" |
5 | 5 | settings_items :address, :type => String, :default => "" |
6 | - attr_accessible :name, :address, :prioritize_profiles_with_image | |
7 | 6 | |
8 | 7 | def self.description |
9 | 8 | _('Random people') | ... | ... |
plugins/piwik/lib/ext/environment.rb
plugins/profile_members_headlines/lib/profile_members_headlines_block.rb
... | ... | @@ -5,8 +5,6 @@ class ProfileMembersHeadlinesBlock < Block |
5 | 5 | settings_items :navigation, :type => 'boolean', :default => true |
6 | 6 | settings_items :filtered_roles, :type => Array, :default => [] |
7 | 7 | |
8 | - attr_accessible :interval, :limit, :navigation, :filtered_roles | |
9 | - | |
10 | 8 | def self.description |
11 | 9 | _('Display headlines from members of a community') |
12 | 10 | end | ... | ... |
plugins/recent_content/lib/recent_content_block.rb
... | ... | @@ -5,8 +5,6 @@ class RecentContentBlock < Block |
5 | 5 | settings_items :show_blog_picture, :type => :boolean, :default => false |
6 | 6 | settings_items :selected_folder, :type => Integer |
7 | 7 | |
8 | - attr_accessible :presentation_mode, :total_items, :show_blog_picture, :selected_folder | |
9 | - | |
10 | 8 | VALID_CONTENT = ['RawHTMLArticle', 'TextArticle', 'TextileArticle', 'TinyMceArticle'] |
11 | 9 | |
12 | 10 | def self.description | ... | ... |
plugins/relevant_content/lib/relevant_content_plugin/relevant_content_block.rb
... | ... | @@ -18,8 +18,6 @@ class RelevantContentPlugin::RelevantContentBlock < Block |
18 | 18 | settings_items :show_most_disliked, :type => :boolean, :default => 0 |
19 | 19 | settings_items :show_most_voted, :type => :boolean, :default => 1 |
20 | 20 | |
21 | - attr_accessible :limit, :show_most_voted, :show_most_disliked, :show_most_liked, :show_most_commented, :show_most_read | |
22 | - | |
23 | 21 | include ActionView::Helpers |
24 | 22 | include Rails.application.routes.url_helpers |
25 | 23 | ... | ... |
plugins/require_auth_to_comment/lib/ext/profile.rb
1 | 1 | require_dependency 'profile' |
2 | 2 | |
3 | 3 | class Profile |
4 | + | |
4 | 5 | settings_items :allow_unauthenticated_comments, :type => :boolean |
5 | - attr_accessible :allow_unauthenticated_comments | |
6 | 6 | |
7 | - descendants.each do |descendant| | |
8 | - descendant.attr_accessible :allow_unauthenticated_comments | |
9 | - end | |
10 | 7 | end | ... | ... |
plugins/send_email/lib/send_email_plugin/core_ext.rb
plugins/site_tour/lib/site_tour_plugin/tour_block.rb
... | ... | @@ -4,8 +4,6 @@ class SiteTourPlugin::TourBlock < Block |
4 | 4 | settings_items :group_triggers, :type => Array, :default => [] |
5 | 5 | settings_items :display_button, :type => :boolean, :default => true |
6 | 6 | |
7 | - attr_accessible :actions, :display_button, :group_triggers | |
8 | - | |
9 | 7 | before_save do |block| |
10 | 8 | block.actions.reject! {|i| i[:group_name].blank? && i[:selector].blank? && i[:description].blank?} |
11 | 9 | block.group_triggers.reject! {|i| i[:group_name].blank? && i[:selector].blank?} | ... | ... |
plugins/spaminator/lib/spaminator_plugin/report.rb
plugins/spaminator/lib/spaminator_plugin/spaminator.rb
... | ... | @@ -29,10 +29,9 @@ class SpaminatorPlugin::Spaminator |
29 | 29 | def initialize(environment) |
30 | 30 | @environment = environment |
31 | 31 | @settings = Noosfero::Plugin::Settings.new(@environment, SpaminatorPlugin) |
32 | - @report = SpaminatorPlugin::Report.new({:environment => environment, | |
33 | - :total_people => Person.count, | |
34 | - :total_comments => Comment.count}, | |
35 | - :without_protection => true) | |
32 | + @report = SpaminatorPlugin::Report.new environment: environment, | |
33 | + total_people: Person.count, total_comments: Comment.count | |
34 | + | |
36 | 35 | self.class.initialize_logger(environment) |
37 | 36 | end |
38 | 37 | ... | ... |
plugins/statistics/lib/statistics_block.rb
... | ... | @@ -10,8 +10,6 @@ class StatisticsBlock < Block |
10 | 10 | settings_items :hit_counter, :default => false |
11 | 11 | settings_items :templates_ids_counter, type: Hash, default: {} |
12 | 12 | |
13 | - attr_accessible :comment_counter, :community_counter, :user_counter, :enterprise_counter, :product_counter, :category_counter, :tag_counter, :hit_counter, :templates_ids_counter | |
14 | - | |
15 | 13 | USER_COUNTERS = [:community_counter, :user_counter, :enterprise_counter, :tag_counter, :comment_counter, :hit_counter] |
16 | 14 | COMMUNITY_COUNTERS = [:user_counter, :tag_counter, :comment_counter, :hit_counter] |
17 | 15 | ENTERPRISE_COUNTERS = [:user_counter, :tag_counter, :comment_counter, :hit_counter] | ... | ... |
plugins/stoa/lib/ext/person.rb
1 | 1 | require_dependency 'person' |
2 | 2 | |
3 | 3 | class Person |
4 | - attr_accessible :usp_id, :invitation_code | |
5 | 4 | |
6 | 5 | SEARCHABLE_FIELDS[:usp_id] = {:label => _('USP Number'), :weight => 5} |
7 | 6 | |
... | ... | @@ -23,4 +22,5 @@ class Person |
23 | 22 | Task.pending.where(code: invitation_code.to_s).first or |
24 | 23 | Task.finished.where(code: invitation_code.to_s, target_id: id).first |
25 | 24 | end |
25 | + | |
26 | 26 | end | ... | ... |
plugins/stoa/test/functional/account_controller_test.rb
... | ... | @@ -21,7 +21,7 @@ class AccountControllerTest < ActionController::TestCase |
21 | 21 | @controller = AccountController.new |
22 | 22 | @request = ActionController::TestRequest.new |
23 | 23 | @response = ActionController::TestResponse.new |
24 | - StoaPlugin::UspUser.create!({:codpes => 12345678, :cpf => Digest::MD5.hexdigest(SALT+'12345678'), :birth_date => '1970-01-30'}, :without_protection => true) | |
24 | + StoaPlugin::UspUser.create! codpes: 12345678, cpf: Digest::MD5.hexdigest(SALT+'12345678'), birth_date: '1970-01-30' | |
25 | 25 | Environment.default.enable_plugin(StoaPlugin.name) |
26 | 26 | @user = create_user('joao-stoa', {:password => 'pass', :password_confirmation => 'pass'},:usp_id=>'87654321') |
27 | 27 | @user.activate | ... | ... |
plugins/stoa/test/unit/usp_user_test.rb
... | ... | @@ -16,7 +16,7 @@ class StoaPlugin::UspUserTest < ActiveSupport::TestCase |
16 | 16 | ActiveRecord::Base.establish_connection(:test) |
17 | 17 | |
18 | 18 | def setup |
19 | - StoaPlugin::UspUser.create({:codpes => 123456, :cpf => Digest::MD5.hexdigest(SALT+'12345678'), :birth_date => '1970-01-30'}, :without_protection => true) | |
19 | + StoaPlugin::UspUser.create codpes: 123456, cpf: Digest::MD5.hexdigest(SALT+'12345678'), birth_date: '1970-01-30' | |
20 | 20 | end |
21 | 21 | |
22 | 22 | should 'check existence of usp_id' do | ... | ... |
plugins/sub_organizations/lib/ext/organization.rb
... | ... | @@ -2,8 +2,6 @@ require_dependency 'organization' |
2 | 2 | class Organization |
3 | 3 | settings_items :sub_organizations_plugin_parent_to_be |
4 | 4 | |
5 | - attr_accessible :sub_organizations_plugin_parent_to_be | |
6 | - | |
7 | 5 | after_create do |organization| |
8 | 6 | if organization.sub_organizations_plugin_parent_to_be.present? |
9 | 7 | parent = Organization.find(organization.sub_organizations_plugin_parent_to_be) | ... | ... |
plugins/sub_organizations/lib/related_organizations_block.rb
plugins/sub_organizations/lib/sub_organizations_plugin/approve_paternity_relation.rb
... | ... | @@ -6,8 +6,6 @@ class SubOrganizationsPlugin::ApprovePaternityRelation < ActiveRecord::Base |
6 | 6 | |
7 | 7 | validates_presence_of :task, :parent, :child |
8 | 8 | |
9 | - attr_accessible :task, :parent, :child | |
10 | - | |
11 | 9 | class << self |
12 | 10 | def parent_approval(task) |
13 | 11 | find_by_task_id(task.id).parent | ... | ... |
plugins/sub_organizations/lib/sub_organizations_plugin/relation.rb
... | ... | @@ -8,8 +8,6 @@ class SubOrganizationsPlugin::Relation < ActiveRecord::Base |
8 | 8 | validate :no_cyclical_reference, :if => 'parent.present? && child.present?' |
9 | 9 | validate :no_multi_level, :if => 'parent.present? && child.present?' |
10 | 10 | |
11 | - attr_accessible :parent, :child | |
12 | - | |
13 | 11 | def no_self_reference |
14 | 12 | errors.add(:child, c_('self-reference is not allowed.')) if parent == child |
15 | 13 | end | ... | ... |
plugins/suppliers/lib/ext/price_detail.rb
plugins/suppliers/lib/ext/product.rb
... | ... | @@ -28,18 +28,12 @@ class Product |
28 | 28 | ProductCategory.find products.collect(&:product_category_id).compact.select{ |id| not id.zero? } |
29 | 29 | end |
30 | 30 | |
31 | - attr_accessible :external_id | |
32 | 31 | settings_items :external_id, type: String, default: nil |
33 | 32 | |
34 | - # should be on core, used by SuppliersPlugin::Import | |
35 | - attr_accessible :price_details | |
36 | - | |
37 | 33 | end |
38 | 34 | |
39 | 35 | class Product |
40 | 36 | |
41 | - attr_accessible :from_products, :from_product, :supplier_id, :supplier | |
42 | - | |
43 | 37 | has_many :sources_from_products, foreign_key: :to_product_id, class_name: 'SuppliersPlugin::SourceProduct', dependent: :destroy |
44 | 38 | has_one :sources_from_product, foreign_key: :to_product_id, class_name: 'SuppliersPlugin::SourceProduct' |
45 | 39 | has_many :sources_to_products, foreign_key: :from_product_id, class_name: 'SuppliersPlugin::SourceProduct', dependent: :destroy | ... | ... |
plugins/suppliers/models/suppliers_plugin/base_product.rb
... | ... | @@ -2,9 +2,6 @@ |
2 | 2 | # cycle.products will go to an infinite loop |
3 | 3 | class SuppliersPlugin::BaseProduct < Product |
4 | 4 | |
5 | - attr_accessible :default_margin_percentage, :margin_percentage, :default_unit, :unit_detail, | |
6 | - :supplier_product_attributes | |
7 | - | |
8 | 5 | accepts_nested_attributes_for :supplier_product |
9 | 6 | |
10 | 7 | default_scope -> { | ... | ... |
plugins/suppliers/models/suppliers_plugin/distributed_product.rb
plugins/suppliers/models/suppliers_plugin/source_product.rb
plugins/suppliers/models/suppliers_plugin/supplier.rb
... | ... | @@ -2,8 +2,6 @@ class SuppliersPlugin::Supplier < ActiveRecord::Base |
2 | 2 | |
3 | 3 | attr_accessor :distribute_products_on_create, :dont_destroy_dummy, :identifier_from_name |
4 | 4 | |
5 | - attr_accessible :profile_id, :profile, :consumer, :consumer_id, :name, :name_abbreviation, :description | |
6 | - | |
7 | 5 | belongs_to :profile |
8 | 6 | belongs_to :consumer, class_name: 'Profile' |
9 | 7 | alias_method :supplier, :profile | ... | ... |
plugins/tolerance_time/lib/tolerance_time_plugin/publication.rb
1 | 1 | class ToleranceTimePlugin::Publication < ActiveRecord::Base |
2 | 2 | |
3 | 3 | belongs_to :target, :polymorphic => true |
4 | + | |
4 | 5 | validates_presence_of :target_id, :target_type |
5 | 6 | validates_uniqueness_of :target_id, :scope => :target_type |
6 | - attr_accessible :target | |
7 | 7 | |
8 | 8 | class << self |
9 | 9 | def find_by_target(target) | ... | ... |
plugins/tolerance_time/lib/tolerance_time_plugin/tolerance.rb
1 | 1 | class ToleranceTimePlugin::Tolerance < ActiveRecord::Base |
2 | 2 | |
3 | 3 | belongs_to :profile |
4 | + | |
4 | 5 | validates_presence_of :profile_id |
5 | 6 | validates_uniqueness_of :profile_id |
6 | 7 | validates_numericality_of :content_tolerance, :only_integer => true, :allow_nil => true |
7 | 8 | validates_numericality_of :comment_tolerance, :only_integer => true, :allow_nil => true |
8 | - attr_accessible :profile, :content_tolerance, :comment_tolerance | |
9 | 9 | |
10 | 10 | end | ... | ... |
plugins/video/lib/video_plugin/video_block.rb
plugins/volunteers/lib/ext/profile.rb
plugins/volunteers/models/volunteers_plugin/assignment.rb
plugins/volunteers/models/volunteers_plugin/period.rb
1 | 1 | class VolunteersPlugin::Period < ActiveRecord::Base |
2 | 2 | |
3 | - attr_accessible :name | |
4 | - attr_accessible :start, :end | |
5 | - attr_accessible :owner_type | |
6 | - attr_accessible :minimum_assigments | |
7 | - attr_accessible :maximum_assigments | |
8 | - | |
9 | 3 | belongs_to :owner, polymorphic: true |
10 | 4 | |
11 | 5 | has_many :assignments, class_name: 'VolunteersPlugin::Assignment', foreign_key: :period_id, include: [:profile], dependent: :destroy | ... | ... |
plugins/work_assignment/lib/work_assignment_plugin/work_assignment.rb
... | ... | @@ -4,10 +4,6 @@ class WorkAssignmentPlugin::WorkAssignment < Folder |
4 | 4 | settings_items :default_email, :type => :string, :default => "" |
5 | 5 | settings_items :allow_visibility_edition, :type => :boolean, :default => false |
6 | 6 | |
7 | - attr_accessible :publish_submissions | |
8 | - attr_accessible :default_email | |
9 | - attr_accessible :allow_visibility_edition | |
10 | - | |
11 | 7 | def self.icon_name(article = nil) |
12 | 8 | 'work-assignment' |
13 | 9 | end |
... | ... | @@ -39,16 +35,13 @@ class WorkAssignmentPlugin::WorkAssignment < Folder |
39 | 35 | end |
40 | 36 | |
41 | 37 | def find_or_create_author_folder(author) |
42 | - children.find_by(slug: author.name.to_slug) || Folder.create!( | |
43 | - { | |
44 | - :name => author.name, | |
45 | - :parent => self, | |
46 | - :profile => profile, | |
47 | - :author => author, | |
48 | - :published => publish_submissions, | |
49 | - }, | |
50 | - :without_protection => true | |
51 | - ) | |
38 | + children.find_by_slug(author.name.to_slug) || Folder.create!( | |
39 | + name: author.name, | |
40 | + parent: self, | |
41 | + profile: profile, | |
42 | + author: author, | |
43 | + published: publish_submissions, | |
44 | + ) | |
52 | 45 | end |
53 | 46 | |
54 | 47 | def submissions | ... | ... |
plugins/work_assignment/test/functional/work_assignment_plugin_myprofile_controller_test.rb
... | ... | @@ -22,16 +22,7 @@ class WorkAssignmentPluginMyprofileControllerTest < ActionController::TestCase |
22 | 22 | work_assignment.save! |
23 | 23 | assert_equal false, work_assignment.allow_visibility_edition |
24 | 24 | parent = work_assignment.find_or_create_author_folder(@person) |
25 | - UploadedFile.create( | |
26 | - { | |
27 | - :uploaded_data => fixture_file_upload('/files/test.txt', 'text/plain'), | |
28 | - :profile => @organization, | |
29 | - :parent => parent, | |
30 | - :last_changed_by => @person, | |
31 | - :author => @person, | |
32 | - }, | |
33 | - :without_protection => true | |
34 | - ) | |
25 | + create_uploaded_file | |
35 | 26 | submission = UploadedFile.find_by filename: 'test.txt' |
36 | 27 | assert_equal false, submission.published |
37 | 28 | assert_equal false, submission.parent.published |
... | ... | @@ -67,16 +58,7 @@ class WorkAssignmentPluginMyprofileControllerTest < ActionController::TestCase |
67 | 58 | assert_equal true, work_assignment.allow_visibility_edition |
68 | 59 | work_assignment.save! |
69 | 60 | parent = work_assignment.find_or_create_author_folder(@person) |
70 | - UploadedFile.create( | |
71 | - { | |
72 | - :uploaded_data => fixture_file_upload('/files/test.txt', 'text/plain'), | |
73 | - :profile => @organization, | |
74 | - :parent => parent, | |
75 | - :last_changed_by => @person, | |
76 | - :author => @person, | |
77 | - }, | |
78 | - :without_protection => true | |
79 | - ) | |
61 | + create_uploaded_file | |
80 | 62 | logout |
81 | 63 | submission = UploadedFile.find_by filename: 'test.txt' |
82 | 64 | assert_equal false, submission.parent.published |
... | ... | @@ -95,19 +77,9 @@ class WorkAssignmentPluginMyprofileControllerTest < ActionController::TestCase |
95 | 77 | @organization.add_member(@person) # current_user is a member |
96 | 78 | work_assignment = create_work_assignment('Another Work Assignment', @organization, nil, true) |
97 | 79 | parent = work_assignment.find_or_create_author_folder(@person) |
98 | - UploadedFile.create( | |
99 | - { | |
100 | - :uploaded_data => fixture_file_upload('/files/test.txt', 'text/plain'), | |
101 | - :profile => @organization, | |
102 | - :parent => parent, | |
103 | - :last_changed_by => @person, | |
104 | - :author => @person, | |
105 | - }, | |
106 | - :without_protection => true | |
107 | - ) | |
80 | + create_uploaded_file | |
108 | 81 | logout |
109 | 82 | |
110 | - | |
111 | 83 | other_person = create_user('other_user').person |
112 | 84 | @organization.add_member(other_person) |
113 | 85 | login_as :other_user |
... | ... | @@ -133,16 +105,7 @@ class WorkAssignmentPluginMyprofileControllerTest < ActionController::TestCase |
133 | 105 | @organization.add_member(other_person) |
134 | 106 | work_assignment = create_work_assignment('Another Work Assignment', @organization, false, true) |
135 | 107 | parent = work_assignment.find_or_create_author_folder(@person) |
136 | - UploadedFile.create( | |
137 | - { | |
138 | - :uploaded_data => fixture_file_upload('/files/test.txt', 'text/plain'), | |
139 | - :profile => @organization, | |
140 | - :parent => parent, | |
141 | - :last_changed_by => @person, | |
142 | - :author => @person, | |
143 | - }, | |
144 | - :without_protection => true | |
145 | - ) | |
108 | + create_uploaded_file | |
146 | 109 | submission = UploadedFile.find_by filename: 'test.txt' |
147 | 110 | assert_equal false, submission.article_privacy_exceptions.include?(other_person) |
148 | 111 | 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 |
155 | 118 | @organization.add_member(@person) # current_user is a member |
156 | 119 | work_assignment = create_work_assignment('Work Assignment', @organization, nil, true) |
157 | 120 | parent = work_assignment.find_or_create_author_folder(@person) |
158 | - UploadedFile.create( | |
159 | - { | |
160 | - :uploaded_data => fixture_file_upload('/files/test.txt', 'text/plain'), | |
161 | - :profile => @organization, | |
162 | - :parent => parent, | |
163 | - :last_changed_by => @person, | |
164 | - :author => @person, | |
165 | - }, | |
166 | - :without_protection => true | |
167 | - ) | |
121 | + create_uploaded_file | |
168 | 122 | @organization.remove_member(@person) |
169 | 123 | submission = UploadedFile.find_by filename: 'test.txt' |
170 | 124 | |
... | ... | @@ -182,7 +136,18 @@ class WorkAssignmentPluginMyprofileControllerTest < ActionController::TestCase |
182 | 136 | end |
183 | 137 | |
184 | 138 | private |
185 | - def create_work_assignment(name = nil, profile = nil, publish_submissions = nil, allow_visibility_edition = nil) | |
186 | - @work_assignment = WorkAssignmentPlugin::WorkAssignment.create!(:name => name, :profile => profile, :publish_submissions => publish_submissions, :allow_visibility_edition => allow_visibility_edition) | |
187 | - end | |
139 | + | |
140 | + def create_work_assignment(name = nil, profile = nil, publish_submissions = nil, allow_visibility_edition = nil) | |
141 | + @work_assignment = WorkAssignmentPlugin::WorkAssignment.create!(:name => name, :profile => profile, :publish_submissions => publish_submissions, :allow_visibility_edition => allow_visibility_edition) | |
142 | + end | |
143 | + | |
144 | + def create_uploaded_file | |
145 | + UploadedFile.create( | |
146 | + uploaded_data: fixture_file_upload('/files/test.txt', 'text/plain'), | |
147 | + profile: @organization, | |
148 | + parent: parent, | |
149 | + last_changed_by: @person, | |
150 | + author: @person, | |
151 | + ) | |
152 | + end | |
188 | 153 | end | ... | ... |
plugins/work_assignment/test/unit/work_assingment_plugin_test.rb
1 | 1 | require 'test_helper' |
2 | 2 | |
3 | 3 | class WorkAssignmentPluginTest < ActiveSupport::TestCase |
4 | + | |
4 | 5 | should 'verify if a content is a work_assignment submission' do |
5 | 6 | organization = fast_create(Organization) |
6 | 7 | folder = fast_create(Folder) |
7 | 8 | person = fast_create(Person) |
8 | - content = UploadedFile.create( | |
9 | - { | |
10 | - :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), | |
11 | - :profile => organization, | |
12 | - :parent => folder, | |
13 | - :last_changed_by => person, | |
14 | - :author => person, | |
15 | - }, | |
16 | - :without_protection => true | |
17 | - ) | |
9 | + | |
10 | + create_uploaded_file organization, folder, person | |
18 | 11 | refute WorkAssignmentPlugin.is_submission?(content) |
19 | 12 | |
20 | 13 | work_assignment = WorkAssignmentPlugin::WorkAssignment.create!(:name => 'Work Assignment', :profile => organization) |
... | ... | @@ -64,15 +57,16 @@ class WorkAssignmentPluginTest < ActiveSupport::TestCase |
64 | 57 | organization.add_member(author) |
65 | 58 | work_assignment ||= WorkAssignmentPlugin::WorkAssignment.create!(:name => 'Work Assignment', :profile => organization) |
66 | 59 | author_folder = work_assignment.find_or_create_author_folder(author) |
67 | - content = UploadedFile.create( | |
68 | - { | |
69 | - :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), | |
70 | - :profile => organization, | |
71 | - :parent => author_folder, | |
72 | - :last_changed_by => author, | |
73 | - :author => author, | |
74 | - }, | |
75 | - :without_protection => true | |
76 | - ) | |
60 | + create_uploaded_file organization, author_folder, author | |
61 | + end | |
62 | + | |
63 | + def create_uploaded_file organization, parent, author | |
64 | + UploadedFile.create( | |
65 | + uploaded_data: fixture_file_upload('/files/rails.png', 'image/png'), | |
66 | + profile: organization, | |
67 | + parent: parent, | |
68 | + last_changed_by: author, | |
69 | + author: author, | |
70 | + ) | |
77 | 71 | end |
78 | 72 | end | ... | ... |
test/functional/content_viewer_controller_test.rb
... | ... | @@ -143,7 +143,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
143 | 143 | |
144 | 144 | should 'not display forbidden articles' do |
145 | 145 | profile.articles.create!(:name => 'test') |
146 | - profile.update!({:public_content => false}, :without_protection => true) | |
146 | + profile.update! public_content: false | |
147 | 147 | |
148 | 148 | Article.any_instance.expects(:display_to?).with(anything).returns(false) |
149 | 149 | get :view_page, :profile => profile.identifier, :page => [ 'test' ] |
... | ... | @@ -152,7 +152,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
152 | 152 | |
153 | 153 | should 'display allowed articles' do |
154 | 154 | profile.articles.create!(:name => 'test') |
155 | - profile.update!({:public_content => false}, :without_protection => true) | |
155 | + profile.update! public_content: false | |
156 | 156 | |
157 | 157 | Article.any_instance.expects(:display_to?).with(anything).returns(true) |
158 | 158 | get :view_page, :profile => profile.identifier, :page => [ 'test' ] | ... | ... |
test/functional/profile_roles_controller_test.rb
... | ... | @@ -40,7 +40,8 @@ class ProfileRolesControllerTest < ActionController::TestCase |
40 | 40 | community = fast_create(Community) |
41 | 41 | admin = create_user_with_permission('admin_user', 'manage_custom_roles', community) |
42 | 42 | login_as :admin_user |
43 | - role = Role.create!({:name => 'delete_article', :key => 'profile_delete_article', :profile_id => community.id, :environment => Environment.default}, :without_protection => true) | |
43 | + role = Role.create! name: 'delete_article', key: 'profile_delete_article', | |
44 | + profile_id: community.id, environment: Environment.default | |
44 | 45 | post :remove , :profile => community.identifier, :id => role.id |
45 | 46 | |
46 | 47 | assert_response :redirect |
... | ... | @@ -53,7 +54,8 @@ class ProfileRolesControllerTest < ActionController::TestCase |
53 | 54 | community = fast_create(Community) |
54 | 55 | admin = create_user_with_permission('admin_user', 'manage_custom_roles', community) |
55 | 56 | login_as :admin_user |
56 | - role = Role.create!({:name => 'delete_article', :key => 'profile_delete_article', :profile_id => community.id, :environment => Environment.default}, :without_protection => true) | |
57 | + role = Role.create! name: 'delete_article', key: 'profile_delete_article', | |
58 | + profile_id: community.id, environment: Environment.default | |
57 | 59 | admin.add_role(role, community) |
58 | 60 | moderator_role = Role.find_by(name: "moderator") |
59 | 61 | |
... | ... | @@ -72,7 +74,8 @@ class ProfileRolesControllerTest < ActionController::TestCase |
72 | 74 | community = fast_create(Community) |
73 | 75 | admin = create_user_with_permission('admin_user', 'manage_custom_roles', community) |
74 | 76 | login_as :admin_user |
75 | - role = Role.create!({:name => 'delete_article', :key => 'profile_delete_article', :profile_id => community.id, :environment => Environment.default}, :without_protection => true) | |
77 | + role = Role.create! name: 'delete_article', key: 'profile_delete_article', | |
78 | + profile_id: community.id, environment: Environment.default | |
76 | 79 | |
77 | 80 | assert_not_includes community.members_by_role(role), admin |
78 | 81 | |
... | ... | @@ -86,7 +89,8 @@ class ProfileRolesControllerTest < ActionController::TestCase |
86 | 89 | admin = create_user_with_permission('admin_user', 'manage_custom_roles', community) |
87 | 90 | moderator = create_user_with_permission('profile_admin', 'edit_profile', community) |
88 | 91 | login_as :admin_user |
89 | - role = Role.create!({:name => 'delete_article', :key => 'profile_delete_article', :profile_id => community.id, :environment => Environment.default}, :without_protection => true) | |
92 | + role = Role.create! name: 'delete_article', key: 'profile_delete_article', | |
93 | + profile_id: community.id, environment: Environment.default | |
90 | 94 | moderator_role = Role.find_by(name: "moderator") |
91 | 95 | admin.add_role(moderator_role, community) |
92 | 96 | ... | ... |
test/support/factories.rb
... | ... | @@ -44,7 +44,7 @@ module Noosfero::Factory |
44 | 44 | data = defaults_for(name).merge(attrs) |
45 | 45 | object = name.to_s.camelize.constantize.new |
46 | 46 | if object.respond_to?(:assign_attributes) |
47 | - object.assign_attributes(data, :without_protection => true) | |
47 | + object.assign_attributes data | |
48 | 48 | else |
49 | 49 | data.each { |attribute, value| object.send(attribute.to_s+'=', value) } |
50 | 50 | end | ... | ... |
test/unit/acts_as_having_settings_test.rb
... | ... | @@ -8,7 +8,6 @@ class ActsAsHavingSettingsTest < ActiveSupport::TestCase |
8 | 8 | settings_items :flag_disabled_by_default, type: :boolean, default: false |
9 | 9 | # to test that 'name' will be symbolized (see below) |
10 | 10 | settings_items 'name', type: :string, default: N_('ENGLISH TEXT') |
11 | - attr_accessible :flag, :name, :flag_disabled_by_default | |
12 | 11 | end |
13 | 12 | |
14 | 13 | should 'store settings in a hash' do | ... | ... |
test/unit/profile_activity_test.rb
... | ... | @@ -10,7 +10,6 @@ class ProfileActivityTest < ActiveSupport::TestCase |
10 | 10 | profile = fast_create Person |
11 | 11 | target = fast_create Person |
12 | 12 | |
13 | - ActionTracker::Record.attr_accessible :created_at, :updated_at | |
14 | 13 | tracker = ActionTracker::Record.create! verb: :leave_scrap, user: profile, target: target, created_at: Time.now-2.days, updated_at: Time.now-1.day |
15 | 14 | |
16 | 15 | pa = ProfileActivity.create! profile: profile, activity: tracker | ... | ... |
vendor/plugins/access_control/lib/role.rb
1 | 1 | class Role < ActiveRecord::Base |
2 | 2 | |
3 | - attr_accessible :key, :name, :environment, :permissions | |
4 | - | |
5 | 3 | has_many :role_assignments, :dependent => :destroy |
4 | + | |
6 | 5 | belongs_to :environment |
7 | 6 | belongs_to :organization |
7 | + | |
8 | 8 | serialize :permissions, Array |
9 | + | |
9 | 10 | validates_presence_of :name |
10 | 11 | validates_uniqueness_of :name, :scope => :environment_id |
11 | 12 | validates_uniqueness_of :key, :if => lambda { |role| !role.key.blank? }, :scope => :environment_id |
13 | + | |
12 | 14 | before_validation :create_key, :on => :create |
13 | 15 | |
14 | 16 | def initialize(*args) | ... | ... |
vendor/plugins/access_control/lib/role_assignment.rb
vendor/plugins/access_control/test/acts_as_accessor_test.rb
... | ... | @@ -3,10 +3,6 @@ require File.dirname(__FILE__) + '/test_helper' |
3 | 3 | |
4 | 4 | class ActAsAccessorTest < Test::Unit::TestCase |
5 | 5 | |
6 | - def setup | |
7 | - RoleAssignment.attr_accessible :accessor | |
8 | - end | |
9 | - | |
10 | 6 | def test_can_have_role_in_respect_to_an_resource |
11 | 7 | res = AccessControlTestResource.create!(:name => 'bla') |
12 | 8 | a = AccessControlTestAccessor.create!(:name => 'ze') |
... | ... | @@ -57,7 +53,7 @@ class ActAsAccessorTest < Test::Unit::TestCase |
57 | 53 | a = AccessControlTestAccessor.create!(:name => 'ze') |
58 | 54 | role = Role.create!(:name => 'an_author', :permissions => ['bli']) |
59 | 55 | |
60 | - assert !a.role_assignments.map{|ra|[ra.role, ra.accessor, ra.resource]}.include?([role, a, res]) | |
56 | + assert !a.role_assignments.map{|ra|[ra.role, ra.accessor, ra.resource]}.include?([role, a, res]) | |
61 | 57 | assert !a.remove_role(role, res) |
62 | 58 | end |
63 | 59 | ... | ... |
vendor/plugins/access_control/test/role_assignment_test.rb
... | ... | @@ -2,17 +2,13 @@ require File.dirname(__FILE__) + '/test_helper' |
2 | 2 | |
3 | 3 | class RoleAssignmentTest < Test::Unit::TestCase |
4 | 4 | |
5 | - def setup | |
6 | - RoleAssignment.attr_accessible :is_global, :role, :accessor, :resource | |
7 | - end | |
8 | - | |
9 | 5 | def test_has_global_permission |
10 | 6 | role = Role.create(:name => 'new_role', :permissions => ['permission']) |
11 | 7 | ra = RoleAssignment.create(:role_id => role.id, :is_global => true) |
12 | 8 | assert ra.has_permission?('permission', 'global') |
13 | 9 | assert !ra.has_permission?('not_permitted', 'global') |
14 | - end | |
15 | - | |
10 | + end | |
11 | + | |
16 | 12 | def test_has_global_permission_with_global_resource |
17 | 13 | role = Role.create(:name => 'new_role', :permissions => ['permission']) |
18 | 14 | accessor = AccessControlTestAccessor.create(:name => 'accessor') | ... | ... |
vendor/plugins/access_control/test/role_test.rb
... | ... | @@ -4,8 +4,6 @@ require File.join(File.dirname(__FILE__), 'test_helper') |
4 | 4 | class RoleTest < Test::Unit::TestCase |
5 | 5 | |
6 | 6 | def setup |
7 | - RoleAssignment.attr_accessible :role, :accessor | |
8 | - Role.attr_accessible :system | |
9 | 7 | Role.delete_all |
10 | 8 | end |
11 | 9 | |
... | ... | @@ -15,11 +13,11 @@ class RoleTest < Test::Unit::TestCase |
15 | 13 | assert role.save |
16 | 14 | assert_equal count + 1, Role.count |
17 | 15 | end |
18 | - | |
16 | + | |
19 | 17 | def test_uniqueness_of_name |
20 | 18 | Role.create(:name => 'role_name') |
21 | 19 | role = Role.new(:name => 'role_name') |
22 | - assert ! role.save | |
20 | + assert ! role.save | |
23 | 21 | end |
24 | 22 | |
25 | 23 | def test_uniqueness_of_key | ... | ... |
vendor/plugins/access_control/test/test_helper.rb
... | ... | @@ -18,7 +18,6 @@ RoleAssignment.table_name = 'access_control_test_role_assignments' |
18 | 18 | class AccessControlTestAccessor < ActiveRecord::Base |
19 | 19 | self.table_name = 'access_control_test_accessors' |
20 | 20 | acts_as_accessor |
21 | - attr_accessible :name | |
22 | 21 | def cache_keys(arg) |
23 | 22 | [] |
24 | 23 | end |
... | ... | @@ -32,8 +31,6 @@ class AccessControlTestResource < ActiveRecord::Base |
32 | 31 | self.table_name = 'access_control_test_resources' |
33 | 32 | acts_as_accessible |
34 | 33 | PERMISSIONS[self.class.name] = {'bla' => N_('Bla')} |
35 | - | |
36 | - attr_accessible :name | |
37 | 34 | end |
38 | 35 | |
39 | 36 | # controller to test protection | ... | ... |
vendor/plugins/action_tracker/lib/action_tracker_model.rb
vendor/plugins/kandadaboggu-vote_fu/lib/models/vote.rb
... | ... | @@ -15,8 +15,6 @@ class Vote < ActiveRecord::Base |
15 | 15 | belongs_to :voteable, :polymorphic => true |
16 | 16 | belongs_to :voter, :polymorphic => true |
17 | 17 | |
18 | - attr_accessible :vote, :voter, :voteable | |
19 | - | |
20 | 18 | # Uncomment this to limit users to a single vote on each item. |
21 | 19 | #validates_uniqueness_of :voteable_id, :scope => [:voteable_type, :voter_type, :voter_id] |
22 | 20 | ... | ... |