"Open Web IDE" button doesn’t work when self-managed instance license expires

Summary

Git push is disabled on self-managed instances when its license expires. In other words, the instance becomes read-only. The Web IDE doesn’t detect that the license expired either and it tells the user to fork the project because they don‘t have write access.

Steps to reproduce

  1. Apply the following patch in your local environment to simulate an expired license scenario.
diff --git a/ee/app/policies/ee/base_policy.rb b/ee/app/policies/ee/base_policy.rb
index d69dff5ce286..1f0a279210a2 100644
--- a/ee/app/policies/ee/base_policy.rb
+++ b/ee/app/policies/ee/base_policy.rb
@@ -16,7 +16,7 @@ module BasePolicy
       condition(:suggested_reviewers_bot, score: 0) { @user&.suggested_reviewers_bot? }
 
       with_scope :global
-      condition(:license_block) { License.block_changes? }
+      condition(:license_block) { true }
 
       rule { auditor }.enable :read_all_resources
  1. If I open http://gdk.test:3000/gitlab-org/gitlab-shell/-/blob/main/CHANGELOG in the my local environment, and I try to edit it in the Web IDE, the web browser navigates to http://gdk.test:3000/-/ide/project/root/gitlab-shell/edit/main/-/CHANGELOG which doesn’t exist. If you replace root with gitlab-org in that URL, the Web IDE opens, but it doesn’t detect that the GitLab instance is read-only.

Example Project

You can use gitlab-org/gitlab-shell in your local environment.

What is the current bug behavior?

  • The Web IDE asks the user to Fork the Project that they are opening to obtain write access when the user doesn't have write access because the GitLab instance license expired.

What is the expected correct behavior?

  • The Web IDE opens the project in read-only mode and it doesn't ask the user to fork the project.

Relevant logs and/or screenshots

Description Screenshot
Web IDE tells the user to go to a fork even though the user is in a fork 2023-05-15 16.02.27.gif
Edited by Enrique Alcántara