activeldap 4.0.5 → 6.1.0

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 (57) hide show
  1. checksums.yaml +5 -5
  2. data/.yardopts +3 -1
  3. data/doc/text/development.md +26 -0
  4. data/doc/text/{news.textile → news.md} +451 -241
  5. data/doc/text/{rails.textile → rails.md} +44 -33
  6. data/doc/text/{tutorial.textile → tutorial.md} +177 -185
  7. data/lib/active_ldap/adapter/base.rb +40 -17
  8. data/lib/active_ldap/adapter/jndi.rb +21 -9
  9. data/lib/active_ldap/adapter/jndi_connection.rb +83 -20
  10. data/lib/active_ldap/adapter/ldap.rb +50 -28
  11. data/lib/active_ldap/adapter/ldap_ext.rb +32 -13
  12. data/lib/active_ldap/adapter/net_ldap.rb +26 -24
  13. data/lib/active_ldap/associations.rb +5 -5
  14. data/lib/active_ldap/attribute_methods/before_type_cast.rb +1 -1
  15. data/lib/active_ldap/attribute_methods/dirty.rb +4 -7
  16. data/lib/active_ldap/attribute_methods/query.rb +1 -1
  17. data/lib/active_ldap/attribute_methods/read.rb +5 -1
  18. data/lib/active_ldap/attribute_methods/write.rb +1 -1
  19. data/lib/active_ldap/attribute_methods.rb +1 -2
  20. data/lib/active_ldap/base.rb +61 -14
  21. data/lib/active_ldap/callbacks.rb +7 -8
  22. data/lib/active_ldap/configuration.rb +27 -3
  23. data/lib/active_ldap/connection.rb +4 -22
  24. data/lib/active_ldap/distinguished_name.rb +1 -1
  25. data/lib/active_ldap/human_readable.rb +5 -4
  26. data/lib/active_ldap/operations.rb +24 -4
  27. data/lib/active_ldap/persistence.rb +3 -2
  28. data/lib/active_ldap/populate.rb +5 -3
  29. data/lib/active_ldap/railties/controller_runtime.rb +1 -2
  30. data/lib/active_ldap/schema/syntaxes.rb +8 -4
  31. data/lib/active_ldap/validations.rb +12 -4
  32. data/lib/active_ldap/version.rb +1 -1
  33. data/lib/active_ldap.rb +0 -7
  34. data/po/en/active-ldap.po +2 -2
  35. data/po/ja/active-ldap.po +3 -3
  36. data/test/add-phonetic-attribute-options-to-slapd.ldif +3 -3
  37. data/test/al-test-utils.rb +125 -38
  38. data/test/command.rb +13 -16
  39. data/test/enable-dynamic-groups.ldif +22 -0
  40. data/test/enable-start-tls.ldif +27 -0
  41. data/test/run-test.rb +0 -4
  42. data/test/test_base.rb +223 -22
  43. data/test/test_base_per_instance.rb +33 -1
  44. data/test/test_callback.rb +10 -8
  45. data/test/test_connection.rb +4 -0
  46. data/test/test_connection_per_class.rb +34 -0
  47. data/test/test_dn.rb +7 -0
  48. data/test/test_entry.rb +1 -0
  49. data/test/test_find.rb +14 -3
  50. data/test/test_supported_control.rb +1 -1
  51. data/test/test_syntax.rb +5 -0
  52. data/test/test_validation.rb +28 -15
  53. metadata +23 -24
  54. data/README.textile +0 -141
  55. data/doc/text/development.textile +0 -54
  56. data/lib/active_ldap/timeout.rb +0 -75
  57. data/lib/active_ldap/timeout_stub.rb +0 -17
@@ -1,26 +1,26 @@
1
- h1. Rails
1
+ # Rails
2
2
 
3
3
  ActiveLdap supports Rails 4.0 or later.
4
4
 
5
- h2. Install
5
+ ## Install
6
6
 
7
7
  To install, simply add the following code to your Gemfile:
8
8
 
9
- <pre>
9
+ ```ruby
10
10
  gem 'activeldap', :require => 'active_ldap/railtie'
11
- </pre>
11
+ ```
12
12
 
13
13
  You should also depend on an LDAP adapter such as Net::LDAP
14
14
  or Ruby/LDAP. The following example uses Ruby/LDAP:
15
15
 
16
- <pre>
16
+ ```ruby
17
17
  gem 'ruby-ldap'
18
- </pre>
18
+ ```
19
19
 
20
20
  Bundler will install the gems automatically when you run
21
- 'bundle install'.
21
+ `bundle install`.
22
22
 
23
- h2. Configuration
23
+ ## Configuration
24
24
 
25
25
  You can use a LDAP configuration per environment. They are in
