On Miércoles, 11 de Noviembre de 2009 02:02:59 Aaron Turner escribió:
> FYI, further testing shows it isn't because I'm overriding the column
> values in the WinesHelper.

Maybe I haven't understood you. I thought you get no rows in the list. Do you 
get some rows but cells are empty?

>
> Maybe it still is because the default action is edit though... I still
> haven't been able to figure out a cleaner way over overriding the
> method generated for joined tables.  It sorta makes sense, although I
> would of expected the table to be generated normally and only getting
> a forbidden error via lockdown when trying to click the edit action
> link.

ActiveScaffold checks permission to make a link to edit or show, but it checks 
permission using authorized_for_update?, column_authorized_for_update? and 
column_authorized? methods in the model. I don't know if lockdown adds some 
methods like that. But a value is always shown with a link to show.

Also, you can remove the link in the column with 
config.columns[:column_name].clear_link. It should remove problems related to 
permissions.

You can get empty cells when authorized_for_read?, column_authorized_for_read? 
or column_authorized? returns false for that record.

You can try it in script/console, loading the record and checking 
authorized_for?(:action => :read, :column => :column_name):

record = Wine.find(id)
record.authorized_for?(:action => :read, :column => :varietal)

>
> Maybe I should be using a template override to do this?  seems a bit
> "heavy" and non-DRY.
>
> Thanks,
> Aaron
>
> On Tue, Nov 10, 2009 at 9:38 AM, Aaron Turner <[email protected]> wrote:
> > On Tue, Nov 10, 2009 at 1:17 AM, Sergio Cambra .:: entreCables S.L.
> >
> > ::. <[email protected]> wrote:
> >>
> >> I don't know Lockdown, you can try to debug using a debugger. Add a
> >> debugger line in
> >> vendor/plugins/active_scaffold/lib/active_scaffold/actions/list.rb,
> >> after do_list call in list method (after line 28), and check the content
> >> of records.
> >
> > Fair enough.  Anyways, I have a working theory what is going on:
> >
> > Basically, when I'm not logged in, I don't have edit permissions to
> > anything.  And even though I have told AS to link to nested lists for
> > the column data using the following code:
> >
> > module WinesHelper
> >  def varietal_column(record)
> >    link_to(h(record.varietal.name), :action => :nested, :controller
> > => 'varietals',
> >            :id => record.varietal.id,
> >            :_method => 'get', :associations => 'wines')
> >  end
> >
> >  def appellation_column(record)
> >    link_to(h(record.appellation.name), :action => :nested,
> >
> > :controller => 'appellations',
> >
> >            :id => record.appellation.id,
> >           :_method => 'get', :associations => 'wines')
> >  end
> >
> >  def producer_column(record)
> >    link_to(h(record.producer.name), :action => :nested, :controller
> > => 'producers',
> >            :id => record.producer.id,
> >           :_method => 'get', :associations => 'wines')
> >  end
> > end
> >
> > something about AS is suppressing the column data because it still
> > thinks it is supposed to generate the default edit links which are
> > forbidden for non-logged in users.
> >
> > Is this a reasonable theory?  I haven't been able to pin point the
> > offending bit of code yet.  Is there a better way to go about what I'm
> > trying to accomplish that won't have this side effect?
> >
> > Thanks!
> >
> > --
> > Aaron Turner
> > http://synfin.net/
> > http://tcpreplay.synfin.net/ - Pcap editing and replay tools for Unix &
> > Windows Those who would give up essential Liberty, to purchase a little
> > temporary Safety, deserve neither Liberty nor Safety.
> >    -- Benjamin Franklin
> > "carpe diem quam minimum credula postero"

-- 
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]

--

You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected].
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=.


Reply via email to