# Out of box authentication

**URL:** <https://www.ruby-forum.com/t/out-of-box-authentication/143478>\
**Category:** Rails\
**Created:** [July 19, 2008, 2:58am UTC](https://www.ruby-forum.com/t/out-of-box-authentication/143478 "2008-07-19T02:58:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [July 19, 2008, 2:58am UTC](https://www.ruby-forum.com/t/out-of-box-authentication/143478/1 "2008-07-19T02:58:53Z")

</div>

I have a bit of a dilemma that I can’t figure out a suitable method.

I have an existing system in production (Rails 1.2.6) that I don’t want  
to modify as I’ve got lots of modifications in development which will be  
merged in a 2 or 3 months.

I am looking for a way to automate a web browser that can access a  
couple of reports in the production system and then e-mail them but  
access requires an active session because of before filter restrictions  
with a rights/roles mechanism.

I’ve been mucking with lynx text browser and I can sort of get there but  
not the entire way and then the output is text instead of the full html.

Anybody doing something like this? Suggestions?

Craig

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [July 20, 2008, 1:24am UTC](https://www.ruby-forum.com/t/out-of-box-authentication/143478/2 "2008-07-20T01:24:22Z")

</div>

This is what I’m trying to do…(which of course doesn’t work)

require “app/models/personnel.rb”  
File.open("test.html, “w”) do |file|  
@report\_name = “Mandatory Requirements Report”  
@personnel = Personnel.current\_by\_dept  
file.write “reports/personnels/mandatory\_requirements.rhtml”  
end  
file.close

obviously this requires a web browser but I can’t use a web browser (at  
least easily) because of the non-standard method of authentication  
required to execute the method.

Anyone with suggestions?

Craig

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [July 20, 2008, 12:39pm UTC](https://www.ruby-forum.com/t/out-of-box-authentication/143478/3 "2008-07-20T12:39:09Z")

</div>

On 20 Jul 2008, at 00:22, Craig W. wrote:

> obviously this requires a web browser but I can’t use a web browser  
> (at  
> least easily) because of the non-standard method of authentication  
> required to execute the method.

If you’re just using model classes why would things like session and  
authentication have any impact (you’d need to load more of the rails  
framework for it to work though - you’ll need to require config/  
boot.rb and config/environment.rb (or in a rake task just make your  
task depend on :environment.

Fred

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [July 21, 2008, 4:44pm UTC](https://www.ruby-forum.com/t/out-of-box-authentication/143478/4 "2008-07-21T16:44:53Z")

</div>

On Sun, 2008-07-20 at 11:38 +0100, Frederick C. wrote:

> > file.write “reports/personnels/mandatory\_requirements.rhtml”  
> > framework for it to work though - you’ll need to require config/  
> > boot.rb and config/environment.rb (or in a rake task just make your  
> > task depend on :environment.

* * *

I was trying this to get around session/authentication but this requires  
the ability to deliver rhtml content into a file which I was going to  
e-mail but clearly I can’t pull this off. I’m trying to get this to work  
via script/console which should handle the initial issues of  
boot.rb/environment.rb for the time being.

The point about session/authentication was my earlier efforts (see  
below) to automate a text based web browser to retrieve the rhtml.

## What I’m trying to accomplish is to get a fully formatted report to a file that I can e-mail in an automated way.

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [July 21, 2008, 5:47pm UTC](https://www.ruby-forum.com/t/out-of-box-authentication/143478/5 "2008-07-21T17:47:23Z")

</div>

hey I had the same problem, look into mechanize for ruby.  
[http://rubyforge.org/projects/mechanize/](http://rubyforge.org/projects/mechanize/)

Reuben

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [July 21, 2008, 6:40pm UTC](https://www.ruby-forum.com/t/out-of-box-authentication/143478/6 "2008-07-21T18:40:03Z")

</div>

looks interesting…thanks

Craig
