# Using Ruport and Restful Authentication

**URL:** <https://www.ruby-forum.com/t/using-ruport-and-restful-authentication/143132>\
**Category:** Rails\
**Created:** [July 15, 2008, 3:33pm UTC](https://www.ruby-forum.com/t/using-ruport-and-restful-authentication/143132 "2008-07-15T15:33:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MJohnH](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/41988e/32.png) [@MJohnH](https://www.ruby-forum.com/u/MJohnH)\
**Post date:** [July 15, 2008, 3:33pm UTC](https://www.ruby-forum.com/t/using-ruport-and-restful-authentication/143132/1 "2008-07-15T15:33:03Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![MJohnH](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/41988e/32.png) [@MJohnH](https://www.ruby-forum.com/u/MJohnH)\
**Post date:** [July 15, 2008, 4:00pm UTC](https://www.ruby-forum.com/t/using-ruport-and-restful-authentication/143132/2 "2008-07-15T16:00:02Z")

</div>

What about using roles?  
You can get a sample here:  
[http://railsforum.com/viewtopic.php?id=14216](http://railsforum.com/viewtopic.php?id=14216)

---

<div class="post-metadata">

**Author:** ![MJohnH](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/41988e/32.png) [@MJohnH](https://www.ruby-forum.com/u/MJohnH)\
**Post date:** [July 23, 2008, 7:21pm UTC](https://www.ruby-forum.com/t/using-ruport-and-restful-authentication/143132/3 "2008-07-23T19:21:55Z")

</div>

On Jul 15, 9:13 am, MJohnH [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 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
