Out of box authentication

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

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

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

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.

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

Reuben

looks interesting…thanks

Craig