This might be a duplicate of a question already asked but i haven't found the one that suits my condition yet.
I am developing a system where there's a user (not an admin) who is registering himself using devise. What i want is to allow this user to create different users and provide them different set of permissions (so can't be predefined permissions and hence, cant use cancan
as far as i am aware). To clarify more, this is the table structure i have come up with yet. Please guide me if i am going on the wrong path here.
USER:
id,
name,
other-details
PERMISSION
id,
name, (name of the section such as gallery, report or users)
create,
edit,
view,
user_id (the user whose permissions are defined here)
Here, create
, edit
and view
are the permissions that the user would have. If the edit
is true, he'll be able to edit that particular section
. I'm sorry if this is not clear. I found Johan's answer (last one) Database schema for ACL match my scenario however i am not sure if its the right way. Also, i am not sure how to implement the SET
mentioned there.
Thanx in advance. Also please feel free to ask for more details if required. I'm clueless about how right this method will be.
P.S: Newbie in Rails Here.