مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2025-12-01 05:43:04 +00:00
refactor: user management
هذا الالتزام موجود في:
@@ -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})"
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم