1
0
مراية لـ https://github.com/postalserver/postal.git تم المزامنة 2025-12-01 05:43:04 +00:00

refactor: user management

هذا الالتزام موجود في:
Adam Cooke
2021-07-27 16:55:20 +00:00
الأصل e9a52e9512
التزام daf469ce7f
27 ملفات معدلة مع 106 إضافات و359 حذوفات

عرض الملف

@@ -5,7 +5,6 @@ class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :login_required
before_action :verified_email_required
before_action :set_timezone
rescue_from Authie::Session::InactiveSession, :with => :auth_session_error
@@ -23,25 +22,13 @@ class ApplicationController < ActionController::Base
def admin_required
if logged_in?
unless current_user.admin?
render :text => "Not permitted"
render :plain => "Not permitted"
end
else
redirect_to login_path(:return_to => request.fullpath)
end
end
def verified_email_required
if logged_in? && !current_user.verified?
redirect_to verify_path(:return_to => request.fullpath)
end
end
def require_organization_admin
unless organization.admin?(current_user)
redirect_to organization_root_path(organization), :alert => "This page can only be accessed by the organization admins"
end
end
def require_organization_owner
unless organization.owner == current_user
redirect_to organization_root_path(organization), :alert => "This page can only be accessed by the organization's owner (#{organization.owner.name})"