Commit d2fb7f89 authored by Valery Sizov's avatar Valery Sizov

Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ee into rc/ce-to-ee-monday

parents dab4d712 e5eebeb8
...@@ -83,4 +83,4 @@ ...@@ -83,4 +83,4 @@
})(); })();
}).call(this); }).call(window);
...@@ -69,4 +69,4 @@ ...@@ -69,4 +69,4 @@
}); });
}); });
}).call(this); }).call(window);
...@@ -35,7 +35,6 @@ $(() => { ...@@ -35,7 +35,6 @@ $(() => {
el: $boardApp, el: $boardApp,
components: { components: {
'board': gl.issueBoards.Board, 'board': gl.issueBoards.Board,
'boards-selector': gl.issueBoards.BoardsSelector,
'board-sidebar': gl.issueBoards.BoardSidebar, 'board-sidebar': gl.issueBoards.BoardSidebar,
'board-add-issues-modal': gl.issueBoards.IssuesModal, 'board-add-issues-modal': gl.issueBoards.IssuesModal,
}, },
...@@ -110,4 +109,11 @@ $(() => { ...@@ -110,4 +109,11 @@ $(() => {
</button> </button>
`, `,
}); });
gl.IssueboardsSwitcher = new Vue({
el: '#js-multiple-boards-switcher',
components: {
'boards-selector': gl.issueBoards.BoardsSelector,
}
});
}); });
...@@ -47,6 +47,9 @@ ...@@ -47,6 +47,9 @@
Store.state.reload = true; Store.state.reload = true;
}); });
}, },
cancel() {
Store.state.currentPage = '';
},
}, },
}); });
})(); })();
...@@ -64,6 +64,7 @@ require('./board_new_form'); ...@@ -64,6 +64,7 @@ require('./board_new_form');
}, },
methods: { methods: {
showPage(page) { showPage(page) {
this.state.reload = false;
this.state.currentPage = page; this.state.currentPage = page;
}, },
toggleDropdown() { toggleDropdown() {
......
...@@ -48,4 +48,4 @@ ...@@ -48,4 +48,4 @@
}); });
}); });
}).call(this); }).call(window);
...@@ -21,4 +21,4 @@ ...@@ -21,4 +21,4 @@
})(); })();
}).call(this); }).call(window);
...@@ -71,4 +71,4 @@ ...@@ -71,4 +71,4 @@
})(); })();
}).call(this); }).call(window);
...@@ -49,6 +49,15 @@ ...@@ -49,6 +49,15 @@
.page-with-sidebar { .page-with-sidebar {
padding-bottom: 0; padding-bottom: 0;
} }
.issues-details-filters {
display: -webkit-flex;
display: flex;
}
.filter-form {
width: 100%;
}
} }
.boards-app { .boards-app {
...@@ -63,6 +72,7 @@ ...@@ -63,6 +72,7 @@
.boards-list { .boards-list {
height: calc(100vh - 152px); height: calc(100vh - 152px);
width: 100%; width: 100%;
padding-top: 25px;
padding-bottom: 25px; padding-bottom: 25px;
padding-right: ($gl-padding / 2); padding-right: ($gl-padding / 2);
padding-left: ($gl-padding / 2); padding-left: ($gl-padding / 2);
...@@ -70,8 +80,8 @@ ...@@ -70,8 +80,8 @@
white-space: nowrap; white-space: nowrap;
@media (min-width: $screen-sm-min) { @media (min-width: $screen-sm-min) {
height: 409px; // Needed for PhantomJS height: 475px; // Needed for PhantomJS
height: calc(100vh - 290px); height: calc(100vh - 220px);
min-height: 409px; min-height: 409px;
transition: width .2s; transition: width .2s;
...@@ -304,21 +314,6 @@ ...@@ -304,21 +314,6 @@
} }
} }
.boards-switcher {
padding: 0;
border: 0;
outline: 0;
background: none;
font-size: 19px;
font-weight: 600;
> .fa {
position: relative;
top: 2px;
margin-left: 5px;
}
}
.board-selector-page-two { .board-selector-page-two {
padding-left: 10px; padding-left: 10px;
padding-right: 10px; padding-right: 10px;
...@@ -530,6 +525,13 @@ ...@@ -530,6 +525,13 @@
font-size: 9px; font-size: 9px;
line-height: 15px; line-height: 15px;
border-radius: 50%; border-radius: 50%;
}
.boards-switcher {
padding-right: 10px;
margin-right: 10px;
border-right: 1px solid $white-dark;
} }
.modal-filters { .modal-filters {
......
...@@ -4,5 +4,8 @@ ...@@ -4,5 +4,8 @@
Issues Issues
.form-group .form-group
= f.label :issues_template, class: 'label-light' do = f.label :issues_template, class: 'label-light' do
Description template Default description template for issues
= link_to icon('question-circle'), help_page_path('user/project/description_templates', anchor: 'setting-a-default-template-for-issues-and-merge-requests'), target: '_blank'
= f.text_area :issues_template, class: "form-control", rows: 3 = f.text_area :issues_template, class: "form-control", rows: 3
.hint
Description parsed with #{link_to "GitLab Flavored Markdown", help_page_path('user/markdown'), target: '_blank'}.
...@@ -13,10 +13,9 @@ ...@@ -13,10 +13,9 @@
= render "projects/issues/head" = render "projects/issues/head"
= render 'shared/issuable/filter', type: :boards = render 'shared/issuable/filter', type: :boards, board: board
#board-app.boards-app{ "v-cloak" => true, data: board_data } #board-app.boards-app{ "v-cloak" => true, data: board_data }
= render "title", board: board
.boards-list{ ":class" => "{ 'is-compact': detailIssueVisible }" } .boards-list{ ":class" => "{ 'is-compact': detailIssueVisible }" }
.boards-app-loading.text-center{ "v-if" => "loading" } .boards-app-loading.text-center{ "v-if" => "loading" }
= icon("spinner spin") = icon("spinner spin")
......
%boards-selector{ "inline-template" => true, %boards-selector{ "inline-template" => true,
":current-board" => board.to_json } ":current-board" => board.to_json }
.boards-title-holder.dropdown .dropdown
%button.boards-switcher{ "@click" => "loadBoards", %button.dropdown-menu-toggle{ "@click" => "loadBoards",
data: { toggle: "dropdown" } } data: { toggle: "dropdown" } }
{{ board.name }} {{ board.name }}
= icon("caret-down") = icon("chevron-down")
.dropdown-menu{ ":class" => "{ 'is-loading': loading }" } .dropdown-menu{ ":class" => "{ 'is-loading': loading }" }
.dropdown-title .dropdown-title
%button.dropdown-title-button.dropdown-menu-back{ type: "button", %button.dropdown-title-button.dropdown-menu-back{ type: "button",
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
method: :delete do method: :delete do
Delete Delete
%button.btn.btn-default.pull-right{ type: "button", %button.btn.btn-default.pull-right{ type: "button",
"@click.stop.prevent" => "currentPage = ''" } "@click.stop.prevent" => "showPage('')" }
Cancel Cancel
- if can?(current_user, :admin_board, @project) - if can?(current_user, :admin_board, @project)
.dropdown-footer{ "v-if" => "currentPage === ''" } .dropdown-footer{ "v-if" => "currentPage === ''" }
......
...@@ -11,5 +11,5 @@ ...@@ -11,5 +11,5 @@
"ref" => "'submit-btn'" } "ref" => "'submit-btn'" }
{{ buttonText }} {{ buttonText }}
%button.btn.btn-default.pull-right{ type: "button", %button.btn.btn-default.pull-right{ type: "button",
"@click.stop.prevent" => "currentPage = ''" } "@click.stop.prevent" => "cancel" }
Cancel Cancel
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
.col-md-9 .col-md-9
%label.label-light %label.label-light
= label_tag :project_visibility, 'Project Visibility', class: 'label-light' = label_tag :project_visibility, 'Project Visibility', class: 'label-light'
= link_to "(?)", help_page_path("public_access/public_access") = link_to icon('question-circle'), help_page_path("public_access/public_access")
%span.help-block %span.help-block
.col-md-3.visibility-select-container .col-md-3.visibility-select-container
= render('projects/visibility_select', model_method: :visibility_level, form: f, selected_level: @project.visibility_level) = render('projects/visibility_select', model_method: :visibility_level, form: f, selected_level: @project.visibility_level)
......
...@@ -37,8 +37,11 @@ ...@@ -37,8 +37,11 @@
.form-group .form-group
= form.label :merge_requests_template, class: 'label-light' do = form.label :merge_requests_template, class: 'label-light' do
Description template Default description template for merge requests
= link_to icon('question-circle'), help_page_path('user/project/description_templates', anchor: 'setting-a-default-template-for-issues-and-merge-requests'), target: '_blank'
= form.text_area :merge_requests_template, class: "form-control", rows: 3 = form.text_area :merge_requests_template, class: "form-control", rows: 3
.hint
Description parsed with #{link_to "GitLab Flavored Markdown", help_page_path('user/markdown'), target: '_blank'}.
.form-group .form-group
= form.label :approvals_before_merge, class: 'label-light' do = form.label :approvals_before_merge, class: 'label-light' do
......
- finder = controller.controller_name == 'issues' || controller.controller_name == 'boards' ? issues_finder : merge_requests_finder - finder = controller.controller_name == 'issues' || controller.controller_name == 'boards' ? issues_finder : merge_requests_finder
- boards_page = controller.controller_name == 'boards' - boards_page = controller.controller_name == 'boards'
- board = local_assigns.fetch(:board, nil)
.issues-filters .issues-filters
.issues-details-filters.row-content-block.second-block .issues-details-filters.row-content-block.second-block
- if boards_page && board
#js-multiple-boards-switcher.filter-item.inline.boards-switcher{ "v-cloak" => true }
= render "projects/boards/switcher", board: board
= form_tag page_filter_path(without: [:assignee_id, :author_id, :milestone_title, :label_name, :search]), method: :get, class: 'filter-form js-filter-form' do = form_tag page_filter_path(without: [:assignee_id, :author_id, :milestone_title, :label_name, :search]), method: :get, class: 'filter-form js-filter-form' do
- if params[:search].present? - if params[:search].present?
= hidden_field_tag :search, params[:search] = hidden_field_tag :search, params[:search]
......
---
title: Catch Net::LDAP::DN exceptions in EE::Gitlab::LDAP::Group
merge_request: 1260
author:
---
title: Repositioned multiple issue boards selector
merge_request:
author:
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
- [Account Security](user/profile/account/two_factor_authentication.md) Securing your account via two-factor authentication, etc. - [Account Security](user/profile/account/two_factor_authentication.md) Securing your account via two-factor authentication, etc.
- [API](api/README.md) Automate GitLab via a simple and powerful API. - [API](api/README.md) Automate GitLab via a simple and powerful API.
- [CI/CD](ci/README.md) GitLab Continuous Integration (CI) and Continuous Delivery (CD) getting started, `.gitlab-ci.yml` options, and examples. - [CI/CD](ci/README.md) GitLab Continuous Integration (CI) and Continuous Delivery (CD) getting started, `.gitlab-ci.yml` options, and examples.
- [Custom templates for issues and merge requests](customization/issue_and_merge_request_template.md) Pre-fill the description of issues and merge requests to your liking.
- [GitLab as OAuth2 authentication service provider](integration/oauth_provider.md). It allows you to login to other applications from GitLab. - [GitLab as OAuth2 authentication service provider](integration/oauth_provider.md). It allows you to login to other applications from GitLab.
- [Container Registry](user/project/container_registry.md) Learn how to use GitLab Container Registry. - [Container Registry](user/project/container_registry.md) Learn how to use GitLab Container Registry.
- [GitLab basics](gitlab-basics/README.md) Find step by step how to start working on your commandline and on GitLab. - [GitLab basics](gitlab-basics/README.md) Find step by step how to start working on your commandline and on GitLab.
......
# Custom templates for issues and merge requests This document was moved to [description_templates](../user/project/description_templates.md#setting-a-default-template-for-issues-and-merge-requests).
_**Note:** Templates for merge requests were [introduced][ee-7478ece] in GitLab
EE 6.9. Templates for issues were [introduced][ee-28] in GitLab EE 8.1._
---
We all know that a properly submitted issue is more likely to be addressed in
a timely manner by the developers of a project.
Templates help filter out a lot of unnecessary noise from issues, and with
GitLab you can do that pretty easily.
## Issues template
_**Note:** Make sure that the issues feature is enabled in your project's
**Settings** otherwise the template won't show. This is the default behavior so
in most cases you should be fine._
To enable the template feature for your issues, go to your project's
**Settings** and fill in the _Description template_ text area under the
**Issues** feature.
Since GitLab issues support [Markdown](../markdown/markdown.md), you can use
special markup like headings.
![Issue template in project settings](img/issue_and_merge_request_template_issue_settings.png)
---
After you add the description, hit **Save** for the settings to take effect.
Now, every time a new issue is created, it will be pre-filled with the text you
entered in the template.
![Issue template - new issue](img/issue_and_merge_request_template_new_issue.png)
---
## Merge requests template
_**Note:** Make sure that the merge requests feature is enabled in your project's
**Settings** otherwise the template won't show. This is the default behavior so
in most cases you should be fine._
As with [issues](#issues-template), you can create a template for your merge
requests as well. Remember that GitLab supports [Markdown](../markdown/markdown.md)
in merge requests.
![Issue template in project settings](img/issue_and_merge_request_template_mr_settings.png)
---
From now on, any new merge request will be pre-filled with the template text.
![Issue template - new MR](img/issue_and_merge_request_template_new_mr.png)
[ee-28]: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/28 "Merge Request for adding issues template"
[ee-7478ece]: https://gitlab.com/gitlab-org/gitlab-ee/commit/7478ece8b48e80782b5465b96c79f85cc91d391b "Commit that introduced merge requests templates"
...@@ -2,8 +2,12 @@ ...@@ -2,8 +2,12 @@
>[Introduced][ce-4981] in GitLab 8.11. >[Introduced][ce-4981] in GitLab 8.11.
We all know that a properly submitted issue is more likely to be addressed in
a timely manner by the developers of a project.
Description templates allow you to define context-specific templates for issue Description templates allow you to define context-specific templates for issue
and merge request description fields for your project. and merge request description fields for your project, as well as help filter
out a lot of unnecessary noise from issues.
## Overview ## Overview
...@@ -39,4 +43,34 @@ changes you made after picking the template and return it to its initial status. ...@@ -39,4 +43,34 @@ changes you made after picking the template and return it to its initial status.
![Description templates](img/description_templates.png) ![Description templates](img/description_templates.png)
## Setting a default template for issues and merge requests
>
**Notes:**
- This feature was introduced before [description templates](#overview) and is
available only for [GitLab Enterprise Starter][products]. It can be enabled
in the project's settings.
- Templates for issues were [introduced][ee-28] in GitLab EE 8.1.
- Templates for merge requests were [introduced][ee-7478ece] in GitLab EE 6.9.
The visibility of issues and/or merge requests should be set to either "Everyone
with access" or "Only team members" in your project's **Settings** otherwise the
template text areas won't show. This is the default behavior so in most cases
you should be fine.
Go to your project's **Settings** and fill in the "Default description template
for issues" and "Default description template for merge requests" text areas
for issues and merge requests respectively. Since GitLab issues and merge
request support [Markdown](../markdown.md), you can use special markup like
headings, lists, etc.
![Default description templates](img/description_templates_default_settings.png)
After you add the description, hit **Save changes** for the settings to take
effect. Now, every time a new issue or merge request is created, it will be
pre-filled with the text you entered in the template(s).
[ce-4981]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4981 [ce-4981]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4981
[ee-28]: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/28 "Merge Request for adding issues template"
[ee-7478ece]: https://gitlab.com/gitlab-org/gitlab-ee/commit/7478ece8b48e80782b5465b96c79f85cc91d391b "Commit that introduced merge requests templates"
[products]: https://about.gitlab.com/products/
...@@ -90,13 +90,13 @@ module EE ...@@ -90,13 +90,13 @@ module EE
members.concat(ranged_members(entry)) if has_member_range?(entry) members.concat(ranged_members(entry)) if has_member_range?(entry)
# Process nested group members # Process nested group members
members.concat(nested_members(nested_groups_to_skip)) members.concat(nested_members(nested_groups_to_skip))
# Clean dns of groups and users outside the base # Clean dns of groups and users outside the base
members.reject! { |dn| nested_groups_to_skip.include?(dn) } members.reject! { |dn| nested_groups_to_skip.include?(dn) }
base = Net::LDAP::DN.new(adapter.config.base.downcase).to_a
members.select! { |dn| Net::LDAP::DN.new(dn.downcase).to_a.last(base.length) == base }
members return [] if members.empty?
# Only return members within our given base
members_within_base(members)
end end
# AD requires use of range retrieval for groups with more than 1500 members # AD requires use of range retrieval for groups with more than 1500 members
...@@ -146,6 +146,37 @@ module EE ...@@ -146,6 +146,37 @@ module EE
match[1].to_i + 1 if match.present? && match[1] != '*' match[1].to_i + 1 if match.present? && match[1] != '*'
end end
# The old AD recursive member filter would exclude any members that
# were outside the given search base. To maintain that behavior,
# we need to do the same.
#
# Split the base and each member DN into pairs. Compare the last
# base N pairs of the member DN. If they match, the user is within
# the base DN.
#
# Ex.
# - Member DN: 'uid=user,ou=users,dc=example,dc=com'
# - Base DN: 'dc=example,dc=com'
#
# Base has 2 pairs ([dc,example], [dc,com]). If the last 2 pairs of
# the user DN match, profit!
def members_within_base(members)
begin
base = Net::LDAP::DN.new(adapter.config.base.downcase).to_a
rescue RuntimeError
Rails.logger.error "Configured LDAP `base` is invalid: '#{adapter.config.base}'"
return []
end
members.select do |dn|
begin
Net::LDAP::DN.new(dn.downcase).to_a.last(base.length) == base
rescue RuntimeError
Rails.logger.warn "Received invalid member DN from LDAP group '#{cn}': '#{dn}'. Skipping"
end
end
end
end end
end end
end end
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
"d3": "^3.5.11", "d3": "^3.5.11",
"dropzone": "^4.2.0", "dropzone": "^4.2.0",
"es6-promise": "^4.0.5", "es6-promise": "^4.0.5",
"jquery": "^2.2.1", "jquery": "2.2.1",
"jquery-ui": "git+https://github.com/jquery/jquery-ui#1.11.4", "jquery-ui": "git+https://github.com/jquery/jquery-ui#1.11.4",
"jquery-ujs": "^1.2.1", "jquery-ujs": "^1.2.1",
"js-cookie": "^2.1.3", "js-cookie": "^2.1.3",
......
...@@ -29,7 +29,7 @@ describe 'Multiple Issue Boards', feature: true, js: true do ...@@ -29,7 +29,7 @@ describe 'Multiple Issue Boards', feature: true, js: true do
it 'shows a list of boards' do it 'shows a list of boards' do
click_button board.name click_button board.name
page.within('.boards-title-holder .dropdown-menu') do page.within('.dropdown-menu') do
expect(page).to have_content(board.name) expect(page).to have_content(board.name)
expect(page).to have_content(board2.name) expect(page).to have_content(board2.name)
end end
...@@ -38,7 +38,7 @@ describe 'Multiple Issue Boards', feature: true, js: true do ...@@ -38,7 +38,7 @@ describe 'Multiple Issue Boards', feature: true, js: true do
it 'switches current board' do it 'switches current board' do
click_button board.name click_button board.name
page.within('.boards-title-holder .dropdown-menu') do page.within('.dropdown-menu') do
click_link board2.name click_link board2.name
end end
...@@ -52,7 +52,7 @@ describe 'Multiple Issue Boards', feature: true, js: true do ...@@ -52,7 +52,7 @@ describe 'Multiple Issue Boards', feature: true, js: true do
it 'creates new board' do it 'creates new board' do
click_button board.name click_button board.name
page.within('.boards-title-holder .dropdown-menu') do page.within('.dropdown-menu') do
click_link 'Edit board name' click_link 'Edit board name'
fill_in 'board-new-name', with: 'Testing' fill_in 'board-new-name', with: 'Testing'
...@@ -62,7 +62,7 @@ describe 'Multiple Issue Boards', feature: true, js: true do ...@@ -62,7 +62,7 @@ describe 'Multiple Issue Boards', feature: true, js: true do
wait_for_vue_resource wait_for_vue_resource
page.within('.boards-title-holder .dropdown-menu') do page.within('.dropdown-menu') do
expect(page).to have_content('Testing') expect(page).to have_content('Testing')
end end
end end
...@@ -70,7 +70,7 @@ describe 'Multiple Issue Boards', feature: true, js: true do ...@@ -70,7 +70,7 @@ describe 'Multiple Issue Boards', feature: true, js: true do
it 'edits board name' do it 'edits board name' do
click_button board.name click_button board.name
page.within('.boards-title-holder .dropdown-menu') do page.within('.dropdown-menu') do
click_link 'Edit board name' click_link 'Edit board name'
fill_in 'board-new-name', with: 'Testing' fill_in 'board-new-name', with: 'Testing'
...@@ -80,7 +80,7 @@ describe 'Multiple Issue Boards', feature: true, js: true do ...@@ -80,7 +80,7 @@ describe 'Multiple Issue Boards', feature: true, js: true do
wait_for_vue_resource wait_for_vue_resource
page.within('.boards-title-holder .dropdown-menu') do page.within('.dropdown-menu') do
expect(page).to have_content('Testing') expect(page).to have_content('Testing')
end end
end end
...@@ -90,7 +90,7 @@ describe 'Multiple Issue Boards', feature: true, js: true do ...@@ -90,7 +90,7 @@ describe 'Multiple Issue Boards', feature: true, js: true do
wait_for_vue_resource wait_for_vue_resource
page.within('.boards-title-holder .dropdown-menu') do page.within('.dropdown-menu') do
click_link 'Delete board' click_link 'Delete board'
page.within('.dropdown-title') do page.within('.dropdown-title') do
...@@ -102,7 +102,7 @@ describe 'Multiple Issue Boards', feature: true, js: true do ...@@ -102,7 +102,7 @@ describe 'Multiple Issue Boards', feature: true, js: true do
click_button board2.name click_button board2.name
page.within('.boards-title-holder .dropdown-menu') do page.within('.dropdown-menu') do
expect(page).not_to have_content(board.name) expect(page).not_to have_content(board.name)
expect(page).to have_content(board2.name) expect(page).to have_content(board2.name)
end end
...@@ -111,7 +111,7 @@ describe 'Multiple Issue Boards', feature: true, js: true do ...@@ -111,7 +111,7 @@ describe 'Multiple Issue Boards', feature: true, js: true do
it 'adds a list to the none default board' do it 'adds a list to the none default board' do
click_button board.name click_button board.name
page.within('.boards-title-holder .dropdown-menu') do page.within('.dropdown-menu') do
click_link board2.name click_link board2.name
end end
...@@ -135,7 +135,7 @@ describe 'Multiple Issue Boards', feature: true, js: true do ...@@ -135,7 +135,7 @@ describe 'Multiple Issue Boards', feature: true, js: true do
click_button board2.name click_button board2.name
page.within('.boards-title-holder .dropdown-menu') do page.within('.dropdown-menu') do
click_link board.name click_link board.name
end end
...@@ -154,7 +154,7 @@ describe 'Multiple Issue Boards', feature: true, js: true do ...@@ -154,7 +154,7 @@ describe 'Multiple Issue Boards', feature: true, js: true do
it 'does not show action links' do it 'does not show action links' do
click_button board.name click_button board.name
page.within('.boards-title-holder .dropdown-menu') do page.within('.dropdown-menu') do
expect(page).not_to have_content('Create new board') expect(page).not_to have_content('Create new board')
expect(page).not_to have_content('Edit board name') expect(page).not_to have_content('Edit board name')
expect(page).not_to have_content('Delete board') expect(page).not_to have_content('Delete board')
......
...@@ -122,6 +122,45 @@ describe EE::Gitlab::LDAP::Group, lib: true do ...@@ -122,6 +122,45 @@ describe EE::Gitlab::LDAP::Group, lib: true do
expect(group.member_dns).not_to include('uid=foo,ou=users,dc=other,dc=com') expect(group.member_dns).not_to include('uid=foo,ou=users,dc=other,dc=com')
expect(group.member_dns).to include('uid=bar,ou=users,dc=example , dc=com') expect(group.member_dns).to include('uid=bar,ou=users,dc=example , dc=com')
end end
it 'logs an error when the LDAP base is invalid' do
stub_ldap_config(
active_directory: true,
base: 'invalid,dc=example,dc=com'
)
nested_groups = [group2_entry]
stub_ldap_adapter_nested_groups(group.dn, nested_groups, adapter)
stub_ldap_adapter_nested_groups(group2_entry.dn, [], adapter)
expect(Rails.logger)
.to receive(:error).with("Configured LDAP `base` is invalid: 'invalid,dc=example,dc=com'")
# Users in the top-level group always get added - they're not filtered
# through the nested groups shenanigans.
expect(group.member_dns).to match_array(
%w(
uid=user1,ou=users,dc=example,dc=com
uid=user2,ou=users,dc=example,dc=com
)
)
end
it 'logs a warning when an invalid member DN is found in an LDAP group' do
group3_entry = ldap_group_entry(
['invalid,ou=user,ou=groups,dc=example,dc=com'],
cn: 'ldap_group3',
objectclass: 'group',
member_attr: 'member',
member_of: group1_entry.dn
)
nested_groups = [group2_entry, group3_entry]
stub_ldap_adapter_nested_groups(group.dn, nested_groups, adapter)
stub_ldap_adapter_nested_groups(group2_entry.dn, [], adapter)
stub_ldap_adapter_nested_groups(group3_entry.dn, [], adapter)
expect(Rails.logger)
.to receive(:warn).with(/Received invalid member/)
expect(group.member_dns).not_to include('invalid,ou=user,ou=groups,dc=example,dc=com')
end
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment