hey all, I''m using simple_access_control this way: <%= link_to ''list'', :controller=>''profiles'',:action=>''list'' if has_permission?(''admin'')%> and now that I''m using restful path it doesn''t seem to work anymore: <%= link_to ''list'', list_profiles_path if has_permission?(''admin'')%> anyone had the same problem and found a workaround? thanx in advance Pat --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 6/8/07, Patrick Aljord <patcito-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > hey all, > > I''m using simple_access_control this way: > > <%= link_to ''list'', :controller=>''profiles'',:action=>''list'' if > has_permission?(''admin'')%> > > and now that I''m using restful path it doesn''t seem to work anymore: > > <%= link_to ''list'', list_profiles_path if has_permission?(''admin'')%> > > anyone had the same problem and found a workaround?You didn''t give an error message, so there''s no way to tell, but I''d guess that your given route doesn''t exist. Read the docs for an overview of the routes that map.resources creates: http://rails.rubyonrails.org/classes/ActionController/Resources.html -- Rick Olson http://lighthouseapp.com http://weblog.techno-weenie.net http://mephistoblog.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 6/8/07, Rick Olson <technoweenie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You didn''t give an error message, so there''s no way to tell, but I''d > guess that your given route doesn''t exist. Read the docs for an > overview of the routes that map.resources creates: > http://rails.rubyonrails.org/classes/ActionController/Resources.htmlI do have this in my route: map.resources :shootings, :collection =>{:list => :get, :search => :get} should I add something? I don''t have any error from the log. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 6/8/07, Patrick Aljord <patcito-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I do have this in my route: > map.resources :shootings, :collection =>{:list => :get, :search => :get}I meant: map.resources :profiles, :collection =>{:list => :get, :search => :get} --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Patrick, it''s definitely helpful to see the map.resources call you''re making (and I assume that''s literally what you''ve right? As in, you''re not failing to tell us that it''s a nested resource or something?). Even so, this isn''t enough information to go on. You need to supply details of any error messages and any other clues about what happens when list_profiles_path() executes. "doesn''t work any more" is too vague I''m afraid. Regards, Trevor On 6/8/07, Patrick Aljord <patcito-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > On 6/8/07, Patrick Aljord <patcito-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > I do have this in my route: > > map.resources :shootings, :collection =>{:list => :get, :search => :get} > > I meant: > map.resources :profiles, :collection =>{:list => :get, :search => :get} > > > >-- -- Trevor Squires http://somethinglearned.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
There isn''t any error message, it''s just that when I use: <%= link_to ''list'', :controller=>''profiles'',:action=>''list'' if has_permission?(''admin'')%> the link is not display if the current_user is not part of the admin role. But when I use: <%= link_to ''list'', list_profiles_path if has_permission?(''admin'')%> the link is displayed whether the current_user is part or not of the admin role. I couldn''t spot any error message :/> failing to tell us that it''s a nested resource or something?).No it''s not a nested resource. thanx in advance Pat --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Okay, this does seem odd. If you try: <%= link_to ''list'', list_profiles_path if false %> and the link does *not* get displayed then your assumptions about has_permission?(:admin) are wrong because clearly it''s returning true when you don''t expect. however, if it *does* display the link then you seem to have some strange parsing problem (that doesn''t make sense to me). Try changing it to this: <%= link_to(''list'', list_profiles_path) if has_permission?(:admin) %> HTH, Trevor On 6/8/07, Patrick Aljord <patcito-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > There isn''t any error message, it''s just that when I use: > > <%= link_to ''list'', :controller=>''profiles'',:action=>''list'' if > has_permission?(''admin'')%> > > the link is not display if the current_user is not part of the admin > role. But when I use: > > <%= link_to ''list'', list_profiles_path if has_permission?(''admin'')%> > > the link is displayed whether the current_user is part or not of the > admin role. I couldn''t spot any error message :/ > > > failing to tell us that it''s a nested resource or something?). > No it''s not a nested resource. > > thanx in advance > > Pat > > > >-- -- Trevor Squires http://somethinglearned.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 6/9/07, Trevor Squires <trevor-k8q5a0yEZAgS+FvcfC7Uqw@public.gmane.org> wrote:> > Okay, this does seem odd. > > If you try: > > <%= link_to ''list'', list_profiles_path if false %> > > and the link does *not* get displayed then your assumptions about > has_permission?(:admin) are wrong because clearly it''s returning true > when you don''t expect.The link doesn''t get display if I put "false".> however, if it *does* display the link then you seem to have some > strange parsing problem (that doesn''t make sense to me). Try changing > it to this: > > <%= link_to(''list'', list_profiles_path) if has_permission?(:admin) %>doesn''t solve the problem :/ maybe it''s because the plugin I''m using is kind of old (08/2006) and can''t parse restful path? (http://mabs29.googlecode.com/svn/trunk/plugins/simple_access_control) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> > <%= link_to(''list'', list_profiles_path) if has_permission?(:admin) %> > > doesn''t solve the problem :/ > maybe it''s because the plugin I''m using is kind of old (08/2006) and > can''t parse restful path? > (http://mabs29.googlecode.com/svn/trunk/plugins/simple_access_control)It''s an if loop, you need to verify that has_permission? is working. Trevor''s "if false" trick proved that the syntax and the link are correct. -- Rick Olson http://lighthouseapp.com http://weblog.techno-weenie.net http://mephistoblog.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 6/9/07, Rick Olson <technoweenie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> It''s an if loop, you need to verify that has_permission? is working. > Trevor''s "if false" trick proved that the syntax and the link are > correct.Well, it looks like has_permission? is not working with restful path, this is why I asked in my initial post if any of you using the simple_access_control plugin had the same problem with has_permission? and restful path, sorry if I didn''t make it very clear. If you''re not using simple_access_control then I guess you can''t help me on that issue (unless you install it and test it for me :). --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
As we come to the point where it is determined that has_permission? is not behaving as expected. The most reasonable thing you can do is to do a little debugging to determine what''s happening. I do not use simple_access_control, but if you find the cause for this behavior and way to fix it the community will appreciate your effort. On Jun 9, 6:08 pm, "Patrick Aljord" <patc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 6/9/07, Rick Olson <technowee...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > It''s an if loop, you need to verify that has_permission? is working. > > Trevor''s "if false" trick proved that the syntax and the link are > > correct. > > Well, it looks like has_permission? is not working with restful path, > this is why I asked in my initial post if any of you using the > simple_access_control plugin had the same problem with > has_permission? and restful path, sorry if I didn''t make it very > clear. If you''re not using simple_access_control then I guess you > can''t help me on that issue (unless you install it and test it for me > :).--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Today I find the http://unroller.rubyforge.org/ - Ruby Unroller is a tool for generating human-readable "execution traces". While it is enabled, it will watch every Ruby statement and method call that gets executed and will display the source code on your screen in real-time as it is being executed. Perhaps you will get a better view on what is going on in your app. On Jun 9, 6:08 pm, "Patrick Aljord" <patc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 6/9/07, Rick Olson <technowee...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > It''s an if loop, you need to verify that has_permission? is working. > > Trevor''s "if false" trick proved that the syntax and the link are > > correct. > > Well, it looks like has_permission? is not working with restful path, > this is why I asked in my initial post if any of you using the > simple_access_control plugin had the same problem with > has_permission? and restful path, sorry if I didn''t make it very > clear. If you''re not using simple_access_control then I guess you > can''t help me on that issue (unless you install it and test it for me > :).--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 6/9/07, dima <dejan.dimic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > As we come to the point where it is determined that has_permission? is > not behaving as expected. > The most reasonable thing you can do is to do a little debugging to > determine what''s happening.Actually that''s the first thing I did before posting to the list but the code was a little scriptic for a noob like me so I asked to the list :-). I''m gonna give it another try though. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 6/9/07, Patrick Aljord <patcito-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Actually that''s the first thing I did before posting to the list but > the code was a little scripticI meant cryptic of course :-) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
The SimpleAccessControl code snippet shows that it depend on user.roles data. I spouses that you do the installation procedure described in Readme file. But in any case check the data in database and check the SimpleAccessControl:: AccessControlHandler#check method :-) # The heart of the system, all credit to Ezra for the original algorithm # Defaults to false if there is no user or that user does not have a roles association # Defaults to true if the role is blank def check(role, user) return(false) if user.blank? || !user.respond_to?(:roles) return(true) if role.blank? user.roles.map{ |r| r.title.downcase }.include? role.downcase end On Jun 10, 12:42 am, "Patrick Aljord" <patc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 6/9/07, Patrick Aljord <patc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Actually that''s the first thing I did before posting to the list but > > the code was a little scriptic > > Imeant cryptic of course :-) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---