Authorisation management using CanCanCan added

This commit is contained in:
Christoph Haas 2021-02-28 21:36:46 +01:00
parent 51be4a4777
commit 7a3b65fe50
24 changed files with 211 additions and 295 deletions

View file

@ -0,0 +1,14 @@
# Rename the :admin field to :admin_role and change integer to boolean
class AddRolesToUsers < ActiveRecord::Migration[6.1]
def change
add_column :users, :admin_role, :boolean, default: false
User.find_each do |user|
user.admin_role=true if user.admin>0
user.save!
end
remove_column :users, :admin
add_column :users, :moderator_role, :boolean, default: false
end
end