vhochstein / active_scaffold

Rails 4 Version of activescaffold supporting jquery
MIT License
156 stars 34 forks source link

Security layer issue #59

Closed victor-ono closed 13 years ago

victor-ono commented 13 years ago

According to the instructions on https://github.com/activescaffold/active_scaffold/wiki/Security adding #{action_name}_authorized? methods to ActiveScaffold controllers will restrict an entire action:

class PostsController < ApplicationController
  active_scaffold :post do |conf|
    columns[:categories].inplace_edit = :ajax
  end

  protected

  def update_authorized?
    true
  end 

While this works for the update action, the list action results in the following error:

wrong number of arguments (1 for 0)

Extracted source (around line #9):

6: -%>
7: <% columns.each do |column| -%>
8:   <% stages = default_sorting.sorts_on?(column) ? default_sorting_stages :     sorting_stages -%>
9:   <%= render_column_heading(column, sorting, stages.after(sorting.direction_of(column)) || 'ASC') %>
10: <% end -%>
11: <th class="actions">
12: </th>

Trace of template inclusion: vendor/plugins/active_scaffold/frontends/default/views/_list.html.erb, vendor/plugins/active_scaffold/frontends/default/views/_list_with_header.html.erb, vendor/plugins/active_scaffold/frontends/default/views/list.html.erb

app/controllers/posts_controller.rb:9:inupdate_authorized?'`

If I remove columns[:categories].inplace_edit = :ajax the list action works fine.

vhochstein commented 13 years ago

Signature of update authorized has changed: def update_authorized?(record = nil)