I have a Rails 4 app. It is working with devise 3.2.3
. devise is properly integrated. At this point, users can register with email and password, sign in and perform CRUD
operations.
Now here is what I would like to do: Instead of having any user to sign up by themselves, I want to create an admin
. The admin
would retain the responsibility of creating users. I don't want users to sign up by themselves. Basically the admin will create the user, issue them their log-in credentials, and email it to them.
I read this post and similar ones in SO and in devise wikis to no avail.
I have added a boolean
field to users table
to identify admin users.
class AddAdminToUser < ActiveRecord::Migration
def change
add_column :users, :admin, :boolean, :default => false
end
end
I have read about managing users using cancan
but I don't know how to use it to achieve my objective
The solution i'm looking for would probably require a combination of devise
and cancan
.
I would appreciate any guidance on this matter.