Set up Pundit

This commit is contained in:
Andreas Nedbal 2022-11-18 22:50:35 +01:00 committed by Andreas Nedbal
parent 5f2b044d80
commit c8f990e319
3 changed files with 6 additions and 0 deletions

View File

@ -109,3 +109,5 @@ gem "omniauth-rails_csrf_protection", "~> 1.0"
gem "net-smtp" gem "net-smtp"
gem "net-imap" gem "net-imap"
gem "net-pop" gem "net-pop"
gem "pundit", "~> 2.2"

View File

@ -304,6 +304,8 @@ GEM
public_suffix (4.0.7) public_suffix (4.0.7)
puma (6.0.0) puma (6.0.0)
nio4r (~> 2.0) nio4r (~> 2.0)
pundit (2.2.0)
activesupport (>= 3.0.0)
questiongenerator (1.0.0) questiongenerator (1.0.0)
racc (1.6.0) racc (1.6.0)
rack (2.2.4) rack (2.2.4)
@ -550,6 +552,7 @@ DEPENDENCIES
pg pg
pghero pghero
puma puma
pundit (~> 2.2)
questiongenerator (~> 1.0) questiongenerator (~> 1.0)
rails (~> 6.1) rails (~> 6.1)
rails-controller-testing rails-controller-testing

View File

@ -1,4 +1,5 @@
class ApplicationController < ActionController::Base class ApplicationController < ActionController::Base
include Pundit::Authorization
# Prevent CSRF attacks by raising an exception. # Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead. # For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception protect_from_forgery with: :exception