# Add default ldap auth source class Setup < ActiveRecord::Migration[4.2] # look at auth_source.rb # or auth_source_ldap.rb # in path /usr/src/redmine/app/models class AuthSource < ActiveRecord::Base end def self.up # create_table "auth_sources", :force => true do |t| # t.column "type", :string, :limit => 30, :default => "", :null => false # t.column "name", :string, :limit => 60, :default => "", :null => false # t.column "host", :string, :limit => 60 # t.column "port", :integer # t.column "account", :string, :limit => 60 # t.column "account_password", :string, :limit => 60 # t.column "base_dn", :string, :limit => 255 # t.column "attr_login", :string, :limit => 30 # t.column "attr_firstname", :string, :limit => 30 # t.column "attr_lastname", :string, :limit => 30 # t.column "attr_mail", :string, :limit => 30 # t.column "onthefly_register", :boolean, :default => false, :null => false # end # safe_attributes( # 'name', # 'host', # 'port', # 'account', # 'account_password', # 'base_dn', # 'attr_login', # 'attr_firstname', # 'attr_lastname', # 'attr_mail', # 'onthefly_register', # 'tls', # 'verify_peer', # 'filter', # 'timeout') # create default administrator account auth = AuthSource.new auth.name = "ldap" auth.host = ENV["REDMINE_LDAP"] auth.port = 389 auth.account = "admin" 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.save end end