Skip to content

Commit

Permalink
Put conditions on academic routes
Browse files Browse the repository at this point in the history
  • Loading branch information
pskl committed Feb 19, 2025
1 parent de3b20b commit c4561fc
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,22 @@

delete "asp/logout", to: "asp/application#logout", as: :destroy_asp_user_session

namespace :academic do
get "home", to: "application#home"
# TODO: remove condition once academic feature is released
if !Rails.env.production?
namespace :academic do
get "home", to: "application#home"

resources :users, only: [] do
get "select_academy"
end
resources :users, only: [] do
get "select_academy"
end

devise_for :users, skip: :all, class_name: "Academic::User"
end
devise_for :users, skip: :all, class_name: "Academic::User"
end

get "academic/login", to: "academic/application#login", as: :new_academic_user_session
get "academic/login", to: "academic/application#login", as: :new_academic_user_session

delete "academic/logout", to: "academic/application#logout", as: :destroy_academic_user_session
delete "academic/logout", to: "academic/application#logout", as: :destroy_academic_user_session
end

resources :users, only: :update do
get "select_establishment"
Expand Down Expand Up @@ -113,9 +116,12 @@
get "/auth/asp/callback" => "users/omniauth_callbacks#asp", as: :asp_login
end

devise_scope :academic_user do
%w[academic academic_developer].each do |action|
match "/auth/#{action}/callback", to: "users/omniauth_callbacks##{action}", via: %i[get post]
# TODO: remove condition once acadamic feature is released
if !Rails.env.production?
devise_scope :academic_user do
%w[academic academic_developer].each do |action|
match "/auth/#{action}/callback", to: "users/omniauth_callbacks##{action}", via: %i[get post]
end
end
end

Expand Down

0 comments on commit c4561fc

Please sign in to comment.