Add access control and :forbidden error handling

This commit is contained in:
2023-04-24 23:08:55 +02:00
parent 461f0bb812
commit 634ba7e901
5 changed files with 41 additions and 23 deletions

View File

@@ -1,6 +1,15 @@
class ApplicationController < ActionController::Base
helper_method :current_user_at_least
before_action :authenticate_user!
class AccessForbidden < StandardError
end
def current_user_at_least(status)
User.statuses[current_user.status] >= User.statuses[status]
end
protected
def after_sign_out_path_for(scope)