PiRSquared17 / activescaffold

Automatically exported from code.google.com/p/activescaffold
MIT License
0 stars 0 forks source link

activescaffold : Security with nested link #754

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
config.action_links.add 'edit_details', :label => 'Edit', :type => :record, 
:popup => false,:parameters =>{:controller=>'companies',:action=>"edit_details" 
}
2.
#defining it security
def authorized_for_edit_details?
(session[:user_type]!=4)?true:false 
end

What is the expected output? What do you see instead?
It's simply doesnot work. May be i have using wrong approach...

Please use labels and text to provide additional information.

Original issue reported on code.google.com by sonirajesh80 on 21 Jun 2010 at 11:15

GoogleCodeExporter commented 9 years ago
authorized_for_#{action_name}? must be defined in a model. You can't access to 
session in models, but ActiveScaffold enables you to access to current_user. If 
you have a controller method named current_user, you can use 
current_user.user_type in your models for example

Original comment by sergio.c...@gmail.com on 22 Jun 2010 at 7:15