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.
Files changed (109) hide show
  1. data/CHANGES +32 -0
  2. data/README +8 -1
  3. data/data/locale/en/LC_MESSAGES/active-ldap.mo +0 -0
  4. data/data/locale/ja/LC_MESSAGES/active-ldap.mo +0 -0
  5. data/examples/al-admin/app/controllers/{application.rb → application_controller.rb} +3 -1
  6. data/examples/al-admin/app/views/account/sign_up.html.erb +6 -5
  7. data/examples/al-admin/config/boot.rb +1 -0
  8. data/examples/al-admin/config/environment.rb +4 -2
  9. data/examples/al-admin/config.ru +7 -0
  10. data/examples/al-admin/lib/ldap_test_helper.rb +38 -0
  11. data/examples/al-admin/lib/tasks/gettext.rake +3 -2
  12. data/examples/al-admin/lib/tasks/testing.rake +10 -0
  13. data/examples/al-admin/po/en/al-admin.po +4 -4
  14. data/examples/al-admin/po/ja/al-admin.po +4 -4
  15. data/examples/al-admin/po/nl/al-admin.po +3 -3
  16. data/examples/al-admin/public/dispatch.cgi +2 -2
  17. data/examples/al-admin/public/dispatch.fcgi +1 -1
  18. data/examples/al-admin/public/dispatch.rb +2 -2
  19. data/examples/al-admin/test/functional/account_controller_test.rb +2 -14
  20. data/examples/al-admin/test/functional/attributes_controller_test.rb +2 -12
  21. data/examples/al-admin/test/functional/directory_controller_test.rb +2 -12
  22. data/examples/al-admin/test/functional/object_classes_controller_test.rb +2 -12
  23. data/examples/al-admin/test/functional/syntaxes_controller_test.rb +2 -12
  24. data/examples/al-admin/test/functional/users_controller_test.rb +2 -12
  25. data/examples/al-admin/test/functional/welcome_controller_test.rb +2 -12
  26. data/examples/al-admin/test/integration/sign_up_test.rb +44 -0
  27. data/examples/al-admin/test/run-test.sh +1 -1
  28. data/examples/al-admin/test/test_helper.rb +25 -1
  29. data/examples/al-admin/test/unit/user_test.rb +1 -2
  30. data/examples/groupadd +2 -2
  31. data/examples/groupdel +2 -2
  32. data/examples/groupls +2 -2
  33. data/examples/groupmod +2 -2
  34. data/examples/lpasswd +2 -2
  35. data/examples/objects/group.rb +2 -2
  36. data/examples/objects/user.rb +1 -1
  37. data/examples/ouadd +2 -2
  38. data/examples/useradd +2 -2
  39. data/examples/useradd-binary +6 -3
  40. data/examples/userdel +2 -2
  41. data/examples/userls +2 -2
  42. data/examples/usermod +2 -2
  43. data/examples/usermod-binary-add +6 -3
  44. data/examples/usermod-binary-add-time +6 -3
  45. data/examples/usermod-binary-del +2 -2
  46. data/examples/usermod-lang-add +2 -2
  47. data/lib/active_ldap/adapter/base.rb +47 -23
  48. data/lib/active_ldap/adapter/jndi.rb +30 -28
  49. data/lib/active_ldap/adapter/jndi_connection.rb +6 -0
  50. data/lib/active_ldap/adapter/ldap.rb +25 -26
  51. data/lib/active_ldap/adapter/net_ldap.rb +28 -33
  52. data/lib/active_ldap/adapter/net_ldap_ext.rb +0 -6
  53. data/lib/active_ldap/association/proxy.rb +2 -1
  54. data/lib/active_ldap/attributes.rb +31 -0
  55. data/lib/active_ldap/base.rb +75 -31
  56. data/lib/active_ldap/compatible.rb +44 -0
  57. data/lib/active_ldap/configuration.rb +3 -3
  58. data/lib/active_ldap/connection.rb +41 -12
  59. data/lib/active_ldap/distinguished_name.rb +1 -0
  60. data/lib/active_ldap/get_text.rb +0 -7
  61. data/lib/active_ldap/ldif.rb +59 -44
  62. data/lib/active_ldap/operations.rb +41 -10
  63. data/lib/active_ldap/schema.rb +41 -6
  64. data/lib/active_ldap/user_password.rb +7 -7
  65. data/lib/active_ldap/validations.rb +24 -12
  66. data/lib/active_ldap/xml.rb +2 -2
  67. data/lib/active_ldap.rb +120 -139
  68. data/po/en/active-ldap.po +5 -5
  69. data/po/ja/active-ldap.po +5 -5
  70. data/rails/README +2 -2
  71. data/rails/init.rb +2 -2
  72. data/test/al-test-utils.rb +11 -4
  73. data/test/run-test.rb +6 -2
  74. data/test/test_associations.rb +4 -4
  75. data/test/test_attributes.rb +3 -1
  76. data/test/test_base.rb +75 -15
  77. data/test/test_base_per_instance.rb +7 -1
  78. data/test/test_bind.rb +4 -4
  79. data/test/test_connection.rb +36 -14
  80. data/test/test_connection_per_class.rb +5 -5
  81. data/test/test_connection_per_dn.rb +11 -5
  82. data/test/test_groupadd.rb +2 -2
  83. data/test/test_groupdel.rb +2 -2
  84. data/test/test_groupls.rb +1 -1
  85. data/test/test_groupmod.rb +2 -2
  86. data/test/test_ldif.rb +11 -1
  87. data/test/test_schema.rb +38 -2
  88. data/test/test_syntax.rb +12 -2
  89. data/test/test_useradd-binary.rb +1 -0
  90. data/test/test_usermod-binary-add-time.rb +1 -0
  91. data/test/test_usermod-binary-add.rb +1 -0
  92. data/test/test_validation.rb +24 -13
  93. data/test-unit/lib/test/unit/assertions.rb +97 -14
  94. data/test-unit/lib/test/unit/autorunner.rb +20 -4
  95. data/test-unit/lib/test/unit/priority.rb +21 -1
  96. data/test-unit/lib/test/unit/ui/console/testrunner.rb +7 -4
  97. data/test-unit/test/test_assertions.rb +52 -5
  98. metadata +10 -14
  99. data/rails/plugin/active_ldap/README +0 -54
  100. data/rails/plugin/active_ldap/generators/README +0 -2
  101. data/rails/plugin/active_ldap/generators/model_active_ldap/USAGE +0 -17
  102. data/rails/plugin/active_ldap/generators/model_active_ldap/model_active_ldap_generator.rb +0 -70
  103. data/rails/plugin/active_ldap/generators/model_active_ldap/templates/fixtures.yml +0 -11
  104. data/rails/plugin/active_ldap/generators/model_active_ldap/templates/model_active_ldap.rb +0 -3
  105. data/rails/plugin/active_ldap/generators/model_active_ldap/templates/unit_test.rb +0 -10
  106. data/rails/plugin/active_ldap/generators/scaffold_active_ldap/scaffold_active_ldap_generator.rb +0 -7
  107. data/rails/plugin/active_ldap/generators/scaffold_al/scaffold_al_generator.rb +0 -20
  108. data/rails/plugin/active_ldap/init.rb +0 -36
  109. 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,2 +0,0 @@
1
- This directory is deprecated. Use generators in rails_generators/.
2
- This directory will be removed after ActiveLdap 1.0.2 is released.
@@ -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,3 +0,0 @@
1
- class <%= class_name %> < ActiveLdap::Base
2
- <%= ldap_mapping %>
3
- end
@@ -1,10 +0,0 @@
1
- require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../test_helper'
2
-
3
- class <%= class_name %>Test < Test::Unit::TestCase
4
- fixtures :<%= table_name %>
5
-
6
- # Replace this with your real tests.
7
- def test_truth
8
- assert true
9
- end
10
- end
@@ -1,7 +0,0 @@
1
- class ScaffoldActiveLdapGenerator < Rails::Generator::Base
2
- def manifest
3
- record do |m|
4
- m.template("ldap.yml", File.join("config", "ldap.yml"))
5
- end
6
- end
7
- 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