Jump to content

The ultimate community for Ruby on Rails developers.


Photo

Restrict content based on group membership / roles

Devise Rolify Authority

  • Please log in to reply
1 reply to this topic

#1 Bjornst

Bjornst

    Passenger

  • Members
  • 3 posts

Posted 18 May 2014 - 08:11 PM

Hi!

 

So i have been building a rails app that is based around a post model. On this website i write articles about different topics and now i want to restrict access to certain articles based on 1) They are logged in and registered and 2) they belong to the right group and are allowed to read that article.

 

I'm using devise and i have created a user model. I have also added Rolify to handle the roles and Authority to tie it together. 

 

At the moment i can restrict access to a page by forcing the reader to be logged in.. but that doesn't really solve the whole problem. I can't seem to get it to check what group the person belongs to and as long as the person is logged in it doenst care role that person has. How do i ties this into my controllers etc?  If someone has experience in using these gems and knows what i might be doing wrong please help me :)

 

I don't know if they way i'm going about this is the right way.. and i would love to get some feedback on the best way of doing this.

 

Best Regards

 

Björn



#2 Bjornst

Bjornst

    Passenger

  • Members
  • 3 posts

Posted 20 May 2014 - 07:24 PM

Ok so i might have confused roles with groups. What was looking for is a group membership system. There seems to be very few gems out there that meet this need. Most of them are focused around roles to control if you can edit, delete and so on.. I tried out Groupify but can't really get it to work. I could try to build the group functionality from scratch with some kind of has_many and belongs_to relations. 







Also tagged with one or more of these keywords: Devise, Rolify, Authority

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users