elorest / petergate

Easy to use and read action and content based authorizations.
MIT License
195 stars 24 forks source link

Get user roles from ActiveRecord #19

Open uygunes opened 7 years ago

uygunes commented 7 years ago

Not sure if this counts as an issue, but i am new to rails and dont know if or how it is doable.

I want to be able to have a model called UserRoles and dynamically create new roles. How do i need to modify User model to provide this?

Thanks in advance!

elorest commented 7 years ago

Because roles tie into actions in controllers they have to be created in the code. However you could create roles that combine multiple roles for instance one user could have a role that maps to [:editor, :reader, :contributer]. That way you could dynamically create roles that map to multiple actually roles. You would have to enable multiple: true in petergate for this to work.

elorest commented 6 years ago

Did that help?