Guest
2006-Mar-14 14:40 UTC
[Rails] Only allowing areas of site to users using authentication
I have a site in development where I only want specific users to access specific items that uses belongs_to and has_many. Say we have this kind of structure. Person <belongs_to + has_many> Items When person logged in they only have access to items that belongs to him/her. I''m using auth_generator but only seem to put an auth inside controllers and dont know how to go any futher. Any help would be great. -- Posted via http://www.ruby-forum.com/.
Guest
2006-Mar-14 14:49 UTC
[Rails] Re: Only allowing areas of site to users using authenticatio
To further ellaborate... This is my table structure Client (has many domains) Domain (belongs to client and has many reports) Report (belongs to domain) Currently when I select client in the frontend it shows me what domains belong to that client. I want to set up that when a client logs in it shows the domains/reports that belong to them. Thanks -- Posted via http://www.ruby-forum.com/.
Jan Prill
2006-Mar-14 15:43 UTC
[Rails] Only allowing areas of site to users using authentication
Hi, Guest, I think your problem isn''t solely about authentication. IMHO you simply need the following steps: #1: Check if there is a user authenticated => if not display the login page or a guest page or whatever #2: Read the session to get the user who is authenticated => don''t know how to do this with auth_generator but probably it''s something like session[:user] #3: use the relation from the read out user with something like: session[:user].items #4: Display the resulting items Best Regards Jan Prill On 3/14/06, Guest <shartwright@gmail.com> wrote:> > I have a site in development where I only want specific users to access > specific items that uses belongs_to and has_many. > > Say we have this kind of structure. > > Person <belongs_to + has_many> Items > > When person logged in they only have access to items that belongs to > him/her. > > I''m using auth_generator but only seem to put an auth inside controllers > and dont know how to go any futher. > > Any help would be great. > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060314/25c34657/attachment.html