Rail w/ ActiveLdap

Hello,

I am working on creating a simple interface for an ldap user repository.

A little background, for development, I am working under Cygwin, with an
ssh port forward on port 636 (for SSL).

I have included clips of my error message and all
config/environment/model files below. I replaced domain information,
which I have double checked with “”.

Please let me know if you need any addition information.

Thanks!
–J

[ERROR]
$ ruby script/generate scaffold LdapAdmin
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:123:in
const_missing': uninitialized constant Base (NameError) from /usr/local/lib/ruby/gems/1.8/gems/ruby-activeldap-0.7.4/lib/activeldap/configuration.rb:43 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:inrequire’
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
require' from /usr/local/lib/ruby/gems/1.8/gems/ruby-activeldap-0.7.4/lib/activeldap.rb:931 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:inrequire’
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
require' from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:182:inactivate’
from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:181:in
activate' from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:26:inrequire’
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
require' from ./script/../config/../config/environment.rb:55 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:inrequire’
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
require' from /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/generate.rb:1 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:inrequire’
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
`require’
from script/generate:3
[/ERROR]

… and …

[ERROR]
$ ruby script/server
=> Booting WEBrick…
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:123:in
const_missing': uninitialized constant Base (NameError) from /usr/local/lib/ruby/gems/1.8/gems/ruby-activeldap-0.7.4/lib/activeldap/configuration.rb:43 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:inrequire’
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
require' from /usr/local/lib/ruby/gems/1.8/gems/ruby-activeldap-0.7.4/lib/activeldap.rb:931 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:inrequire’
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
require' from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:182:inactivate’
from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:181:in
activate' ... 8 levels... from /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/server.rb:30 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:inrequire’
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
`require’
from script/server:3

[/ERROR]

My setup’s are:

[configuration.rb]
$ cat
/usr/local/lib/ruby/gems/1.8/gems/ruby-activeldap-0.7.4/lib/activeldap/configuration.rb
| grep -v “#”

module ActiveLDAP
module Configuration
DEFAULT_CONFIG = {}
DEFAULT_CONFIG[:host] = ‘127.0.0.1’
DEFAULT_CONFIG[:port] = 636
DEFAULT_CONFIG[:method] = :ssl

DEFAULT_CONFIG[:bind_format] = 

“cn=%s,dc=,dc=,dc=net”
DEFAULT_CONFIG[:user] = ENV[‘USER’]
DEFAULT_CONFIG[:password_block] = nil
DEFAULT_CONFIG[:password] = “letmein”
DEFAULT_CONFIG[:store_password] = true
DEFAULT_CONFIG[:allow_anonymous] = false
DEFAULT_CONFIG[:sasl_quiet] = false
DEFAULT_CONFIG[:try_sasl] = false

DEFAULT_CONFIG[:retries] = 3
DEFAULT_CONFIG[:retry_wait] = 3
DEFAULT_CONFIG[:timeout] = 0
DEFAULT_CONFIG[:retry_on_timeout] = true

DEFAULT_CONFIG[:return_objects] = false

DEFAULT_CONFIG[:logger] = nil

but

live
def Base.ldap_scope
LDAP::LDAP_SCOPE_ONELEVEL
end

def Base.base
  'dc=<CORRECT>,dc=<CORRECT>,dc=net'
end

def Base.required_classes
  ['top']
end

end
end
[/configuration.rb]

[environment.rb]
$ cat config/environment.rb | grep -v “#”

RAILS_GEM_VERSION = ‘1.1.2’
require File.join(File.dirname(FILE), ‘boot’)

Rails::Initializer.run do |config|
config.frameworks -= [ :active_record ]
end

require ‘activeldap’
ActiveLDAP::Base.connect(
:host => ‘localhost’,
:base => ‘dc=porteng,dc=earthlink,dc=net’,
:bind_format => ‘cn=root,dc=porteng,dc=earthlink,dc=net’,
:password_block => Proc.new { ‘letmein’ },
:allow_anonymous => false
)
[/environment.rb]

[user.rb]
$ cat app/models/user.rb
class User < ActiveLDAP::Base
ldap_mapping :dnattr => ‘uid’,
:prefix => ‘ou=People’,
:classes => [ ‘account’, ‘posixAccount’, ‘shadowAccount’,
‘top’ ]
end
[/user.rb]

[directoy.rb]
$ cat app/models/directory.rb
class Directory < ActiveLDAP::Base
ldap_mapping :dnattr => ‘cn’,
:prefix => ‘ou=Group’,
:classes => [‘top’, ‘posixGroup’]
end
[/directoy.rb]

Sorry for the double post.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs