activeldap 1.0.2 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +32 -0
- data/README +8 -1
- data/data/locale/en/LC_MESSAGES/active-ldap.mo +0 -0
- data/data/locale/ja/LC_MESSAGES/active-ldap.mo +0 -0
- data/examples/al-admin/app/controllers/{application.rb → application_controller.rb} +3 -1
- data/examples/al-admin/app/views/account/sign_up.html.erb +6 -5
- data/examples/al-admin/config/boot.rb +1 -0
- data/examples/al-admin/config/environment.rb +4 -2
- data/examples/al-admin/config.ru +7 -0
- data/examples/al-admin/lib/ldap_test_helper.rb +38 -0
- data/examples/al-admin/lib/tasks/gettext.rake +3 -2
- data/examples/al-admin/lib/tasks/testing.rake +10 -0
- data/examples/al-admin/po/en/al-admin.po +4 -4
- data/examples/al-admin/po/ja/al-admin.po +4 -4
- data/examples/al-admin/po/nl/al-admin.po +3 -3
- data/examples/al-admin/public/dispatch.cgi +2 -2
- data/examples/al-admin/public/dispatch.fcgi +1 -1
- data/examples/al-admin/public/dispatch.rb +2 -2
- data/examples/al-admin/test/functional/account_controller_test.rb +2 -14
- data/examples/al-admin/test/functional/attributes_controller_test.rb +2 -12
- data/examples/al-admin/test/functional/directory_controller_test.rb +2 -12
- data/examples/al-admin/test/functional/object_classes_controller_test.rb +2 -12
- data/examples/al-admin/test/functional/syntaxes_controller_test.rb +2 -12
- data/examples/al-admin/test/functional/users_controller_test.rb +2 -12
- data/examples/al-admin/test/functional/welcome_controller_test.rb +2 -12
- data/examples/al-admin/test/integration/sign_up_test.rb +44 -0
- data/examples/al-admin/test/run-test.sh +1 -1
- data/examples/al-admin/test/test_helper.rb +25 -1
- data/examples/al-admin/test/unit/user_test.rb +1 -2
- data/examples/groupadd +2 -2
- data/examples/groupdel +2 -2
- data/examples/groupls +2 -2
- data/examples/groupmod +2 -2
- data/examples/lpasswd +2 -2
- data/examples/objects/group.rb +2 -2
- data/examples/objects/user.rb +1 -1
- data/examples/ouadd +2 -2
- data/examples/useradd +2 -2
- data/examples/useradd-binary +6 -3
- data/examples/userdel +2 -2
- data/examples/userls +2 -2
- data/examples/usermod +2 -2
- data/examples/usermod-binary-add +6 -3
- data/examples/usermod-binary-add-time +6 -3
- data/examples/usermod-binary-del +2 -2
- data/examples/usermod-lang-add +2 -2
- data/lib/active_ldap/adapter/base.rb +47 -23
- data/lib/active_ldap/adapter/jndi.rb +30 -28
- data/lib/active_ldap/adapter/jndi_connection.rb +6 -0
- data/lib/active_ldap/adapter/ldap.rb +25 -26
- data/lib/active_ldap/adapter/net_ldap.rb +28 -33
- data/lib/active_ldap/adapter/net_ldap_ext.rb +0 -6
- data/lib/active_ldap/association/proxy.rb +2 -1
- data/lib/active_ldap/attributes.rb +31 -0
- data/lib/active_ldap/base.rb +75 -31
- data/lib/active_ldap/compatible.rb +44 -0
- data/lib/active_ldap/configuration.rb +3 -3
- data/lib/active_ldap/connection.rb +41 -12
- data/lib/active_ldap/distinguished_name.rb +1 -0
- data/lib/active_ldap/get_text.rb +0 -7
- data/lib/active_ldap/ldif.rb +59 -44
- data/lib/active_ldap/operations.rb +41 -10
- data/lib/active_ldap/schema.rb +41 -6
- data/lib/active_ldap/user_password.rb +7 -7
- data/lib/active_ldap/validations.rb +24 -12
- data/lib/active_ldap/xml.rb +2 -2
- data/lib/active_ldap.rb +120 -139
- data/po/en/active-ldap.po +5 -5
- data/po/ja/active-ldap.po +5 -5
- data/rails/README +2 -2
- data/rails/init.rb +2 -2
- data/test/al-test-utils.rb +11 -4
- data/test/run-test.rb +6 -2
- data/test/test_associations.rb +4 -4
- data/test/test_attributes.rb +3 -1
- data/test/test_base.rb +75 -15
- data/test/test_base_per_instance.rb +7 -1
- data/test/test_bind.rb +4 -4
- data/test/test_connection.rb +36 -14
- data/test/test_connection_per_class.rb +5 -5
- data/test/test_connection_per_dn.rb +11 -5
- data/test/test_groupadd.rb +2 -2
- data/test/test_groupdel.rb +2 -2
- data/test/test_groupls.rb +1 -1
- data/test/test_groupmod.rb +2 -2
- data/test/test_ldif.rb +11 -1
- data/test/test_schema.rb +38 -2
- data/test/test_syntax.rb +12 -2
- data/test/test_useradd-binary.rb +1 -0
- data/test/test_usermod-binary-add-time.rb +1 -0
- data/test/test_usermod-binary-add.rb +1 -0
- data/test/test_validation.rb +24 -13
- data/test-unit/lib/test/unit/assertions.rb +97 -14
- data/test-unit/lib/test/unit/autorunner.rb +20 -4
- data/test-unit/lib/test/unit/priority.rb +21 -1
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +7 -4
- data/test-unit/test/test_assertions.rb +52 -5
- metadata +10 -14
- data/rails/plugin/active_ldap/README +0 -54
- data/rails/plugin/active_ldap/generators/README +0 -2
- data/rails/plugin/active_ldap/generators/model_active_ldap/USAGE +0 -17
- data/rails/plugin/active_ldap/generators/model_active_ldap/model_active_ldap_generator.rb +0 -70
- data/rails/plugin/active_ldap/generators/model_active_ldap/templates/fixtures.yml +0 -11
- data/rails/plugin/active_ldap/generators/model_active_ldap/templates/model_active_ldap.rb +0 -3
- data/rails/plugin/active_ldap/generators/model_active_ldap/templates/unit_test.rb +0 -10
- data/rails/plugin/active_ldap/generators/scaffold_active_ldap/scaffold_active_ldap_generator.rb +0 -7
- data/rails/plugin/active_ldap/generators/scaffold_al/scaffold_al_generator.rb +0 -20
- data/rails/plugin/active_ldap/init.rb +0 -36
- data/rails_generators/scaffold_al/scaffold_al_generator.rb +0 -20
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
= ActiveLdap plugin for Ruby on Rails
|
|
2
|
-
|
|
3
|
-
== Setup
|
|
4
|
-
|
|
5
|
-
You need to write RAILS_ROOT/config/ldap.yml like the following:
|
|
6
|
-
|
|
7
|
-
development:
|
|
8
|
-
host: 127.0.0.1
|
|
9
|
-
port: 389
|
|
10
|
-
base: dc=devel,dc=local,dc=net
|
|
11
|
-
bind_dn: cn=admin,dc=local,dc=net
|
|
12
|
-
password: secret
|
|
13
|
-
|
|
14
|
-
test:
|
|
15
|
-
host: 127.0.0.1
|
|
16
|
-
port: 389
|
|
17
|
-
base: dc=test,dc=local,dc=net
|
|
18
|
-
bind_dn: cn=admin,dc=local,dc=net
|
|
19
|
-
password: secret
|
|
20
|
-
|
|
21
|
-
production:
|
|
22
|
-
host: 127.0.0.1
|
|
23
|
-
port: 389
|
|
24
|
-
base: dc=production,dc=local,dc=net
|
|
25
|
-
bind_dn: cn=admin,dc=local,dc=net
|
|
26
|
-
password: secret
|
|
27
|
-
|
|
28
|
-
== Model
|
|
29
|
-
|
|
30
|
-
Here is some examples.
|
|
31
|
-
|
|
32
|
-
app/model/member.rb:
|
|
33
|
-
class Member < ActiveLdap::Base
|
|
34
|
-
ldap_mapping :dn_attribute => 'uid',
|
|
35
|
-
:classes => ['person', 'posixAccount']
|
|
36
|
-
belongs_to :primary_group, :class => "Group",
|
|
37
|
-
:foreign_key => "gidNumber", :primary_key => "gidNumber"
|
|
38
|
-
belongs_to :groups, :many => 'memberUid'
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
app/model/group.rb:
|
|
42
|
-
class Group < ActiveLdap::Base
|
|
43
|
-
ldap_mapping :dn_attribute => "cn", :classes => ['posixGroup']
|
|
44
|
-
has_many :members, :wrap => "memberUid"
|
|
45
|
-
has_many :primary_members,
|
|
46
|
-
:foreign_key => 'gidNumber',
|
|
47
|
-
:primary_key => 'gidNumber'
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
app/model/ou.rb:
|
|
51
|
-
class Ou < ActiveLdap::Base
|
|
52
|
-
ldap_mapping :prefix => "",
|
|
53
|
-
:classes => ["top", "organizationalUnit"]
|
|
54
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
Description:
|
|
2
|
-
The model_activeldap generator creates stubs for a new model.
|
|
3
|
-
|
|
4
|
-
The generator takes a model name as its argument. The model name may be given in CamelCase or under_score and
|
|
5
|
-
should not be suffixed with 'Model'.
|
|
6
|
-
|
|
7
|
-
The generator creates a model class in app/models, a test suite in test/unit, and test fixtures in
|
|
8
|
-
test/fixtures/singular_name.yml. It will not create a migration.
|
|
9
|
-
|
|
10
|
-
Examples:
|
|
11
|
-
./script/generate model_activeldap user
|
|
12
|
-
|
|
13
|
-
This will create a User model:
|
|
14
|
-
Model: app/models/user.rb
|
|
15
|
-
Test: test/unit/user_test.rb
|
|
16
|
-
Fixtures: test/fixtures/users.yml
|
|
17
|
-
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
class ModelActiveLdapGenerator < Rails::Generator::NamedBase
|
|
2
|
-
include ActiveLdap::GetTextSupport
|
|
3
|
-
|
|
4
|
-
default_options :dn_attribute => "cn", :classes => nil
|
|
5
|
-
|
|
6
|
-
def manifest
|
|
7
|
-
record do |m|
|
|
8
|
-
# Check for class naming collisions.
|
|
9
|
-
m.class_collisions class_path, class_name, "#{class_name}Test"
|
|
10
|
-
|
|
11
|
-
# Model, test, and fixture directories.
|
|
12
|
-
m.directory File.join('app/models', class_path)
|
|
13
|
-
m.directory File.join('test/unit', class_path)
|
|
14
|
-
m.directory File.join('test/fixtures', class_path)
|
|
15
|
-
|
|
16
|
-
# Model class, unit test, and fixtures.
|
|
17
|
-
m.template('model_active_ldap.rb',
|
|
18
|
-
File.join('app/models', class_path, "#{file_name}.rb"),
|
|
19
|
-
:assigns => {:ldap_mapping => ldap_mapping})
|
|
20
|
-
m.template('unit_test.rb',
|
|
21
|
-
File.join('test/unit', class_path, "#{file_name}_test.rb"))
|
|
22
|
-
m.template('fixtures.yml',
|
|
23
|
-
File.join('test/fixtures', class_path, "#{table_name}.yml"))
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
private
|
|
28
|
-
def add_options!(opt)
|
|
29
|
-
opt.separator ''
|
|
30
|
-
opt.separator 'Options:'
|
|
31
|
-
opt.on("--dn-attribute=ATTRIBUTE",
|
|
32
|
-
_("Use ATTRIBUTE as default DN attribute for " \
|
|
33
|
-
"instances of this model"),
|
|
34
|
-
_("(default: %s)") % options[:dn_attribute]) do |attribute|
|
|
35
|
-
options[:dn_attribute] = attribute
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
opt.on("--prefix=PREFIX",
|
|
39
|
-
_("Use PREFIX as prefix for this model"),
|
|
40
|
-
_("(default: %s)") % default_prefix) do |prefix|
|
|
41
|
-
options[:prefix] = prefix
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
opt.on("--classes=CLASS,CLASS,...",
|
|
45
|
-
Array,
|
|
46
|
-
"Use CLASSES as required objectClass for instances of this model",
|
|
47
|
-
"(default: %s)" % options[:classes]) do |classes|
|
|
48
|
-
options[:classes] = classes
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def prefix
|
|
53
|
-
options[:prefix] || default_prefix
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
def default_prefix
|
|
57
|
-
"ou=#{name.demodulize.pluralize}"
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def ldap_mapping(indent=' ')
|
|
61
|
-
mapping = "ldap_mapping "
|
|
62
|
-
mapping_options = [":dn_attribute => #{options[:dn_attribute].dump}"]
|
|
63
|
-
mapping_options << ":prefix => #{prefix.dump}"
|
|
64
|
-
if options[:classes]
|
|
65
|
-
mapping_options << ":classes => #{options[:classes].inspect}"
|
|
66
|
-
end
|
|
67
|
-
mapping_options = mapping_options.join(",\n#{indent}#{' ' * mapping.size}")
|
|
68
|
-
"#{indent}#{mapping}#{mapping_options}"
|
|
69
|
-
end
|
|
70
|
-
end
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
|
|
2
|
-
one:
|
|
3
|
-
id: 1
|
|
4
|
-
<% for attribute in attributes -%>
|
|
5
|
-
<%= attribute.name %>: <%= attribute.default %>
|
|
6
|
-
<% end -%>
|
|
7
|
-
two:
|
|
8
|
-
id: 2
|
|
9
|
-
<% for attribute in attributes -%>
|
|
10
|
-
<%= attribute.name %>: <%= attribute.default %>
|
|
11
|
-
<% end -%>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
class ScaffoldAlGenerator < Rails::Generator::Base
|
|
2
|
-
include ActiveLdap::GetTextSupport
|
|
3
|
-
|
|
4
|
-
def initialize(*args)
|
|
5
|
-
duped_args = args.collect {|arg| arg.dup}
|
|
6
|
-
super
|
|
7
|
-
logger.warning(_("scaffold_al is deprecated. " \
|
|
8
|
-
"Use scaffold_active_ldap instead."))
|
|
9
|
-
generator_class = self.class.lookup("scaffold_active_ldap").klass
|
|
10
|
-
@generator = generator_class.new(duped_args)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def manifest
|
|
14
|
-
@generator.manifest
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def source_path(*args)
|
|
18
|
-
@generator.source_path(*args)
|
|
19
|
-
end
|
|
20
|
-
end
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# deprecated. Use rails/init.rb.
|
|
2
|
-
# This will be removed after ActiveLdap 1.0.2 is released.
|
|
3
|
-
|
|
4
|
-
require_library_or_gem 'active_ldap'
|
|
5
|
-
ActiveLdap::Base.logger ||= RAILS_DEFAULT_LOGGER
|
|
6
|
-
|
|
7
|
-
required_version = ["1", "0", "0"]
|
|
8
|
-
if (ActiveLdap::VERSION.split(".") <=> required_version) < 0
|
|
9
|
-
ActiveLdap::Base.class_eval do
|
|
10
|
-
format = _("You need ActiveLdap %s or later")
|
|
11
|
-
logger.error(format % required_version.join("."))
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
ldap_configuration_file = File.join(RAILS_ROOT, 'config', 'ldap.yml')
|
|
16
|
-
if File.exist?(ldap_configuration_file)
|
|
17
|
-
configurations = YAML.load(ERB.new(IO.read(ldap_configuration_file)).result)
|
|
18
|
-
ActiveLdap::Base.configurations = configurations
|
|
19
|
-
ActiveLdap::Base.establish_connection
|
|
20
|
-
else
|
|
21
|
-
ActiveLdap::Base.class_eval do
|
|
22
|
-
format = _("You should run 'script/generator scaffold_active_ldap' to make %s.")
|
|
23
|
-
logger.error(format % ldap_configuration_file)
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
class ::ActionView::Base
|
|
28
|
-
include ActiveLdap::Helper
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
require 'active_ldap/action_controller/ldap_benchmarking'
|
|
32
|
-
module ::ActionController
|
|
33
|
-
class Base
|
|
34
|
-
include ActiveLdap::ActionController::LdapBenchmarking
|
|
35
|
-
end
|
|
36
|
-
end
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
class ScaffoldAlGenerator < Rails::Generator::Base
|
|
2
|
-
include ActiveLdap::GetTextSupport
|
|
3
|
-
|
|
4
|
-
def initialize(*args)
|
|
5
|
-
duped_args = args.collect {|arg| arg.dup}
|
|
6
|
-
super
|
|
7
|
-
logger.warning(_("scaffold_al is deprecated. " \
|
|
8
|
-
"Use scaffold_active_ldap instead."))
|
|
9
|
-
generator_class = self.class.lookup("scaffold_active_ldap").klass
|
|
10
|
-
@generator = generator_class.new(duped_args)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def manifest
|
|
14
|
-
@generator.manifest
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def source_path(*args)
|
|
18
|
-
@generator.source_path(*args)
|
|
19
|
-
end
|
|
20
|
-
end
|