houdini/app/controllers/settings_controller.rb

32 lines
1,021 B
Ruby

# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class SettingsController < ApplicationController
include Controllers::Nonprofit::Current
include Controllers::Nonprofit::Authorization
helper_method :current_nonprofit_user?
before_action :authenticate_user!
def index
if current_role?(:super_admin) && params[:nonprofit_id]
@nonprofit = Nonprofit.find(params[:nonprofit_id])
elsif current_role?(%i[nonprofit_admin nonprofit_associate])
@nonprofit = administered_nonprofit
end
@user = if current_role?(:super_admin) && params[:user_id]
User.find_by_id(params[:user_id])
elsif current_role?(:super_admin) && params[:user_email]
User.find_by_email(params[:user_email])
else
current_user
end
@profile = @user.profile
if @nonprofit
@miscellaneous_np_info = FetchMiscellaneousNpInfo.fetch(@nonprofit.id)
end
end
end