Closed j-manu closed 3 years ago
Assuming that you want special authentication behaviour for admin users, you would typically create a separate Rodauth configuration with a diffferent route prefix:
class RodauthApp < Rodauth::Rails::App
# main users
configure do
# ...
end
# admin users
configure(:admin) do
enable ... # admin features
prefix "/admin"
end
route do |r|
# ...
r.rodauth
r.on("admin") { r.rodauth(:admin) } # route admin authentication requests
# ...
end
end
You should be able to reuse the main accounts
table and other account_*
tables for storing admin users. However, if you need things like separate email uniqueness validation, you can choose a different table:
configure(:admin) do
# ...
accounts_table :admin_accounts
password_hash_table :admin_account_password_hashes
# ... and so on ...
end
In devise when I want to have admin users, I create a separate model
AdminUser
. How do I handle that here?