[Rails] Re: One database and several users with different access rights

2017-07-12 Thread Matt Jones
On Tuesday, 11 July 2017 23:39:13 UTC-4, Ralph Shnelvar wrote: > > I have a database with a large table. > > I have several users each of whom should have read-only rights to the > large table but has read/wrtie rights to their own table(s) but not to each > others table(s). > > Adding to the c

[Rails] Rails, Postgres, environment variables, Ubuntu, no PL/R

2017-07-12 Thread Ralph Shnelvar
This may be more of a Postgres question than a Rails or Ruby question but ... since I want to do this in a Rails environment ... I store my Postgres password in an environment variable whose name is a long randomly generated string in the appropriate format for an Ubuntu environment variable na

Re: [Rails] Re: One database and several users with different access rights

2017-07-12 Thread Colin Law
On 12 July 2017 at 15:13, Ralph Shnelvar wrote: > What's the convention here: top posting or bottom posting? Whatever is appropriate for the message at hand. When making a number of points wrt previous post then obviously inline posting is preferable. Well it's obvious to me anyway. Colin > >

Re: [Rails] Re: One database and several users with different access rights

2017-07-12 Thread Ralph Shnelvar
What's the convention here: top posting or bottom posting? Ralph On Wednesday, July 12, 2017 at 7:52:06 AM UTC-6, Hassan Schroeder wrote: > > On Wed, Jul 12, 2017 at 6:33 AM, Ralph Shnelvar > wrote: > > > I _think_ I need to do something like "sudo -i -u > SomeOtherPostgresUserName" > > but

Re: [Rails] Re: One database and several users with different access rights

2017-07-12 Thread Hassan Schroeder
On Wed, Jul 12, 2017 at 6:33 AM, Ralph Shnelvar wrote: > I _think_ I need to do something like "sudo -i -u SomeOtherPostgresUserName" > but I want to do it inside Rails so I can connect to databases as user > SomeOtherPostgresUserName. I would look at ActiveRecord::Base.establish_connection()

[Rails] Re: One database and several users with different access rights

2017-07-12 Thread Ralph Shnelvar
David, I looked through your code and I'm not sure you have answered my question. Let me try to clarify. There is a difference between a Devise role and a Postgres role. A devise role will control access to Rails functionality. For example, one can restrict access to a Rails controller metho

[Rails] Re: One database and several users with different access rights

2017-07-12 Thread David Gleba
I use devise and cancancan for login and roles. In my little rails app generator project: https://github.com/dgleba/bashrail there are scripts for this. Even if you don't use the scripts, they document exactly how to implement it in that case. look at: https://github.com/dgleba/bashrail/blo