26
26
  a file named 'ldap.yml' in the config directory of your
@@ -32,54 +32,65 @@ development, test, and production environments.
32
32
 
33
33
  You can generate 'config/ldap.yml' by the following command:
34
34
 
35
- <pre class="command">
35
+ ```console
36
36
  % script/rails generate active_ldap:scaffold
37
- </pre>
37
+ ```
38
38
 
39
39
  You need to modify 'config/ldap.yml' generated by
40
- active_ldap:scaffold. For instance, the development entry
40
+ `active_ldap:scaffold`. For instance, the development entry
41
41
  would look something like the following:
42
42
 
43
- <pre>
44
- !!!plain
43
+ ```yaml
45
44
  development:
46
45
  host: 127.0.0.1
47
46
  port: 389
48
47
  base: dc=localhost
49
48
  bind_dn: cn=admin,dc=localhost
50
49
  password: secret
51
- </pre>
50
+ ```
52
51
 
53
52
  When your application starts up,
54
53
  ActiveLdap::Base.setup_connection will be called with the
55
54
  parameters specified for your current environment.
56
55
 
57
56
  You can replace default orm generators with gems one
58
- to skip active_ldap prefix in 'config/application.rb':
59
- <pre>config.app_generators.orm :active_ldap</pre>
57
+ to skip `active_ldap prefix` in `config/application.rb`:
60
58
 
61
- h2. Model
59
+ ```ruby
60
+ config.app_generators.orm :active_ldap
61
+ ```
62
+
63
+ Concurrency is now enabled by default to ensure thread safe searches and modifications. This can
64
+ still be disabled if desired.
65
+
66
+ ```ruby
67
+ # config/initializers/active_ldap.rb
68
+
69
+ ActiveLdap::Base.allow_concurrency = false
70
+ ```
71
+
72
+ ## Model
62
73
 
63
74
  You can generate a User model that represents entries under
64
75
  ou=Users by the following command:
65
76
 
66
- <pre class="command">
77
+ ```console
67
78
  % script/rails generate active_ldap:model User --dn-attribute uid --classes person PosixAccount
68
- </pre>
79
+ ```
69
80
 
70
81
  It generates the following app/model/user.rb:
71
82
 
72
- <pre>
83
+ ```ruby
73
84
  class User < ActiveLdap::Base
74
85
  ldap_mapping :dn_attribute => "uid",
75
86
  :prefix => "ou=Users",
76
87
  :classes => ["person", "PosixAccount"]
77
88
  end
78
- </pre>
89
+ ```
79
90
 
80
91
  You can add relationships by modifying app/model/user.rb:
81
92
 
82
- <pre>
93
+ ```ruby
83
94
  class User < ActiveLdap::Base
84
95
  ldap_mapping :dn_attribute => 'uid',
85
96
  :prefix => "ou=Users",
@@ -91,27 +102,27 @@ class User < ActiveLdap::Base
91
102
  belongs_to :groups,
92
103
  :many => 'memberUid'
93
104
  end
94
- </pre>
105
+ ```
95
106
 
96
107
  You can also generate a Group model by the following command:
97
108
 
98
- <pre class="command">
109
+ ```console
99
110
  % script/rails generate active_ldap:model Group --classes PosixGroup
100
- </pre>
111
+ ```
101
112
 
102
113
  app/model/group.rb:
103
114
 
104
- <pre>
115
+ ```ruby
105
116
  class Group < ActiveLdap::Base
106
117
  ldap_mapping :dn_attribute => "cn",
107
118
  :prefix => "ou=Groups",
108
119
  :classes => ["PosixGroup"]
109
120
  end
110
- </pre>
121
+ ```
111
122
 
112
123
  You can add relationships by modifying app/model/group.rb:
113
124
 
114
- <pre>
125
+ ```ruby
115
126
  class Group < ActiveLdap::Base
116
127
  ldap_mapping :dn_attribute => "cn",
117
128
  :prefix => "ou=Groups",
@@ -124,18 +135,18 @@ class Group < ActiveLdap::Base
124
135
  :foreign_key => "gidNumber",
125
136
  :primary_key => "gidNumber"
126
137
  end
127
- </pre>
138
+ ```
128
139
 
129
140
  You can also generate a Ou model by the following command:
130
141
 
131
- <pre class="command">
142
+ ```console
132
143
  % script/rails generate active_ldap:model Ou --prefix '' --classes organizationalUnit
133
- </pre>
144
+ ```
134
145
 
135
- <pre>
146
+ ```ruby
136
147
  class Ou < ActiveLdap::Base
137
148
  ldap_mapping :dn_attribute => "cn",
138
149
  :prefix => "",
139
150
  :classes => ["organizationalUnit"]
140
151
  end
141
- </pre>
152
+ ```