I''m using the Ruport Plugin and Restful Authentication Gem. I want to enable a report that varies depending on the user''s id. They are from different organisations. Restful Authentication creates a ''current_user'' variable that can be accessed from all other controllers. It allows me to create the views appropriate to the user. Unfortunately I can''t access current_user from the Ruport Controllers. I don''t particularly want to pass an id as a parameter, as a simple hack will then make reports intended for other partners available to the wrong people. Does anybody know how I might address this issue? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
What about using roles? You can get a sample here: http://railsforum.com/viewtopic.php?id=14216 On 15 Lug, 15:13, MJohnH <martin.hawk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m using the Ruport Plugin and Restful Authentication Gem. I want to > enable a report that varies depending on the user''s id. They are from > different organisations. > Restful Authentication creates a ''current_user'' variable that can be > accessed from all other controllers. It allows me to create the views > appropriate to the user. > Unfortunately I can''t access current_user from the Ruport Controllers. > I don''t particularly want to pass an id as a parameter, as a simple > hack will then make reports intended for other partners available to > the wrong people. > > Does anybody know how I might address this issue?--~--~---------~--~----~------------~-------~--~----~ 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 Jul 15, 9:13 am, MJohnH <martin.hawk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m using theRuportPlugin and Restful Authentication Gem. I want to > enable a report that varies depending on the user''s id. They are from > different organisations. > Restful Authentication creates a ''current_user'' variable that can be > accessed from all other controllers. It allows me to create the views > appropriate to the user. > Unfortunately I can''t access current_user from theRuportControllers. > I don''t particularly want to pass an id as a parameter, as a simple > hack will then make reports intended for other partners available to > the wrong people. > > Does anybody know how I might address this issue?When running your reports, pass the current_user as an option: MyReportController.render_some_format(:user => current_user) You can now access this as options.user in your Ruport::Controller / Formatters. As a note, for some weird reason if you are using ERb templates, you need to use @options, I''ll look into that soon. -greg --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---