Good morning, I am currently developing an intranet with different tools, I am using devise and cancan to assign roles to users, however I have a problem which is that the same user will have a different role in each tool of the intranet so you can do or see different things, I read several tutorials and look for different gems but I can not find one that allows me to manage that versatility with the same user login.
If anyone knows a way to achieve this or if it is not possible to thank them for helping me to know it, I will keep looking.
Thank you in advance.
Edited:
Create the following structure:
class CreateUserDetails < ActiveRecord::Migration[5.0]
def change
create_table :user_details do |t|
t.integer :user_id
t.integer :app_role_id
t.integer :role_id
t.integer :company_id
t.timestamps
end
end
end
class CreateAppRoles < ActiveRecord::Migration[5.0]
def change
create_table :app_roles do |t|
t.string :nombre
t.timestamps
end
end
end
class CreateRoles < ActiveRecord::Migration[5.0]
def change
create_table :roles do |t|
t.string :nombre
t.timestamps
end
end
end
However, I can not get current_user to get the role and the app that will use from UserDetails that references the Devise User table.
Likewise try to create a model devise by app but I can not find how to make it work with a single login.