Forum: Ruby on Rails User-level database connections (MySQL)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Blake M. (Guest)
on 2007-04-02 22:52
Is there a way to have a user connect as themselves from Rails to MySQL,
instead of connecting via the normal database.yml user?  I'm trying to
build in security at the database level, with Rails security on top.

Thanks
Jamal S. (Guest)
on 2007-04-02 23:34
Blake M. wrote:
> Is there a way to have a user connect as themselves from Rails to MySQL,
> instead of connecting via the normal database.yml user?  I'm trying to
> build in security at the database level, with Rails security on top.
>
> Thanks

You want to allow different users connect to different database through
a site?

Is that what you want?

Specific the security information through the site and not through the
database.xml ?

If so you should try to look at establish_connection() method :D
Blake M. (Guest)
on 2007-04-03 01:30
Jamal S. wrote:
> You want to allow different users connect to different database through
> a site?
No, different users, same database

> Specific the security information through the site and not through the
> database.xml ?
Yes

> If so you should try to look at establish_connection() method :D
I looked into this as an option, but I have a hunch that an ActiveRecord
session (established through establish_connection) is process or
application server wide, so it couldn't be used unless each user had
their own process.

What I'm trying to do is create a connection to the database as a user
(each user will have their own MySQL login that is generated from the
website when they register).  This way we can enforce create, read,
update on specific tables priviledges at the database level, and can log
changes "in their name".
This topic is locked and can not be replied to.