0
votes

I'm trying to setup roles in my rails app with Rolify.

I have a CRUD model setup for roles. I'm about to start exploring how certain users can assign scoped roles to other users.

Is there a way I can allow users who are permitted to assign roles, to specify a renewal date, by which they need to confirm that the user is continuing in that role?

At the moment, my roles table only has associations to resource and user, and a string attribute called :name (for the name of the role).

Can I add a boolean for true/false on whether the role has an expiry date, and if it does, when a renewal notice should be issued?

Is there a better way to go about this?

1

1 Answers

0
votes

This can be good idea:

  1. Create a table for roles and permission.
  2. add a field has_expired in that table.
  3. When you save permission set expiry date.
  4. When user logins test expire date.
  5. Then set has_expired to true
  6. If you are using cancancan gem then in ability.rb model:

    if user.role.has_expired? cannot :manage, Role end

Hope it helps