Skip to content
Browse files

moved the username builder into an --advanced switch, since most peop…

…le won't need it by default
  • Loading branch information...
1 parent ff3d9b6 commit af6e5eb745217c990b4cda4070e6e9cafcb3199c @dpmcnevin dpmcnevin committed Aug 14, 2010
View
21 README.md
@@ -32,7 +32,7 @@ This will *only* work for Rails 3 applications.
In the Gemfile for your application:
gem "devise", "1.1.1"
- gem "devise_ldap_authenticatable", "0.4.3"
+ gem "devise_ldap_authenticatable", "0.4.4"
To get the latest version, pull directly from github instead of the gem:
@@ -44,17 +44,18 @@ Setup
Run the rails generator
- rails generate devise_ldap_authenticatable:install
+ rails generate devise_ldap_authenticatable:install [options]
This will install the sample.yml, update the devise.rb initializer, and update your user model. There are some options you can pass to it:
- [--user-model=USER_MODEL] # Model to update
- # Default: user
- [--update-model] # Update model to change from database_authenticatable to ldap_authenticatable
- # Default: true
- [--add-rescue] # Update Application Controller with resuce_from for DeviseLdapAuthenticatable::LdapException
- # Default: true
-
+Options:
+ [--user-model=USER_MODEL] # Model to update
+ # Default: user
+ [--update-model] # Update model to change from database_authenticatable to ldap_authenticatable
+ # Default: true
+ [--add-rescue] # Update Application Controller with resuce_from for DeviseLdapAuthenticatable::LdapException
+ # Default: true
+ [--advanced] # Add advanced config options to the devise initializer
Usage
@@ -100,6 +101,8 @@ In initializer `config/initializers/devise.rb` :
Advanced Configuration
----------------------
+These parameters will be added to `config/initializers/devise.rb` when you pass the `--advanced` switch to the generator:
+
* ldap\_auth\_username\_builder _(default: `Proc.new() {|attribute, login, ldap| "#{attribute}=#{login},#{ldap.base}" }`)_
* You can pass a proc to the username option to explicitly specify the format that you search for a users' DN on your LDAP server.
View
2 VERSION
@@ -1 +1 @@
-0.4.3
+0.4.4
View
2 lib/devise_ldap_authenticatable/version.rb
@@ -1,4 +1,4 @@
module DeviseLdapAuthenticatable
- VERSION = "0.4.3"
+ VERSION = "0.4.4"
end
View
11 lib/generators/devise_ldap_authenticatable/install_generator.rb
@@ -5,6 +5,7 @@ class InstallGenerator < Rails::Generators::Base
class_option :user_model, :type => :string, :default => "user", :desc => "Model to update"
class_option :update_model, :type => :boolean, :default => true, :desc => "Update model to change from database_authenticatable to ldap_authenticatable"
class_option :add_rescue, :type => :boolean, :default => true, :desc => "Update Application Controller with resuce_from for DeviseLdapAuthenticatable::LdapException"
+ class_option :advanced, :type => :boolean, :desc => "Add advanced config options to the devise initializer"
def create_ldap_config
@@ -26,7 +27,7 @@ def update_application_controller
private
def default_devise_settings
- <<-eof
+ settings = <<-eof
# ==> LDAP Configuration
# config.ldap_logger = true
# config.ldap_create_user = false
@@ -36,10 +37,16 @@ def default_devise_settings
# config.ldap_check_attributes = false
# config.ldap_use_admin_to_bind = false
+ eof
+ if options.advanced?
+ settings << <<-eof
# ==> Advanced LDAP Configuration
# config.ldap_auth_username_builder = Proc.new() {|attribute, login, ldap| "\#{attribute}=\#{login},\#{ldap.base}" }
- eof
+ eof
+ end
+
+ settings
end
def rescue_from_exception

0 comments on commit af6e5eb

Please sign in to comment.
Something went wrong with that request. Please try again.