commit
ef78e8bf50
@ -0,0 +1,86 @@ |
||||
#-- copyright |
||||
# OpenProject is a project management system. |
||||
# Copyright (C) 2012-2014 the OpenProject Foundation (OPF) |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License version 3. |
||||
# |
||||
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: |
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang |
||||
# Copyright (C) 2010-2013 the ChiliProject Team |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License |
||||
# as published by the Free Software Foundation; either version 2 |
||||
# of the License, or (at your option) any later version. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
# |
||||
# See doc/COPYRIGHT.rdoc for more details. |
||||
#++ |
||||
|
||||
require 'spec_helper' |
||||
require 'features/projects/projects_page' |
||||
|
||||
describe 'edit users', js: true do |
||||
let(:current_user) { FactoryGirl.create :admin } |
||||
let(:user) { FactoryGirl.create :user } |
||||
|
||||
let!(:auth_source) { FactoryGirl.create :auth_source } |
||||
|
||||
before do |
||||
allow(User).to receive(:current).and_return current_user |
||||
end |
||||
|
||||
def auth_select |
||||
find :css, 'select#user_auth_source_id' |
||||
end |
||||
|
||||
def user_password |
||||
find :css, 'input#user_password' |
||||
end |
||||
|
||||
context 'with internal authentication' do |
||||
before do |
||||
visit edit_user_path(user) |
||||
end |
||||
|
||||
it 'shows internal authentication being selected including password settings' do |
||||
expect(auth_select.value).to eq '' # selected internal |
||||
expect(user_password).to be_visible |
||||
end |
||||
|
||||
it 'hides password settings when switching to an LDAP auth source' do |
||||
auth_select.select auth_source.name |
||||
|
||||
expect(page).not_to have_selector('input#user_password') |
||||
end |
||||
end |
||||
|
||||
context 'with external authentication' do |
||||
before do |
||||
user.auth_source = auth_source |
||||
user.save! |
||||
|
||||
visit edit_user_path(user) |
||||
end |
||||
|
||||
it 'shows external authentication being selected and no password settings' do |
||||
expect(auth_select.value).to eq auth_source.id.to_s |
||||
expect(page).not_to have_selector('input#user_password') |
||||
end |
||||
|
||||
it 'shows password settings when switching back to internal authentication' do |
||||
auth_select.select I18n.t('label_internal') |
||||
|
||||
expect(user_password).to be_visible |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,71 @@ |
||||
#-- copyright |
||||
# OpenProject is a project management system. |
||||
# Copyright (C) 2012-2014 the OpenProject Foundation (OPF) |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License version 3. |
||||
# |
||||
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: |
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang |
||||
# Copyright (C) 2010-2013 the ChiliProject Team |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License |
||||
# as published by the Free Software Foundation; either version 2 |
||||
# of the License, or (at your option) any later version. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
# |
||||
# See doc/COPYRIGHT.rdoc for more details. |
||||
#++ |
||||
|
||||
require 'spec_helper' |
||||
|
||||
describe 'layouts/admin' do |
||||
include Redmine::MenuManager::MenuHelper |
||||
helper Redmine::MenuManager::MenuHelper |
||||
|
||||
let(:admin) { FactoryGirl.create :admin } |
||||
|
||||
before do |
||||
view.stub(:current_menu_item).and_return('overview') |
||||
view.stub(:default_breadcrumb) |
||||
controller.stub(:default_search_scope) |
||||
|
||||
User.stub(:current).and_return admin |
||||
view.stub(:current_user).and_return admin |
||||
end |
||||
|
||||
# All password-based authentication is to be hidden and disabled if |
||||
# `disable_password_login` is true. This includes LDAP. |
||||
describe 'LDAP authentication menu entry' do |
||||
context 'with password login enabled' do |
||||
before do |
||||
OpenProject::Configuration.stub(:disable_password_login?).and_return(false) |
||||
render |
||||
end |
||||
|
||||
it 'is shown' do |
||||
expect(rendered).to have_selector('a', text: I18n.t('label_ldap_authentication')) |
||||
end |
||||
end |
||||
|
||||
context 'with password login disabled' do |
||||
before do |
||||
OpenProject::Configuration.stub(:disable_password_login?).and_return(true) |
||||
render |
||||
end |
||||
|
||||
it 'is hidden' do |
||||
expect(rendered).not_to have_selector('a', text: I18n.t('label_ldap_authentication')) |
||||
end |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,61 @@ |
||||
#-- copyright |
||||
# OpenProject is a project management system. |
||||
# Copyright (C) 2012-2014 the OpenProject Foundation (OPF) |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License version 3. |
||||
# |
||||
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: |
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang |
||||
# Copyright (C) 2010-2013 the ChiliProject Team |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License |
||||
# as published by the Free Software Foundation; either version 2 |
||||
# of the License, or (at your option) any later version. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
# |
||||
# See doc/COPYRIGHT.rdoc for more details. |
||||
#++ |
||||
|
||||
require 'spec_helper' |
||||
|
||||
describe 'settings/_authentication' do |
||||
context 'with password login enabled' do |
||||
before do |
||||
OpenProject::Configuration.stub(:disable_password_login?).and_return(false) |
||||
render |
||||
end |
||||
|
||||
it 'shows password settings' do |
||||
expect(rendered).to have_text I18n.t('label_password_lost') |
||||
end |
||||
|
||||
it 'shows automated user blocking options' do |
||||
expect(rendered).to have_text I18n.t(:brute_force_prevention, :scope => [:settings]) |
||||
end |
||||
end |
||||
|
||||
context 'with password login disabled' do |
||||
before do |
||||
OpenProject::Configuration.stub(:disable_password_login?).and_return(true) |
||||
render |
||||
end |
||||
|
||||
it 'does not show password settings' do |
||||
expect(rendered).not_to have_text I18n.t('label_password_lost') |
||||
end |
||||
|
||||
it 'does not show automated user blocking options' do |
||||
expect(rendered).not_to have_text I18n.t(:brute_force_prevention, :scope => [:settings]) |
||||
end |
||||
end |
||||
end |
Loading…
Reference in new issue