Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Don't show add button when enterprise token is missing

Jan Sandbrink6933b84e58a2
diff --git a/app/views/admin/scim_clients/index.html.erb b/app/views/admin/scim_clients/index.html.erb
index 6aac8cc9ad1..b7eaa8780e9 100644
--- a/app/views/admin/scim_clients/index.html.erb
+++ b/app/views/admin/scim_clients/index.html.erb
@@ -43,11 +43,13 @@ See COPYRIGHT and LICENSE files for more details.
<%=
render(Primer::OpenProject::SubHeader.new) do |component|
- component.with_action_button(leading_icon: :plus,
- label: t(".label_create_button"),
- scheme: :primary,
- tag: :a,
- href: new_admin_scim_client_path) { ScimClient.model_name.human }
+ if EnterpriseToken.allows_to?(:scim_api)
+ component.with_action_button(leading_icon: :plus,
+ label: t(".label_create_button"),
+ scheme: :primary,
+ tag: :a,
+ href: new_admin_scim_client_path) { ScimClient.model_name.human }
+ end
end
%>
diff --git a/spec/features/admin/scim_clients/index_spec.rb b/spec/features/admin/scim_clients/index_spec.rb
index 82fb3f8278d..fe8475d7ae5 100644
--- a/spec/features/admin/scim_clients/index_spec.rb
+++ b/spec/features/admin/scim_clients/index_spec.rb
@@ -44,6 +44,10 @@ RSpec.describe "Listing SCIM clients", :js, :selenium, driver: :firefox_de do
expect(page).to have_enterprise_banner(:corporate)
expect(page).to have_no_test_selector("Admin::ScimClients::TableComponent")
+
+ within(".SubHeader") do
+ expect(page).to have_no_link("SCIM client")
+ end
end
end