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

Add spec to use that flag

Oliver Günther70d10af6a7ab
diff --git a/spec/models/ldap_auth_source_spec.rb b/spec/models/ldap_auth_source_spec.rb
index 4d755bc2b15..ece8fd25c85 100644
--- a/spec/models/ldap_auth_source_spec.rb
+++ b/spec/models/ldap_auth_source_spec.rb
@@ -159,10 +159,32 @@ describe LdapAuthSource, type: :model do
attr_login: 'uid',
attr_firstname: 'givenName',
attr_lastname: 'sn',
- attr_mail: 'mail'
+ attr_mail: 'mail',
+ attr_admin:
end
let(:filter_string) { nil }
+ let(:attr_admin) { nil }
+
+ describe 'attr_admin' do
+ context 'when set' do
+ let(:attr_admin) { 'isAdmin' }
+
+ it 'maps for the admin user in ldap', :aggregate_failures do
+ admin_attributes = ldap.find_user('ldap_admin')
+ expect(admin_attributes).to be_kind_of Hash
+ expect(admin_attributes[:firstname]).to eq 'LDAP'
+ expect(admin_attributes[:lastname]).to eq 'Adminuser'
+ expect(admin_attributes[:admin]).to eq true
+
+ admin_attributes = ldap.find_user('bb459')
+ expect(admin_attributes).to be_kind_of Hash
+ expect(admin_attributes[:firstname]).to eq 'Belle'
+ expect(admin_attributes[:lastname]).to eq 'Baldwin'
+ expect(admin_attributes[:admin]).to eq false
+ end
+ end
+ end
describe '#authenticate' do
context 'with a valid LDAP user' do