diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-08 00:12:55 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-08 00:12:55 +0300 |
commit | 2cf4bdd0b060175c7058b395014b101fbe6214a3 (patch) | |
tree | f3aaeca09cc434632c8eb2c2998877c3f9a2e0d9 /app/controllers | |
parent | 1bdc6c89c32a7380a81598629b9ad05ba9a2a94f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/ide_controller.rb | 19 | ||||
-rw-r--r-- | app/controllers/user_settings/active_sessions_controller.rb (renamed from app/controllers/profiles/active_sessions_controller.rb) | 4 |
2 files changed, 20 insertions, 3 deletions
diff --git a/app/controllers/ide_controller.rb b/app/controllers/ide_controller.rb index d9566121dcd..4a4d41f3e6f 100644 --- a/app/controllers/ide_controller.rb +++ b/app/controllers/ide_controller.rb @@ -5,7 +5,8 @@ class IdeController < ApplicationController include StaticObjectExternalStorageCSP include Gitlab::Utils::StrongMemoize - before_action :authorize_read_project! + before_action :authorize_read_project!, only: [:index] + before_action :ensure_web_ide_oauth_application!, only: [:index] before_action do push_frontend_feature_flag(:build_service_proxy) @@ -27,12 +28,28 @@ class IdeController < ApplicationController render layout: helpers.use_new_web_ide? ? 'fullscreen' : 'application' end + def oauth_redirect + return render_404 unless ::Gitlab::WebIde::DefaultOauthApplication.feature_enabled?(current_user) + # TODO - It's **possible** we end up here and no oauth application has been set up. + # We need to have better handling of these edge cases. Here's a follow-up issue: + # https://gitlab.com/gitlab-org/gitlab/-/issues/433322 + return render_404 unless ::Gitlab::WebIde::DefaultOauthApplication.oauth_application + + render layout: 'fullscreen', locals: { minimal: true } + end + private def authorize_read_project! render_404 unless can?(current_user, :read_project, project) end + def ensure_web_ide_oauth_application! + return unless ::Gitlab::WebIde::DefaultOauthApplication.feature_enabled?(current_user) + + ::Gitlab::WebIde::DefaultOauthApplication.ensure_oauth_application! + end + def fork_info(project, branch) return if can?(current_user, :push_code, project) diff --git a/app/controllers/profiles/active_sessions_controller.rb b/app/controllers/user_settings/active_sessions_controller.rb index 5a86179b89f..da5664a8c1b 100644 --- a/app/controllers/profiles/active_sessions_controller.rb +++ b/app/controllers/user_settings/active_sessions_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Profiles::ActiveSessionsController < Profiles::ApplicationController +class UserSettings::ActiveSessionsController < Profiles::ApplicationController feature_category :system_access def index @@ -13,7 +13,7 @@ class Profiles::ActiveSessionsController < Profiles::ApplicationController current_user.forget_me! respond_to do |format| - format.html { redirect_to profile_active_sessions_url, status: :found } + format.html { redirect_to user_settings_active_sessions_url, status: :found } format.js { head :ok } end end |