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

Block editing in UI when provided as seed

Oliver Güntherff96282fc19d
diff --git a/app/components/ldap_auth_sources/row_component.rb b/app/components/ldap_auth_sources/row_component.rb
index 5c4e17ceb98..4eab374bf68 100644
--- a/app/components/ldap_auth_sources/row_component.rb
+++ b/app/components/ldap_auth_sources/row_component.rb
@@ -31,7 +31,12 @@
module LdapAuthSources
class RowComponent < ::RowComponent
def name
- link_to model.name, edit_ldap_auth_source_path(model)
+ content = link_to model.name, edit_ldap_auth_source_path(model)
+ if model.seeded_from_env?
+ content += helpers.op_icon('icon icon-info2', title: I18n.t(:label_seeded_from_env_warning))
+ end
+
+ content
end
delegate :host, to: :model
diff --git a/app/controllers/ldap_auth_sources_controller.rb b/app/controllers/ldap_auth_sources_controller.rb
index c270e689b0b..7438cee241e 100644
--- a/app/controllers/ldap_auth_sources_controller.rb
+++ b/app/controllers/ldap_auth_sources_controller.rb
@@ -34,24 +34,26 @@ class LdapAuthSourcesController < ApplicationController
before_action :require_admin
before_action :block_if_password_login_disabled
+ self._model_object = LdapAuthSource
+ before_action :find_model_object, only: %i(edit update destroy)
+ before_action :prevent_editing_when_seeded, only: %i(update)
+
def index
- @auth_sources = LdapAuthSource
+ @ldap_auth_sources = LdapAuthSource
.order(id: :asc)
.page(page_param)
.per_page(per_page_param)
end
def new
- @auth_source = LdapAuthSource.new
+ @ldap_auth_source = LdapAuthSource.new
end
- def edit
- @auth_source = LdapAuthSource.find(params[:id])
- end
+ def edit; end
def create
- @auth_source = LdapAuthSource.new permitted_params.ldap_auth_source
- if @auth_source.save
+ @ldap_auth_source = LdapAuthSource.new permitted_params.ldap_auth_source
+ if @ldap_auth_source.save
flash[:notice] = I18n.t(:notice_successful_create)
redirect_to action: 'index'
else
@@ -60,11 +62,11 @@ class LdapAuthSourcesController < ApplicationController
end
def update
- @auth_source = LdapAuthSource.find(params[:id])
+ @ldap_auth_source = LdapAuthSource.find(params[:id])
updated = permitted_params.ldap_auth_source
updated.delete :account_password if updated[:account_password].blank?
- if @auth_source.update updated
+ if @ldap_auth_source.update updated
flash[:notice] = I18n.t(:notice_successful_update)
redirect_to action: 'index'
else
@@ -84,9 +86,9 @@ class LdapAuthSourcesController < ApplicationController
end
def destroy
- @auth_source = LdapAuthSource.find(params[:id])
- if @auth_source.users.empty?
- @auth_source.destroy
+ @ldap_auth_source = LdapAuthSource.find(params[:id])
+ if @ldap_auth_source.users.empty?
+ @ldap_auth_source.destroy
flash[:notice] = t(:notice_successful_delete)
else
@@ -97,6 +99,13 @@ class LdapAuthSourcesController < ApplicationController
protected
+ def prevent_editing_when_seeded
+ if @ldap_auth_source.seeded_from_env?
+ flash[:warning] = I18n.t(:label_seeded_from_env_warning)
+ redirect_to action: :index
+ end
+ end
+
def default_breadcrumb
if action_name == 'index'
t(:label_ldap_auth_source_plural)
diff --git a/app/models/ldap_auth_source.rb b/app/models/ldap_auth_source.rb
index c0ac6a01988..a1271b5d807 100644
--- a/app/models/ldap_auth_source.rb
+++ b/app/models/ldap_auth_source.rb
@@ -94,6 +94,10 @@ class LdapAuthSource < ApplicationRecord
nil
end
+ def seeded_from_env?
+ Setting.seed_ldap&.key?(name)
+ end
+
def account_password
read_ciphered_attribute(:account_password)
end
diff --git a/app/seeders/env_data/ldap_seeder.rb b/app/seeders/env_data/ldap_seeder.rb
index 938bb8a2424..46928df02ba 100644
--- a/app/seeders/env_data/ldap_seeder.rb
+++ b/app/seeders/env_data/ldap_seeder.rb
@@ -38,10 +38,13 @@ module EnvData
end
end
+ print_status ' ↳ Synchronizing LDAP connections' do
+ LdapGroups::SynchronizationJob.perform_now
+ end
end
def applicable?
- Setting.seed_ldap.any?
+ Setting.seed_ldap.present?
end
private
@@ -80,7 +83,7 @@ module EnvData
def upsert_existing_filters(ldap, filters)
filters.each do |name, options|
- filter = ::LdapGroups::SynchronizedFilter.find_or_initialize_by(auth_source: ldap, name:)
+ filter = ::LdapGroups::SynchronizedFilter.find_or_initialize_by(ldap_auth_source: ldap, name:)
print_ldap_status(filter)
filter.group_name_attribute = options.fetch('group_attribute', 'dn')
diff --git a/app/views/ldap_auth_sources/_form.html.erb b/app/views/ldap_auth_sources/_form.html.erb
index 805911feee2..419754e1cc3 100644
--- a/app/views/ldap_auth_sources/_form.html.erb
+++ b/app/views/ldap_auth_sources/_form.html.erb
@@ -34,7 +34,7 @@ See COPYRIGHT and LICENSE files for more details.
<%= error_messages_for :ldap_auth_source %>
-<% if @auth_source.new_record? %>
+<% if @ldap_auth_source.new_record? %>
<div class="op-toast -info">
<a title="close" class="op-toast--close icon-context icon-close"></a>
<div class="op-toast--content">
@@ -43,7 +43,17 @@ See COPYRIGHT and LICENSE files for more details.
</div>
<% end %>
-<section class="form--section">
+<% if @ldap_auth_source.seeded_from_env? %>
+ <div class="op-toast -warning">
+ <div class="op-toast--content">
+ <%= t(:label_seeded_from_env_warning) %>
+ <br/>
+ <%= link_to t('ldap_auth_sources.back_to_index'), { action: :index } %>
+ </div>
+ </div>
+<% end %>
+
+<%= content_tag :fieldset, class: 'form--fieldset', disabled: @ldap_auth_source.seeded_from_env? do %>
<div class="form--field -required">
<%= f.text_field 'name', required: true, container_class: '-middle' %>
<span class="form--field-instructions">
@@ -57,86 +67,86 @@ See COPYRIGHT and LICENSE files for more details.
</span>
</div>
<div class="form--field -required"><%= f.text_field 'port', required: true, size: 6, container_class: '-xslim' %></div>
+<% end %>
- <fieldset class="form--fieldset">
- <legend class="form--fieldset-legend"><%= t('ldap_auth_sources.connection_encryption') %></legend>
- <p>
- <%= t 'ldap_auth_sources.tls_mode.section_more_info_link_html',
- link: OpenProject::Static::Links[:ldap_encryption_documentation][:href] %>
+<%= content_tag :fieldset, class: 'form--fieldset', disabled: @ldap_auth_source.seeded_from_env? do %>
+ <legend class="form--fieldset-legend"><%= t('ldap_auth_sources.connection_encryption') %></legend>
+ <p>
+ <%= t 'ldap_auth_sources.tls_mode.section_more_info_link_html',
+ link: OpenProject::Static::Links[:ldap_encryption_documentation][:href] %>
+ </p>
+ <div class="form--field">
+ <%= f.radio_button :tls_mode,
+ 'start_tls',
+ label: t('ldap_auth_sources.tls_mode.start_tls'),
+ container_class: '-wide' %>
+ <p class="form--field-instructions">
+ <%= t('ldap_auth_sources.tls_mode.start_tls_description') %>
</p>
- <div class="form--field">
- <%= f.radio_button :tls_mode,
- 'start_tls',
- label: t('ldap_auth_sources.tls_mode.start_tls'),
- container_class: '-wide' %>
- <p class="form--field-instructions">
- <%= t('ldap_auth_sources.tls_mode.start_tls_description') %>
- </p>
- </div>
- <div class="form--field">
- <%= f.radio_button :tls_mode,
- 'simple_tls',
- label: t('ldap_auth_sources.tls_mode.simple_tls'),
- container_class: '-wide' %>
- <p class="form--field-instructions">
- <%= t('ldap_auth_sources.tls_mode.simple_tls_description') %>
- </p>
- </div>
- <div class="form--field">
- <%= f.radio_button :tls_mode,
- 'plain_ldap',
- label: t('ldap_auth_sources.tls_mode.plain'),
- container_class: '-wide' %>
- <p class="form--field-instructions">
- <%= t('ldap_auth_sources.tls_mode.plain_description') %>
- </p>
- </div>
- </fieldset>
- <fieldset class="form--fieldset">
- <legend class="form--fieldset-legend"><%= t('ldap_auth_sources.connection_encryption') %></legend>
- <div class="form--field">
- <%= f.check_box :verify_peer,
- label: t('ldap_auth_sources.tls_options.verify_peer'),
- container_class: '-wide' %>
- <p class="form--field-instructions">
- <%= t('ldap_auth_sources.tls_options.verify_peer_description_html') %>
- </p>
- </div>
- <div class="form--field">
- <%= f.text_area :tls_certificate_string,
- label: LdapAuthSource.human_attribute_name(:tls_certificate_string),
- placeholder: "-----BEGIN CERTIFICATE-----\n ..... \n-----END CERTIFICATE-----",
- rows: 10,
- container_class: '-wide' %>
- <div class="form--field-instructions">
- <p><%= t('ldap_auth_sources.tls_options.tls_certificate_description') %></p>
- </div>
+ </div>
+ <div class="form--field">
+ <%= f.radio_button :tls_mode,
+ 'simple_tls',
+ label: t('ldap_auth_sources.tls_mode.simple_tls'),
+ container_class: '-wide' %>
+ <p class="form--field-instructions">
+ <%= t('ldap_auth_sources.tls_mode.simple_tls_description') %>
+ </p>
+ </div>
+ <div class="form--field">
+ <%= f.radio_button :tls_mode,
+ 'plain_ldap',
+ label: t('ldap_auth_sources.tls_mode.plain'),
+ container_class: '-wide' %>
+ <p class="form--field-instructions">
+ <%= t('ldap_auth_sources.tls_mode.plain_description') %>
+ </p>
+ </div>
+<% end %>
+<%= content_tag :fieldset, class: 'form--fieldset', disabled: @ldap_auth_source.seeded_from_env? do %>
+ <legend class="form--fieldset-legend"><%= t('ldap_auth_sources.connection_encryption') %></legend>
+ <div class="form--field">
+ <%= f.check_box :verify_peer,
+ label: t('ldap_auth_sources.tls_options.verify_peer'),
+ container_class: '-wide' %>
+ <p class="form--field-instructions">
+ <%= t('ldap_auth_sources.tls_options.verify_peer_description_html') %>
+ </p>
+ </div>
+ <div class="form--field">
+ <%= f.text_area :tls_certificate_string,
+ label: LdapAuthSource.human_attribute_name(:tls_certificate_string),
+ placeholder: "-----BEGIN CERTIFICATE-----\n ..... \n-----END CERTIFICATE-----",
+ rows: 10,
+ container_class: '-wide' %>
+ <div class="form--field-instructions">
+ <p><%= t('ldap_auth_sources.tls_options.tls_certificate_description') %></p>
</div>
- </fieldset>
- <fieldset class="form--fieldset">
- <legend class="form--fieldset-legend"><%= t('ldap_auth_sources.system_account') %></legend>
- <p><%= t 'ldap_auth_sources.system_account_legend' %></p>
-
- <div class="form--field">
- <%= f.text_field 'account', container_class: '-middle' %>
- <span class="form--field-instructions">
+ </div>
+<% end %>
+<%= content_tag :fieldset, class: 'form--fieldset', disabled: @ldap_auth_source.seeded_from_env? do %>
+ <legend class="form--fieldset-legend"><%= t('ldap_auth_sources.system_account') %></legend>
+ <p><%= t 'ldap_auth_sources.system_account_legend' %></p>
+
+ <div class="form--field">
+ <%= f.text_field 'account', container_class: '-middle' %>
+ <span class="form--field-instructions">
<%= t('ldap_auth_sources.attribute_texts.system_user_dn_html') %>
</span>
- </div>
- <div class="form--field">
- <%= f.password_field 'account_password',
- label: LdapAuthSource.human_attribute_name(:password),
- placeholder: ((@auth_source.new_record? || @auth_source.account_password.blank?) ? '' : ('●' * 15)),
- autocomplete: 'off',
- container_class: '-middle' %>
- <span class="form--field-instructions">
+ </div>
+ <div class="form--field">
+ <%= f.password_field 'account_password',
+ label: LdapAuthSource.human_attribute_name(:password),
+ placeholder: ((@ldap_auth_source.new_record? || @ldap_auth_source.account_password.blank?) ? '' : ('●' * 15)),
+ autocomplete: 'off',
+ container_class: '-middle' %>
+ <span class="form--field-instructions">
<%= t('ldap_auth_sources.attribute_texts.system_user_password') %>
</span>
- </div>
- </fieldset>
-</section>
+ </div>
+<% end %>
-<fieldset class="form--fieldset">
+<%= content_tag :fieldset, class: 'form--fieldset', disabled: @ldap_auth_source.seeded_from_env? do %>
<legend class="form--fieldset-legend"><%= t('ldap_auth_sources.ldap_details') %></legend>
<div class="form--field">
<%= f.text_field :base_dn, size: 60, container_class: '-wide' %>
@@ -160,9 +170,9 @@ See COPYRIGHT and LICENSE files for more details.
<p><%= t('ldap_auth_sources.attribute_texts.onthefly_register') %></p>
</div>
</div>
-</fieldset>
+<% end %>
-<fieldset class="form--fieldset">
+<%= content_tag :fieldset, class: 'form--fieldset', disabled: @ldap_auth_source.seeded_from_env? do %>
<legend class="form--fieldset-legend"><%= t('ldap_auth_sources.user_settings') %></legend>
<p><%= t 'ldap_auth_sources.user_settings_legend' %></p>
@@ -213,4 +223,4 @@ See COPYRIGHT and LICENSE files for more details.
<%= t('ldap_auth_sources.attribute_texts.admin_map_html') %>
</span>
</div>
-</fieldset>
+<% end %>
diff --git a/app/views/ldap_auth_sources/edit.html.erb b/app/views/ldap_auth_sources/edit.html.erb
index 0e499e6f041..a7cba1c6e01 100644
--- a/app/views/ldap_auth_sources/edit.html.erb
+++ b/app/views/ldap_auth_sources/edit.html.erb
@@ -27,11 +27,13 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
-<% html_title t(:label_administration), "#{t(:label_edit)} #{t(:label_ldap_auth_source)} #{@auth_source.name}" %>
-<% local_assigns[:additional_breadcrumb] = @auth_source.name %>
+<% html_title t(:label_administration), "#{t(:label_edit)} #{t(:label_ldap_auth_source)} #{@ldap_auth_source.name}" %>
+<% local_assigns[:additional_breadcrumb] = @ldap_auth_source.name %>
<%= toolbar title: "#{t(:label_ldap_auth_source)}" %>
-<%= labelled_tabular_form_for @auth_source, as: :ldap_auth_source do |f| %>
+<%= labelled_tabular_form_for @ldap_auth_source do |f| %>
<%= render partial: 'form', locals: { f: f } %>
- <%= styled_button_tag t(:button_save), class: '-highlight -with-icon icon-checkmark' %>
+ <% unless @ldap_auth_source.seeded_from_env? %>
+ <%= styled_button_tag t(:button_save), class: '-highlight -with-icon icon-checkmark' %>
+ <% end %>
<% end %>
diff --git a/app/views/ldap_auth_sources/index.html.erb b/app/views/ldap_auth_sources/index.html.erb
index 403f9a37628..568185e1971 100644
--- a/app/views/ldap_auth_sources/index.html.erb
+++ b/app/views/ldap_auth_sources/index.html.erb
@@ -40,4 +40,4 @@ See COPYRIGHT and LICENSE files for more details.
</li>
<% end %>
-<%= render ::LdapAuthSources::TableComponent.new(rows: @auth_sources) %>
+<%= render ::LdapAuthSources::TableComponent.new(rows: @ldap_auth_sources) %>
diff --git a/app/views/ldap_auth_sources/new.html.erb b/app/views/ldap_auth_sources/new.html.erb
index 741e16bf167..06862937c43 100644
--- a/app/views/ldap_auth_sources/new.html.erb
+++ b/app/views/ldap_auth_sources/new.html.erb
@@ -31,7 +31,7 @@ See COPYRIGHT and LICENSE files for more details.
<% local_assigns[:additional_breadcrumb] = t(:label_ldap_auth_source_new) %>
<%= toolbar title: "#{t(:label_ldap_auth_source_new)}" %>
-<%= labelled_tabular_form_for @auth_source, as: :ldap_auth_source do |f| %>
+<%= labelled_tabular_form_for @ldap_auth_source, as: :ldap_auth_source do |f| %>
<%= render partial: 'form', locals: { f: f } %>
<%= styled_button_tag t(:button_create), class: '-highlight -with-icon icon-checkmark' %>
<% end %>
diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb
index 2660681a34c..9ea2395ce1c 100644
--- a/app/views/users/new.html.erb
+++ b/app/views/users/new.html.erb
@@ -43,7 +43,7 @@ See COPYRIGHT and LICENSE files for more details.
'admin--users-password-auth-selected-value': @user.ldap_auth_source_id.blank?,
},
as: :user do |f| %>
- <%= render partial: 'simple_form', locals: { f: f, auth_sources: @auth_sources, user: @user } %>
+ <%= render partial: 'simple_form', locals: { f: f, auth_sources: @ldap_auth_sources, user: @user } %>
<p>
<%= styled_button_tag t(:button_create), class: '-highlight -with-icon icon-checkmark' %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index aa667728467..cb4eae296bc 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -111,17 +111,13 @@ en:
enterprise:
description: 'Provide additional information for attributes (incl. custom fields) of work packages and projects. Help texts are displayed when users click on the question mark symbol next to input fields in projects and work packages.'
- ldap_auth_sources:
- index:
- no_results_content_title: There are currently no LDAP connections.
- no_results_content_text: Create a new LDAP connection
-
background_jobs:
status:
error_requeue: "Job experienced an error but is retrying. The error was: %{message}"
cancelled_due_to: "Job was cancelled due to error: %{message}"
ldap_auth_sources:
+ back_to_index: 'Click here to go back to the list of connection.'
technical_warning_html: |
This LDAP form requires technical knowledge of your LDAP / Active Directory setup.
<br/>
@@ -2171,6 +2167,7 @@ en:
label_global_role: "Global Role"
label_not_changeable: "(not changeable)"
label_global: "Global"
+ label_seeded_from_env_warning: This record has been created through a setting / environment variable. It is not editable through UI.
auth_source:
using_abstract_auth_source: "Can't use an abstract authentication source."
diff --git a/modules/ldap_groups/app/components/ldap_groups/synchronized_filters/row_component.rb b/modules/ldap_groups/app/components/ldap_groups/synchronized_filters/row_component.rb
index 5e1cde0fb7d..9d2346a543f 100644
--- a/modules/ldap_groups/app/components/ldap_groups/synchronized_filters/row_component.rb
+++ b/modules/ldap_groups/app/components/ldap_groups/synchronized_filters/row_component.rb
@@ -57,10 +57,12 @@ module LdapGroups
[
edit_link,
delete_link
- ]
+ ].compact
end
def edit_link
+ return if model.seeded_from_env?
+
link_to I18n.t(:button_edit),
{ controller: table.target_controller, ldap_filter_id: model.id, action: :edit },
class: 'icon icon-edit',
@@ -68,6 +70,8 @@ module LdapGroups
end
def delete_link
+ return if model.seeded_from_env?
+
link_to I18n.t(:button_delete),
{ controller: table.target_controller, ldap_filter_id: model.id, action: :destroy_info },
class: 'icon icon-delete',
diff --git a/modules/ldap_groups/app/models/ldap_groups/synchronized_filter.rb b/modules/ldap_groups/app/models/ldap_groups/synchronized_filter.rb
index b0e5564be45..43baa15f7ce 100644
--- a/modules/ldap_groups/app/models/ldap_groups/synchronized_filter.rb
+++ b/modules/ldap_groups/app/models/ldap_groups/synchronized_filter.rb
@@ -10,6 +10,7 @@ module LdapGroups
foreign_key: 'filter_id',
dependent: :destroy
+ validates_presence_of :name
validates_presence_of :filter_string
validates_presence_of :ldap_auth_source
validate :validate_filter_syntax
@@ -23,6 +24,13 @@ module LdapGroups
base_dn.presence || ldap_auth_source.base_dn
end
+ def seeded_from_env?
+ return false if ldap_auth_source.nil?
+
+ ldap_auth_source&.seeded_from_env? &&
+ Setting.seed_ldap.dig(ldap_auth_source.name, 'groupfilter', name)
+ end
+
private
def validate_filter_syntax
diff --git a/modules/ldap_groups/app/views/ldap_groups/synchronized_filters/show.html.erb b/modules/ldap_groups/app/views/ldap_groups/synchronized_filters/show.html.erb
index 21f6f7c89b5..e43b446b714 100644
--- a/modules/ldap_groups/app/views/ldap_groups/synchronized_filters/show.html.erb
+++ b/modules/ldap_groups/app/views/ldap_groups/synchronized_filters/show.html.erb
@@ -1,24 +1,36 @@
<% html_title(t(:label_administration), t('ldap_groups.synchronized_filters.plural'), h(@filter.name)) -%>
<%= error_messages_for @filter %>
+<% blocked = @filter.seeded_from_env? %>
<%= breadcrumb_toolbar(h(@filter.name)) do %>
- <li class="toolbar-item">
- <%= link_to({ action: :edit },
- class: 'button') do %>
- <%= op_icon('button--icon icon-edit') %>
- <span class="button--text"><%= t(:button_edit) %></span>
- <% end %>
- </li>
- <li class="toolbar-item">
- <%= link_to({ action: :destroy_info },
- class: 'button -danger') do %>
- <%= op_icon('button--icon icon-delete') %>
- <span class="button--text"><%= t(:button_delete) %></span>
- <% end %>
- </li>
+ <% unless blocked %>
+ <li class="toolbar-item">
+ <%= link_to({ action: :edit },
+ class: 'button') do %>
+ <%= op_icon('button--icon icon-edit') %>
+ <span class="button--text"><%= t(:button_edit) %></span>
+ <% end %>
+ </li>
+ <li class="toolbar-item">
+ <%= link_to({ action: :destroy_info },
+ class: 'button -danger') do %>
+ <%= op_icon('button--icon icon-delete') %>
+ <span class="button--text"><%= t(:button_delete) %></span>
+ <% end %>
+ </li>
+ <% end %>
<% end %>
+<% if blocked %>
+ <div class="op-toast -warning">
+ <div class="op-toast--content">
+ <%= t(:label_seeded_from_env_warning) %>
+ </div>
+ </div>
+<% end %>
+
+
<section class="admin--edit-section">
<%= render(AttributeGroups::AttributeGroupComponent.new) do |component|
component.with_attribute(key: @filter.class.human_attribute_name(:name),
@@ -29,10 +41,10 @@
value: @filter.used_base_dn)
component.with_attribute(key: @filter.class.human_attribute_name(:sync_users),
value: if @filter.sync_users
- checked_image @filter.sync_users
- else
- t(:general_text_no)
- end)
+ checked_image @filter.sync_users
+ else
+ t(:general_text_no)
+ end)
component.with_attribute(key: @filter.class.human_attribute_name(:filter_string),
value: @filter.filter_string)
component.with_attribute(key: t('ldap_groups.synchronized_groups.plural'),
@@ -41,14 +53,14 @@
</section>
<section class="admin--edit-section">
-<%= toolbar(title: t('ldap_groups.synchronized_groups.plural')) do %>
- <li class="toolbar-item">
- <%= link_to({ action: :synchronize },
- class: 'button') do %>
- <span class="button--text"><%= t('ldap_groups.label_synchronize') %></span>
- <% end %>
- </li>
-<% end %>
+ <%= toolbar(title: t('ldap_groups.synchronized_groups.plural')) do %>
+ <li class="toolbar-item">
+ <%= link_to({ action: :synchronize },
+ class: 'button') do %>
+ <span class="button--text"><%= t('ldap_groups.label_synchronize') %></span>
+ <% end %>
+ </li>
+ <% end %>
<%= render ::LdapGroups::SynchronizedGroups::TableComponent.new(rows: @filter.groups, show_inline_create: false, deletable: false) %>
</section>
diff --git a/spec/controllers/ldap_auth_sources_controller_spec.rb b/spec/controllers/ldap_auth_sources_controller_spec.rb
index 6c746100548..e19a5efbf7e 100644
--- a/spec/controllers/ldap_auth_sources_controller_spec.rb
+++ b/spec/controllers/ldap_auth_sources_controller_spec.rb
@@ -41,13 +41,13 @@ RSpec.describe LdapAuthSourcesController do
get :new
end
- it { expect(assigns(:auth_source)).not_to be_nil }
+ it { expect(assigns(:ldap_auth_source)).not_to be_nil }
it { is_expected.to respond_with :success }
it { is_expected.to render_template :new }
it 'initializes a new LdapAuthSource' do
- expect(assigns(:auth_source).class).to eq LdapAuthSource
- expect(assigns(:auth_source)).to be_new_record
+ expect(assigns(:ldap_auth_source).class).to eq LdapAuthSource
+ expect(assigns(:ldap_auth_source)).to be_new_record
end
end
@@ -77,7 +77,7 @@ RSpec.describe LdapAuthSourcesController do
get :edit, params: { id: ldap.id }
end
- it { expect(assigns(:auth_source)).to eq ldap }
+ it { expect(assigns(:ldap_auth_source)).to eq ldap }
it { is_expected.to respond_with :success }
it { is_expected.to render_template :edit }
end