From ff5e19e8d087b399594d8abf0187f28fa3390d4d Mon Sep 17 00:00:00 2001 From: bearns Date: Fri, 16 Oct 2020 17:43:00 +0300 Subject: [PATCH] Fixes in plugin --- ldap.env | 2 +- redmine/999_config_ldap.rb | 9 +++++---- .../app/models/auth_source_ldap_passwd.rb | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ldap.env b/ldap.env index b9bb482..2d60f8e 100644 --- a/ldap.env +++ b/ldap.env @@ -1,2 +1,2 @@ #LDAP_BASE_DN="o=example,c=org" -LDAP_ADMIN_PASSWORD="admin" \ No newline at end of file +LDAP_ADMIN_PASSWORD=admin \ No newline at end of file diff --git a/redmine/999_config_ldap.rb b/redmine/999_config_ldap.rb index 76df78c..f9d2961 100644 --- a/redmine/999_config_ldap.rb +++ b/redmine/999_config_ldap.rb @@ -6,7 +6,7 @@ class Setup < ActiveRecord::Migration[4.2] # or auth_source_ldap.rb # in path /usr/src/redmine/app/models - class AuthSource < ActiveRecord::Base + class AuthSourceLdap < ActiveRecord::Base end def self.up @@ -44,19 +44,20 @@ class Setup < ActiveRecord::Migration[4.2] # 'timeout') # create default administrator account - auth = AuthSource.new + auth = AuthSourceLdap.create + auth.type = "AuthSourceLdap" auth.name = "ldap" auth.host = ENV["REDMINE_LDAP"] auth.port = 389 - auth.account = "admin" + auth.account = "cn=admin,dc=example,dc=org" auth.account_password = ENV["LDAP_ADMIN_PASSWORD"] auth.base_dn = ENV["LDAP_BASE_DN"] auth.attr_login = "uid" auth.attr_firstname = "givenName" auth.attr_lastname = "sn" auth.attr_mail = "mail" - auth.onthefly_register = true + auth.onthefly_register = 1 auth.save diff --git a/redmine/redmine_ldap_passwd/app/models/auth_source_ldap_passwd.rb b/redmine/redmine_ldap_passwd/app/models/auth_source_ldap_passwd.rb index 55a55c5..50b03a8 100644 --- a/redmine/redmine_ldap_passwd/app/models/auth_source_ldap_passwd.rb +++ b/redmine/redmine_ldap_passwd/app/models/auth_source_ldap_passwd.rb @@ -40,7 +40,7 @@ class AuthSourceLdapPasswd < AuthSourceLdap def self.change_password_allowed?(user) return false if user.nil? - AuthSourceLdapPasswd.name.eql?(user.auth_source.type) + AuthSourceLdapPasswd.name.eql?( user.auth_source .nil? ? "" : user.auth_source.type) end def self.is_password_valid(password)