fakeldap 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/README.md +2 -0
  2. data/lib/fakeldap.rb +20 -0
  3. data/lib/fakeldap/version.rb +1 -1
  4. data/vendor/ruby-ldapserver/doc/LDAP.html +104 -0
  5. data/vendor/ruby-ldapserver/doc/LDAP/Abandon.html +112 -0
  6. data/vendor/ruby-ldapserver/doc/LDAP/Error.html +115 -0
  7. data/vendor/ruby-ldapserver/doc/LDAP/ResultError.html +241 -0
  8. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/AdminLimitExceeded.html +158 -0
  9. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/AffectsMultipleDSAs.html +158 -0
  10. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/AliasDereferencingProblem.html +158 -0
  11. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/AliasProblem.html +158 -0
  12. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/AttributeOrValueExists.html +158 -0
  13. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/AuthMethodNotSupported.html +158 -0
  14. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/Busy.html +158 -0
  15. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/CompareFalse.html +158 -0
  16. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/CompareTrue.html +158 -0
  17. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/ConfidentialityRequired.html +158 -0
  18. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/ConstraintViolation.html +158 -0
  19. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/EntryAlreadyExists.html +158 -0
  20. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/InappropriateAuthentication.html +158 -0
  21. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/InappropriateMatching.html +158 -0
  22. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/InsufficientAccessRights.html +158 -0
  23. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/InvalidAttributeSyntax.html +158 -0
  24. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/InvalidCredentials.html +158 -0
  25. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/InvalidDNSyntax.html +158 -0
  26. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/IsLeaf.html +158 -0
  27. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/LoopDetect.html +158 -0
  28. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/NamingViolation.html +158 -0
  29. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/NoSuchAttribute.html +158 -0
  30. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/NoSuchObject.html +158 -0
  31. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/NotAllowedOnNonLeaf.html +158 -0
  32. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/NotAllowedOnRDN.html +158 -0
  33. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/ObjectClassModsProhibited.html +158 -0
  34. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/ObjectClassViolation.html +158 -0
  35. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/OperationsError.html +158 -0
  36. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/Other.html +158 -0
  37. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/ProtocolError.html +158 -0
  38. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/Referral.html +158 -0
  39. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/SaslBindInProgress.html +158 -0
  40. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/SizeLimitExceeded.html +158 -0
  41. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/StrongAuthRequired.html +158 -0
  42. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/Success.html +158 -0
  43. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/TimeLimitExceeded.html +158 -0
  44. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/Unavailable.html +158 -0
  45. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/UnavailableCriticalExtension.html +158 -0
  46. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/UndefinedAttributeType.html +158 -0
  47. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/UnwillingToPerform.html +158 -0
  48. data/vendor/ruby-ldapserver/doc/LDAP/Server.html +1056 -0
  49. data/vendor/ruby-ldapserver/doc/LDAP/Server/Connection.html +1353 -0
  50. data/vendor/ruby-ldapserver/doc/LDAP/Server/Filter.html +634 -0
  51. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule.html +1132 -0
  52. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/DefaultMatchingClass.html +219 -0
  53. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/Equality.html +170 -0
  54. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/IA5Downcase.html +143 -0
  55. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/IA5Trim.html +155 -0
  56. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/Integer.html +143 -0
  57. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/Ordering.html +212 -0
  58. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/StringDowncase.html +143 -0
  59. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/StringTrim.html +154 -0
  60. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/Substrings.html +177 -0
  61. data/vendor/ruby-ldapserver/doc/LDAP/Server/Operation.html +2994 -0
  62. data/vendor/ruby-ldapserver/doc/LDAP/Server/Schema.html +2024 -0
  63. data/vendor/ruby-ldapserver/doc/LDAP/Server/Schema/AttributeType.html +1462 -0
  64. data/vendor/ruby-ldapserver/doc/LDAP/Server/Schema/ObjectClass.html +1097 -0
  65. data/vendor/ruby-ldapserver/doc/LDAP/Server/Syntax.html +1254 -0
  66. data/vendor/ruby-ldapserver/doc/LDAP/Server/VERSION.html +134 -0
  67. data/vendor/ruby-ldapserver/doc/_index.html +662 -0
  68. data/vendor/ruby-ldapserver/doc/class_list.html +36 -0
  69. data/vendor/ruby-ldapserver/doc/css/common.css +1 -0
  70. data/vendor/ruby-ldapserver/doc/css/full_list.css +50 -0
  71. data/vendor/ruby-ldapserver/doc/css/style.css +303 -0
  72. data/vendor/ruby-ldapserver/doc/file.README.html +399 -0
  73. data/vendor/ruby-ldapserver/doc/file_list.html +38 -0
  74. data/vendor/ruby-ldapserver/doc/frames.html +13 -0
  75. data/vendor/ruby-ldapserver/doc/index.html +399 -0
  76. data/vendor/ruby-ldapserver/doc/js/app.js +204 -0
  77. data/vendor/ruby-ldapserver/doc/js/full_list.js +112 -0
  78. data/vendor/ruby-ldapserver/doc/js/jquery.js +154 -0
  79. data/vendor/ruby-ldapserver/doc/method_list.html +1571 -0
  80. data/vendor/ruby-ldapserver/doc/top-level-namespace.html +88 -0
  81. metadata +99 -10
@@ -0,0 +1,2024 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta name="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>Class: LDAP::Server::Schema</title>
7
+ <link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
8
+ <link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
9
+
10
+ <script type="text/javascript" charset="utf-8">
11
+ relpath = '../..';
12
+ if (relpath != '') relpath += '/';
13
+ </script>
14
+ <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
15
+ <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
16
+
17
+ </head>
18
+ <body>
19
+ <script type="text/javascript" charset="utf-8">
20
+ if (window.top.frames.main) document.body.className = 'frames';
21
+ </script>
22
+
23
+ <div id="header">
24
+ <div id="menu">
25
+
26
+ <a href="../../_index.html">Index (S)</a> &raquo;
27
+ <span class='title'><span class='object_link'><a href="../../LDAP.html" title="LDAP (module)">LDAP</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Server.html" title="LDAP::Server (class)">Server</a></span></span>
28
+ &raquo;
29
+ <span class="title">Schema</span>
30
+
31
+
32
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
33
+ </div>
34
+
35
+ <div id="search">
36
+ <a id="class_list_link" href="#">Class List</a>
37
+ <a id="method_list_link" href="#">Method List</a>
38
+ <a id ="file_list_link" href="#">File List</a>
39
+ </div>
40
+
41
+ <div class="clear"></div>
42
+ </div>
43
+
44
+ <iframe id="search_frame"></iframe>
45
+
46
+ <div id="content"><h1>Class: LDAP::Server::Schema
47
+
48
+
49
+
50
+ </h1>
51
+
52
+ <dl class="box">
53
+
54
+ <dt class="r1">Inherits:</dt>
55
+ <dd class="r1">
56
+ <span class="inheritName">Object</span>
57
+
58
+ <ul class="fullTree">
59
+ <li>Object</li>
60
+
61
+ <li class="next">LDAP::Server::Schema</li>
62
+
63
+ </ul>
64
+ <a href="#" class="inheritanceTree">show all</a>
65
+
66
+ </dd>
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+ <dt class="r2 last">Defined in:</dt>
77
+ <dd class="r2 last">lib/ldap/server/schema.rb</dd>
78
+
79
+ </dl>
80
+ <div class="clear"></div>
81
+
82
+ <h2>Overview</h2><div class="docstring">
83
+ <div class="discussion">
84
+ <p>
85
+ This object represents an LDAP schema: that is, a collection of
86
+ objectclasses and attributetypes. Methods are provided for loading the
87
+ schema (from a string or a disk file), and validating an av-hash against
88
+ it.
89
+ </p>
90
+
91
+
92
+ </div>
93
+ </div>
94
+ <div class="tags">
95
+
96
+ </div><h2>Defined Under Namespace</h2>
97
+ <p class="children">
98
+
99
+
100
+
101
+
102
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Schema/AttributeType.html" title="LDAP::Server::Schema::AttributeType (class)">AttributeType</a></span>, <span class='object_link'><a href="Schema/ObjectClass.html" title="LDAP::Server::Schema::ObjectClass (class)">ObjectClass</a></span>
103
+
104
+
105
+ </p>
106
+
107
+ <h2>Constant Summary</h2>
108
+
109
+ <dl class="constants">
110
+
111
+ <dt id="SUBSCHEMA_ENTRY_ATTR-constant" class="">SUBSCHEMA_ENTRY_ATTR =
112
+
113
+ </dt>
114
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>cn</span><span class='tstring_end'>'</span></span></pre></dd>
115
+
116
+ <dt id="SUBSCHEMA_ENTRY_VALUE-constant" class="">SUBSCHEMA_ENTRY_VALUE =
117
+
118
+ </dt>
119
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Subschema</span><span class='tstring_end'>'</span></span></pre></dd>
120
+
121
+ </dl>
122
+
123
+
124
+
125
+
126
+
127
+ <h2>
128
+ Instance Method Summary
129
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
130
+ </h2>
131
+
132
+ <ul class="summary">
133
+
134
+ <li class="public ">
135
+ <span class="summary_signature">
136
+
137
+ <a href="#add_attrtype-instance_method" title="#add_attrtype (instance method)">- (Object) <strong>add_attrtype</strong>(str) </a>
138
+
139
+
140
+
141
+ </span>
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+ <span class="summary_desc"><div class='inline'><p>
151
+ Add an AttributeType to the schema.
152
+ </p>
153
+ </div></span>
154
+
155
+ </li>
156
+
157
+
158
+ <li class="public ">
159
+ <span class="summary_signature">
160
+
161
+ <a href="#add_objectclass-instance_method" title="#add_objectclass (instance method)">- (Object) <strong>add_objectclass</strong>(str) </a>
162
+
163
+
164
+
165
+ </span>
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+ <span class="summary_desc"><div class='inline'><p>
175
+ Add an ObjectClass to the schema.
176
+ </p>
177
+ </div></span>
178
+
179
+ </li>
180
+
181
+
182
+ <li class="public ">
183
+ <span class="summary_signature">
184
+
185
+ <a href="#all_attrtypes-instance_method" title="#all_attrtypes (instance method)">- (Object) <strong>all_attrtypes</strong> </a>
186
+
187
+
188
+
189
+ </span>
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+ <span class="summary_desc"><div class='inline'><p>
199
+ Return array of all AttributeType objects in this schema.
200
+ </p>
201
+ </div></span>
202
+
203
+ </li>
204
+
205
+
206
+ <li class="public ">
207
+ <span class="summary_signature">
208
+
209
+ <a href="#all_objectclasses-instance_method" title="#all_objectclasses (instance method)">- (Object) <strong>all_objectclasses</strong> </a>
210
+
211
+
212
+
213
+ </span>
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+ <span class="summary_desc"><div class='inline'><p>
223
+ Return array of all ObjectClass objects in this schema.
224
+ </p>
225
+ </div></span>
226
+
227
+ </li>
228
+
229
+
230
+ <li class="public ">
231
+ <span class="summary_signature">
232
+
233
+ <a href="#attr-instance_method" title="#attr (instance method)">- (Object) <strong>attr</strong>(oc, at) </a>
234
+
235
+
236
+
237
+ </span>
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+ <span class="summary_desc"><div class='inline'><p>
247
+ Backwards-compatible for ruby-ldap LDAP::Schema.
248
+ </p>
249
+ </div></span>
250
+
251
+ </li>
252
+
253
+
254
+ <li class="public ">
255
+ <span class="summary_signature">
256
+
257
+ <a href="#changed-instance_method" title="#changed (instance method)">- (Object) <strong>changed</strong> </a>
258
+
259
+
260
+
261
+ </span>
262
+
263
+
264
+
265
+
266
+
267
+
268
+
269
+
270
+ <span class="summary_desc"><div class='inline'><p>
271
+ Clear the subschema subentry cache, so the next time someone requests it,
272
+ it will be rebuilt.
273
+ </p>
274
+ </div></span>
275
+
276
+ </li>
277
+
278
+
279
+ <li class="public ">
280
+ <span class="summary_signature">
281
+
282
+ <a href="#find_attrtype-instance_method" title="#find_attrtype (instance method)">- (Object) <strong>find_attrtype</strong>(n) </a>
283
+
284
+
285
+
286
+ </span>
287
+
288
+
289
+
290
+
291
+
292
+
293
+
294
+
295
+ <span class="summary_desc"><div class='inline'><p>
296
+ Locate an attributetype object by name/alias/oid (or raise exception).
297
+ </p>
298
+ </div></span>
299
+
300
+ </li>
301
+
302
+
303
+ <li class="public ">
304
+ <span class="summary_signature">
305
+
306
+ <a href="#find_objectclass-instance_method" title="#find_objectclass (instance method)">- (Object) <strong>find_objectclass</strong>(n) </a>
307
+
308
+
309
+
310
+ </span>
311
+
312
+
313
+
314
+
315
+
316
+
317
+
318
+
319
+ <span class="summary_desc"><div class='inline'><p>
320
+ Locate an objectclass object by name/alias/oid (or raise exception).
321
+ </p>
322
+ </div></span>
323
+
324
+ </li>
325
+
326
+
327
+ <li class="public ">
328
+ <span class="summary_signature">
329
+
330
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Schema) <strong>initialize</strong> </a>
331
+
332
+
333
+
334
+ </span>
335
+
336
+ <span class="note title constructor">constructor</span>
337
+
338
+
339
+
340
+
341
+
342
+
343
+
344
+
345
+ <span class="summary_desc"><div class='inline'><p>
346
+ A new instance of Schema.
347
+ </p>
348
+ </div></span>
349
+
350
+ </li>
351
+
352
+
353
+ <li class="public ">
354
+ <span class="summary_signature">
355
+
356
+ <a href="#load-instance_method" title="#load (instance method)">- (Object) <strong>load</strong>(str_or_io) </a>
357
+
358
+
359
+
360
+ </span>
361
+
362
+
363
+
364
+
365
+
366
+
367
+
368
+
369
+ <span class="summary_desc"><div class='inline'><p>
370
+ Load an OpenLDAP-format schema from a string or IO object (anything which
371
+ responds to &#8216;each_line&#8217;).
372
+ </p>
373
+ </div></span>
374
+
375
+ </li>
376
+
377
+
378
+ <li class="public ">
379
+ <span class="summary_signature">
380
+
381
+ <a href="#load_file-instance_method" title="#load_file (instance method)">- (Object) <strong>load_file</strong>(filename) </a>
382
+
383
+
384
+
385
+ </span>
386
+
387
+
388
+
389
+
390
+
391
+
392
+
393
+
394
+ <span class="summary_desc"><div class='inline'><p>
395
+ Load an OpenLDAP-format schema from a named file (see notes under
396
+ &#8216;load&#8217;).
397
+ </p>
398
+ </div></span>
399
+
400
+ </li>
401
+
402
+
403
+ <li class="public ">
404
+ <span class="summary_signature">
405
+
406
+ <a href="#load_system-instance_method" title="#load_system (instance method)">- (Object) <strong>load_system</strong> </a>
407
+
408
+
409
+
410
+ </span>
411
+
412
+
413
+
414
+
415
+
416
+
417
+
418
+
419
+ <span class="summary_desc"><div class='inline'><p>
420
+ Load in the base set of objectclasses and attributetypes, being the same
421
+ set as OpenLDAP preloads internally.
422
+ </p>
423
+ </div></span>
424
+
425
+ </li>
426
+
427
+
428
+ <li class="public ">
429
+ <span class="summary_signature">
430
+
431
+ <a href="#may-instance_method" title="#may (instance method)">- (Object) <strong>may</strong>(oc) </a>
432
+
433
+
434
+
435
+ </span>
436
+
437
+
438
+
439
+
440
+
441
+
442
+
443
+
444
+ <span class="summary_desc"><div class='inline'><p>
445
+ Backwards-compatible for ruby-ldap LDAP::Schema.
446
+ </p>
447
+ </div></span>
448
+
449
+ </li>
450
+
451
+
452
+ <li class="public ">
453
+ <span class="summary_signature">
454
+
455
+ <a href="#must-instance_method" title="#must (instance method)">- (Object) <strong>must</strong>(oc) </a>
456
+
457
+
458
+
459
+ </span>
460
+
461
+
462
+
463
+
464
+
465
+
466
+
467
+
468
+ <span class="summary_desc"><div class='inline'><p>
469
+ Backwards-compatible for ruby-ldap LDAP::Schema.
470
+ </p>
471
+ </div></span>
472
+
473
+ </li>
474
+
475
+
476
+ <li class="public ">
477
+ <span class="summary_signature">
478
+
479
+ <a href="#names-instance_method" title="#names (instance method)">- (Object) <strong>names</strong>(key) </a>
480
+
481
+
482
+
483
+ </span>
484
+
485
+
486
+
487
+
488
+
489
+
490
+
491
+
492
+ <span class="summary_desc"><div class='inline'><p>
493
+ Hopefully backwards-compatible API for ruby-ldap&#8217;s LDAP::Schema.
494
+ </p>
495
+ </div></span>
496
+
497
+ </li>
498
+
499
+
500
+ <li class="public ">
501
+ <span class="summary_signature">
502
+
503
+ <a href="#resolve_oids-instance_method" title="#resolve_oids (instance method)">- (Object) <strong>resolve_oids</strong> </a>
504
+
505
+
506
+
507
+ </span>
508
+
509
+
510
+
511
+
512
+
513
+
514
+
515
+
516
+ <span class="summary_desc"><div class='inline'><p>
517
+ After loading object classes and attr types: resolve oid strings to point
518
+ to objects.
519
+ </p>
520
+ </div></span>
521
+
522
+ </li>
523
+
524
+
525
+ <li class="public ">
526
+ <span class="summary_signature">
527
+
528
+ <a href="#subschema_dn-instance_method" title="#subschema_dn (instance method)">- (Object) <strong>subschema_dn</strong> </a>
529
+
530
+
531
+
532
+ </span>
533
+
534
+
535
+
536
+
537
+
538
+
539
+
540
+
541
+ <span class="summary_desc"><div class='inline'><p>
542
+ return the DN of the subschema subentry.
543
+ </p>
544
+ </div></span>
545
+
546
+ </li>
547
+
548
+
549
+ <li class="public ">
550
+ <span class="summary_signature">
551
+
552
+ <a href="#subschema_subentry-instance_method" title="#subschema_subentry (instance method)">- (Object) <strong>subschema_subentry</strong> </a>
553
+
554
+
555
+
556
+ </span>
557
+
558
+
559
+
560
+
561
+
562
+
563
+
564
+
565
+ <span class="summary_desc"><div class='inline'><p>
566
+ Return an av hash object giving the subschema subentry.
567
+ </p>
568
+ </div></span>
569
+
570
+ </li>
571
+
572
+
573
+ <li class="public ">
574
+ <span class="summary_signature">
575
+
576
+ <a href="#sup-instance_method" title="#sup (instance method)">- (Object) <strong>sup</strong>(oc) </a>
577
+
578
+
579
+
580
+ </span>
581
+
582
+
583
+
584
+
585
+
586
+
587
+
588
+
589
+ <span class="summary_desc"><div class='inline'><p>
590
+ Backwards-compatible for ruby-ldap LDAP::Schema.
591
+ </p>
592
+ </div></span>
593
+
594
+ </li>
595
+
596
+
597
+ <li class="public ">
598
+ <span class="summary_signature">
599
+
600
+ <a href="#validate-instance_method" title="#validate (instance method)">- (Object) <strong>validate</strong>(mods, entry = {}) </a>
601
+
602
+
603
+
604
+ </span>
605
+
606
+
607
+
608
+
609
+
610
+
611
+
612
+
613
+ <span class="summary_desc"><div class='inline'><p>
614
+ Validate a new entry or update.
615
+ </p>
616
+ </div></span>
617
+
618
+ </li>
619
+
620
+
621
+ </ul>
622
+
623
+
624
+ <div id="constructor_details" class="method_details_list">
625
+ <h2>Constructor Details</h2>
626
+
627
+ <div class="method_details first">
628
+ <p class="signature first" id="initialize-instance_method">
629
+
630
+ - (<tt><span class='object_link'><a href="" title="LDAP::Server::Schema (class)">Schema</a></span></tt>) <strong>initialize</strong>
631
+
632
+
633
+
634
+ </p><div class="docstring">
635
+ <div class="discussion">
636
+ <p>
637
+ A new instance of Schema
638
+ </p>
639
+
640
+
641
+ </div>
642
+ </div>
643
+ <div class="tags">
644
+
645
+ </div><table class="source_code">
646
+ <tr>
647
+ <td>
648
+ <pre class="lines">
649
+
650
+
651
+ 17
652
+ 18
653
+ 19
654
+ 20
655
+ 21</pre>
656
+ </td>
657
+ <td>
658
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/schema.rb', line 17</span>
659
+
660
+ <span class='kw'>def</span> <span class='id initialize'>initialize</span>
661
+ <span class='ivar'>@attrtypes</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='comment'># name/alias/oid =&gt; AttributeType instance
662
+ </span> <span class='ivar'>@objectclasses</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='comment'># name/alias/oid =&gt; ObjectClass instance
663
+ </span> <span class='ivar'>@subschema_cache</span> <span class='op'>=</span> <span class='kw'>nil</span>
664
+ <span class='kw'>end</span></pre>
665
+ </td>
666
+ </tr>
667
+ </table>
668
+ </div>
669
+
670
+ </div>
671
+
672
+
673
+ <div id="instance_method_details" class="method_details_list">
674
+ <h2>Instance Method Details</h2>
675
+
676
+
677
+ <div class="method_details first">
678
+ <p class="signature first" id="add_attrtype-instance_method">
679
+
680
+ - (<tt>Object</tt>) <strong>add_attrtype</strong>(str)
681
+
682
+
683
+
684
+ </p><div class="docstring">
685
+ <div class="discussion">
686
+ <p>
687
+ Add an AttributeType to the schema
688
+ </p>
689
+
690
+
691
+ </div>
692
+ </div>
693
+ <div class="tags">
694
+
695
+ </div><table class="source_code">
696
+ <tr>
697
+ <td>
698
+ <pre class="lines">
699
+
700
+
701
+ 53
702
+ 54
703
+ 55
704
+ 56
705
+ 57
706
+ 58
707
+ 59</pre>
708
+ </td>
709
+ <td>
710
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/schema.rb', line 53</span>
711
+
712
+ <span class='kw'>def</span> <span class='id add_attrtype'>add_attrtype</span><span class='lparen'>(</span><span class='id str'>str</span><span class='rparen'>)</span>
713
+ <span class='id a'>a</span> <span class='op'>=</span> <span class='const'>AttributeType</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='id str'>str</span><span class='rparen'>)</span>
714
+ <span class='ivar'>@attrtypes</span><span class='lbracket'>[</span><span class='id a'>a</span><span class='period'>.</span><span class='id oid'>oid</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id a'>a</span> <span class='kw'>if</span> <span class='id a'>a</span><span class='period'>.</span><span class='id oid'>oid</span>
715
+ <span class='id a'>a</span><span class='period'>.</span><span class='id names'>names</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id n'>n</span><span class='op'>|</span>
716
+ <span class='ivar'>@attrtypes</span><span class='lbracket'>[</span><span class='id n'>n</span><span class='period'>.</span><span class='id downcase'>downcase</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id a'>a</span>
717
+ <span class='kw'>end</span>
718
+ <span class='kw'>end</span></pre>
719
+ </td>
720
+ </tr>
721
+ </table>
722
+ </div>
723
+
724
+ <div class="method_details ">
725
+ <p class="signature " id="add_objectclass-instance_method">
726
+
727
+ - (<tt>Object</tt>) <strong>add_objectclass</strong>(str)
728
+
729
+
730
+
731
+ </p><div class="docstring">
732
+ <div class="discussion">
733
+ <p>
734
+ Add an ObjectClass to the schema
735
+ </p>
736
+
737
+
738
+ </div>
739
+ </div>
740
+ <div class="tags">
741
+
742
+ </div><table class="source_code">
743
+ <tr>
744
+ <td>
745
+ <pre class="lines">
746
+
747
+
748
+ 78
749
+ 79
750
+ 80
751
+ 81
752
+ 82
753
+ 83
754
+ 84</pre>
755
+ </td>
756
+ <td>
757
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/schema.rb', line 78</span>
758
+
759
+ <span class='kw'>def</span> <span class='id add_objectclass'>add_objectclass</span><span class='lparen'>(</span><span class='id str'>str</span><span class='rparen'>)</span>
760
+ <span class='id o'>o</span> <span class='op'>=</span> <span class='const'>ObjectClass</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='id str'>str</span><span class='rparen'>)</span>
761
+ <span class='ivar'>@objectclasses</span><span class='lbracket'>[</span><span class='id o'>o</span><span class='period'>.</span><span class='id oid'>oid</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id o'>o</span> <span class='kw'>if</span> <span class='id o'>o</span><span class='period'>.</span><span class='id oid'>oid</span>
762
+ <span class='id o'>o</span><span class='period'>.</span><span class='id names'>names</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id n'>n</span><span class='op'>|</span>
763
+ <span class='ivar'>@objectclasses</span><span class='lbracket'>[</span><span class='id n'>n</span><span class='period'>.</span><span class='id downcase'>downcase</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id o'>o</span>
764
+ <span class='kw'>end</span>
765
+ <span class='kw'>end</span></pre>
766
+ </td>
767
+ </tr>
768
+ </table>
769
+ </div>
770
+
771
+ <div class="method_details ">
772
+ <p class="signature " id="all_attrtypes-instance_method">
773
+
774
+ - (<tt>Object</tt>) <strong>all_attrtypes</strong>
775
+
776
+
777
+
778
+ </p><div class="docstring">
779
+ <div class="discussion">
780
+ <p>
781
+ Return array of all AttributeType objects in this schema
782
+ </p>
783
+
784
+
785
+ </div>
786
+ </div>
787
+ <div class="tags">
788
+
789
+ </div><table class="source_code">
790
+ <tr>
791
+ <td>
792
+ <pre class="lines">
793
+
794
+
795
+ 72
796
+ 73
797
+ 74</pre>
798
+ </td>
799
+ <td>
800
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/schema.rb', line 72</span>
801
+
802
+ <span class='kw'>def</span> <span class='id all_attrtypes'>all_attrtypes</span>
803
+ <span class='ivar'>@attrtypes</span><span class='period'>.</span><span class='id values'>values</span><span class='period'>.</span><span class='id uniq'>uniq</span>
804
+ <span class='kw'>end</span></pre>
805
+ </td>
806
+ </tr>
807
+ </table>
808
+ </div>
809
+
810
+ <div class="method_details ">
811
+ <p class="signature " id="all_objectclasses-instance_method">
812
+
813
+ - (<tt>Object</tt>) <strong>all_objectclasses</strong>
814
+
815
+
816
+
817
+ </p><div class="docstring">
818
+ <div class="discussion">
819
+ <p>
820
+ Return array of all ObjectClass objects in this schema
821
+ </p>
822
+
823
+
824
+ </div>
825
+ </div>
826
+ <div class="tags">
827
+
828
+ </div><table class="source_code">
829
+ <tr>
830
+ <td>
831
+ <pre class="lines">
832
+
833
+
834
+ 97
835
+ 98
836
+ 99</pre>
837
+ </td>
838
+ <td>
839
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/schema.rb', line 97</span>
840
+
841
+ <span class='kw'>def</span> <span class='id all_objectclasses'>all_objectclasses</span>
842
+ <span class='ivar'>@objectclasses</span><span class='period'>.</span><span class='id values'>values</span><span class='period'>.</span><span class='id uniq'>uniq</span>
843
+ <span class='kw'>end</span></pre>
844
+ </td>
845
+ </tr>
846
+ </table>
847
+ </div>
848
+
849
+ <div class="method_details ">
850
+ <p class="signature " id="attr-instance_method">
851
+
852
+ - (<tt>Object</tt>) <strong>attr</strong>(oc, at)
853
+
854
+
855
+
856
+ </p><div class="docstring">
857
+ <div class="discussion">
858
+ <p>
859
+ Backwards-compatible for ruby-ldap LDAP::Schema
860
+ </p>
861
+
862
+
863
+ </div>
864
+ </div>
865
+ <div class="tags">
866
+
867
+ </div><table class="source_code">
868
+ <tr>
869
+ <td>
870
+ <pre class="lines">
871
+
872
+
873
+ 408
874
+ 409
875
+ 410
876
+ 411
877
+ 412
878
+ 413
879
+ 414
880
+ 415
881
+ 416
882
+ 417
883
+ 418
884
+ 419
885
+ 420
886
+ 421
887
+ 422
888
+ 423
889
+ 424
890
+ 425</pre>
891
+ </td>
892
+ <td>
893
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/schema.rb', line 408</span>
894
+
895
+ <span class='kw'>def</span> <span class='id attr'>attr</span><span class='lparen'>(</span><span class='id oc'>oc</span><span class='comma'>,</span><span class='id at'>at</span><span class='rparen'>)</span>
896
+ <span class='id o'>o</span> <span class='op'>=</span> <span class='id find_objectclass'>find_objectclass</span><span class='lparen'>(</span><span class='id oc'>oc</span><span class='rparen'>)</span>
897
+ <span class='kw'>case</span> <span class='id at'>at</span><span class='period'>.</span><span class='id upcase'>upcase</span>
898
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>MUST</span><span class='tstring_end'>'</span></span>
899
+ <span class='kw'>return</span> <span class='id o'>o</span><span class='period'>.</span><span class='id must'>must</span><span class='period'>.</span><span class='id collect'>collect</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id e'>e</span><span class='op'>|</span> <span class='id e'>e</span><span class='period'>.</span><span class='id to_s'>to_s</span> <span class='rbrace'>}</span>
900
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>MAY</span><span class='tstring_end'>'</span></span>
901
+ <span class='kw'>return</span> <span class='id o'>o</span><span class='period'>.</span><span class='id may'>may</span><span class='period'>.</span><span class='id collect'>collect</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id e'>e</span><span class='op'>|</span> <span class='id e'>e</span><span class='period'>.</span><span class='id to_s'>to_s</span> <span class='rbrace'>}</span>
902
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>SUP</span><span class='tstring_end'>'</span></span>
903
+ <span class='kw'>return</span> <span class='id o'>o</span><span class='period'>.</span><span class='id sup'>sup</span><span class='period'>.</span><span class='id collect'>collect</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id e'>e</span><span class='op'>|</span> <span class='id e'>e</span><span class='period'>.</span><span class='id to_s'>to_s</span> <span class='rbrace'>}</span>
904
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>NAME</span><span class='tstring_end'>'</span></span>
905
+ <span class='kw'>return</span> <span class='id o'>o</span><span class='period'>.</span><span class='id names'>names</span><span class='period'>.</span><span class='id collect'>collect</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id e'>e</span><span class='op'>|</span> <span class='id e'>e</span><span class='period'>.</span><span class='id to_s'>to_s</span> <span class='rbrace'>}</span>
906
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>DESC</span><span class='tstring_end'>'</span></span>
907
+ <span class='kw'>return</span> <span class='lbracket'>[</span><span class='id o'>o</span><span class='period'>.</span><span class='id desc'>desc</span><span class='rbracket'>]</span>
908
+ <span class='kw'>end</span>
909
+ <span class='kw'>return</span> <span class='kw'>nil</span>
910
+ <span class='kw'>rescue</span> <span class='const'>LDAP</span><span class='op'>::</span><span class='const'>ResultError</span>
911
+ <span class='kw'>return</span> <span class='kw'>nil</span>
912
+ <span class='kw'>end</span></pre>
913
+ </td>
914
+ </tr>
915
+ </table>
916
+ </div>
917
+
918
+ <div class="method_details ">
919
+ <p class="signature " id="changed-instance_method">
920
+
921
+ - (<tt>Object</tt>) <strong>changed</strong>
922
+
923
+
924
+
925
+ </p><div class="docstring">
926
+ <div class="discussion">
927
+ <p>
928
+ Clear the subschema subentry cache, so the next time someone requests it,
929
+ it will be rebuilt
930
+ </p>
931
+
932
+
933
+ </div>
934
+ </div>
935
+ <div class="tags">
936
+
937
+ </div><table class="source_code">
938
+ <tr>
939
+ <td>
940
+ <pre class="lines">
941
+
942
+
943
+ 47
944
+ 48
945
+ 49</pre>
946
+ </td>
947
+ <td>
948
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/schema.rb', line 47</span>
949
+
950
+ <span class='kw'>def</span> <span class='id changed'>changed</span>
951
+ <span class='ivar'>@subschema_cache</span> <span class='op'>=</span> <span class='kw'>nil</span>
952
+ <span class='kw'>end</span></pre>
953
+ </td>
954
+ </tr>
955
+ </table>
956
+ </div>
957
+
958
+ <div class="method_details ">
959
+ <p class="signature " id="find_attrtype-instance_method">
960
+
961
+ - (<tt>Object</tt>) <strong>find_attrtype</strong>(n)
962
+
963
+
964
+
965
+ </p><div class="docstring">
966
+ <div class="discussion">
967
+ <p>
968
+ Locate an attributetype object by name/alias/oid (or raise exception)
969
+ </p>
970
+
971
+
972
+ </div>
973
+ </div>
974
+ <div class="tags">
975
+ <h3>Raises:</h3>
976
+ <ul class="raise">
977
+
978
+ <li>
979
+
980
+ <span class='type'>(<tt><span class='object_link'><a href="../ResultError/UndefinedAttributeType.html" title="LDAP::ResultError::UndefinedAttributeType (class)">LDAP::ResultError::UndefinedAttributeType</a></span></tt>)</span>
981
+
982
+
983
+
984
+
985
+ </li>
986
+
987
+ </ul>
988
+
989
+ </div><table class="source_code">
990
+ <tr>
991
+ <td>
992
+ <pre class="lines">
993
+
994
+
995
+ 63
996
+ 64
997
+ 65
998
+ 66
999
+ 67
1000
+ 68</pre>
1001
+ </td>
1002
+ <td>
1003
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/schema.rb', line 63</span>
1004
+
1005
+ <span class='kw'>def</span> <span class='id find_attrtype'>find_attrtype</span><span class='lparen'>(</span><span class='id n'>n</span><span class='rparen'>)</span>
1006
+ <span class='kw'>return</span> <span class='id n'>n</span> <span class='kw'>if</span> <span class='id n'>n</span><span class='period'>.</span><span class='id nil?'>nil?</span> <span class='kw'>or</span> <span class='id n'>n</span><span class='period'>.</span><span class='id is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>LDAP</span><span class='op'>::</span><span class='const'>Server</span><span class='op'>::</span><span class='const'>Schema</span><span class='op'>::</span><span class='const'>AttributeType</span><span class='rparen'>)</span>
1007
+ <span class='id r'>r</span> <span class='op'>=</span> <span class='ivar'>@attrtypes</span><span class='lbracket'>[</span><span class='id n'>n</span><span class='period'>.</span><span class='id downcase'>downcase</span><span class='rbracket'>]</span>
1008
+ <span class='id raise'>raise</span> <span class='const'>LDAP</span><span class='op'>::</span><span class='const'>ResultError</span><span class='op'>::</span><span class='const'>UndefinedAttributeType</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Unknown AttributeType </span><span class='embexpr_beg'>#{</span><span class='id n'>n</span><span class='period'>.</span><span class='id inspect'>inspect</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id r'>r</span>
1009
+ <span class='id r'>r</span>
1010
+ <span class='kw'>end</span></pre>
1011
+ </td>
1012
+ </tr>
1013
+ </table>
1014
+ </div>
1015
+
1016
+ <div class="method_details ">
1017
+ <p class="signature " id="find_objectclass-instance_method">
1018
+
1019
+ - (<tt>Object</tt>) <strong>find_objectclass</strong>(n)
1020
+
1021
+
1022
+
1023
+ </p><div class="docstring">
1024
+ <div class="discussion">
1025
+ <p>
1026
+ Locate an objectclass object by name/alias/oid (or raise exception)
1027
+ </p>
1028
+
1029
+
1030
+ </div>
1031
+ </div>
1032
+ <div class="tags">
1033
+ <h3>Raises:</h3>
1034
+ <ul class="raise">
1035
+
1036
+ <li>
1037
+
1038
+ <span class='type'>(<tt><span class='object_link'><a href="../ResultError/ObjectClassViolation.html" title="LDAP::ResultError::ObjectClassViolation (class)">LDAP::ResultError::ObjectClassViolation</a></span></tt>)</span>
1039
+
1040
+
1041
+
1042
+
1043
+ </li>
1044
+
1045
+ </ul>
1046
+
1047
+ </div><table class="source_code">
1048
+ <tr>
1049
+ <td>
1050
+ <pre class="lines">
1051
+
1052
+
1053
+ 88
1054
+ 89
1055
+ 90
1056
+ 91
1057
+ 92
1058
+ 93</pre>
1059
+ </td>
1060
+ <td>
1061
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/schema.rb', line 88</span>
1062
+
1063
+ <span class='kw'>def</span> <span class='id find_objectclass'>find_objectclass</span><span class='lparen'>(</span><span class='id n'>n</span><span class='rparen'>)</span>
1064
+ <span class='kw'>return</span> <span class='id n'>n</span> <span class='kw'>if</span> <span class='id n'>n</span><span class='period'>.</span><span class='id nil?'>nil?</span> <span class='kw'>or</span> <span class='id n'>n</span><span class='period'>.</span><span class='id is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>LDAP</span><span class='op'>::</span><span class='const'>Server</span><span class='op'>::</span><span class='const'>Schema</span><span class='op'>::</span><span class='const'>ObjectClass</span><span class='rparen'>)</span>
1065
+ <span class='id r'>r</span> <span class='op'>=</span> <span class='ivar'>@objectclasses</span><span class='lbracket'>[</span><span class='id n'>n</span><span class='period'>.</span><span class='id downcase'>downcase</span><span class='rbracket'>]</span>
1066
+ <span class='id raise'>raise</span> <span class='const'>LDAP</span><span class='op'>::</span><span class='const'>ResultError</span><span class='op'>::</span><span class='const'>ObjectClassViolation</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Unknown ObjectClass </span><span class='embexpr_beg'>#{</span><span class='id n'>n</span><span class='period'>.</span><span class='id inspect'>inspect</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id r'>r</span>
1067
+ <span class='id r'>r</span>
1068
+ <span class='kw'>end</span></pre>
1069
+ </td>
1070
+ </tr>
1071
+ </table>
1072
+ </div>
1073
+
1074
+ <div class="method_details ">
1075
+ <p class="signature " id="load-instance_method">
1076
+
1077
+ - (<tt>Object</tt>) <strong>load</strong>(str_or_io)
1078
+
1079
+
1080
+
1081
+ </p><div class="docstring">
1082
+ <div class="discussion">
1083
+ <p>
1084
+ Load an OpenLDAP-format schema from a string or IO object (anything which
1085
+ responds to &#8216;each_line&#8217;). Lines starting
1086
+ &#8216;attributetype&#8217; or &#8216;objectclass&#8217; contain one of
1087
+ those objects. Does not implement named objectIdentifier prefixes (used in
1088
+ the dyngroup.schema file supplied with openldap, but not documented in
1089
+ RFC2252)
1090
+ </p>
1091
+ <p>
1092
+ Note: RFC2252 is strict about the order in which the elements appear, and
1093
+ so are we, but OpenLDAP is not. This means that a schema which works in
1094
+ OpenLDAP might not load here. For example, RFC2252 says that in an
1095
+ objectclass description, &#8220;SUP&#8221; must come before
1096
+ &#8220;MAY&#8221;; if they are the other way round, our regexp-based parser
1097
+ will not accept it. The solution is simply to modify the definition so that
1098
+ the elements appear in the correct order.
1099
+ </p>
1100
+
1101
+
1102
+ </div>
1103
+ </div>
1104
+ <div class="tags">
1105
+
1106
+ </div><table class="source_code">
1107
+ <tr>
1108
+ <td>
1109
+ <pre class="lines">
1110
+
1111
+
1112
+ 121
1113
+ 122
1114
+ 123
1115
+ 124
1116
+ 125
1117
+ 126
1118
+ 127
1119
+ 128
1120
+ 129
1121
+ 130
1122
+ 131
1123
+ 132
1124
+ 133
1125
+ 134
1126
+ 135
1127
+ 136
1128
+ 137
1129
+ 138
1130
+ 139
1131
+ 140
1132
+ 141
1133
+ 142</pre>
1134
+ </td>
1135
+ <td>
1136
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/schema.rb', line 121</span>
1137
+
1138
+ <span class='kw'>def</span> <span class='id load'>load</span><span class='lparen'>(</span><span class='id str_or_io'>str_or_io</span><span class='rparen'>)</span>
1139
+ <span class='id meth'>meth</span> <span class='op'>=</span> <span class='symbol'>:junk_line</span>
1140
+ <span class='id data'>data</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span>
1141
+ <span class='id str_or_io'>str_or_io</span><span class='period'>.</span><span class='id each_line'>each_line</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id line'>line</span><span class='op'>|</span>
1142
+ <span class='kw'>case</span> <span class='id line'>line</span>
1143
+ <span class='kw'>when</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^\s*#</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^\s*$</span><span class='regexp_end'>/</span></span>
1144
+ <span class='kw'>next</span>
1145
+ <span class='kw'>when</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^objectclass\s*(.*)$</span><span class='regexp_end'>/i</span></span>
1146
+ <span class='id m'>m</span> <span class='op'>=</span> <span class='gvar'>$~</span>
1147
+ <span class='id send'>send</span><span class='lparen'>(</span><span class='id meth'>meth</span><span class='comma'>,</span> <span class='id data'>data</span><span class='rparen'>)</span>
1148
+ <span class='id meth'>meth</span><span class='comma'>,</span> <span class='id data'>data</span> <span class='op'>=</span> <span class='symbol'>:add_objectclass</span><span class='comma'>,</span> <span class='id m'>m</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
1149
+ <span class='kw'>when</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^attributetype\s*(.*)$</span><span class='regexp_end'>/i</span></span>
1150
+ <span class='id m'>m</span> <span class='op'>=</span> <span class='gvar'>$~</span>
1151
+ <span class='id send'>send</span><span class='lparen'>(</span><span class='id meth'>meth</span><span class='comma'>,</span> <span class='id data'>data</span><span class='rparen'>)</span>
1152
+ <span class='id meth'>meth</span><span class='comma'>,</span> <span class='id data'>data</span> <span class='op'>=</span> <span class='symbol'>:add_attrtype</span><span class='comma'>,</span> <span class='id m'>m</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
1153
+ <span class='kw'>else</span>
1154
+ <span class='id data'>data</span> <span class='op'>&lt;&lt;</span> <span class='id line'>line</span>
1155
+ <span class='kw'>end</span>
1156
+ <span class='kw'>end</span>
1157
+ <span class='id send'>send</span><span class='lparen'>(</span><span class='id meth'>meth</span><span class='comma'>,</span><span class='id data'>data</span><span class='rparen'>)</span>
1158
+ <span class='kw'>self</span>
1159
+ <span class='kw'>end</span></pre>
1160
+ </td>
1161
+ </tr>
1162
+ </table>
1163
+ </div>
1164
+
1165
+ <div class="method_details ">
1166
+ <p class="signature " id="load_file-instance_method">
1167
+
1168
+ - (<tt>Object</tt>) <strong>load_file</strong>(filename)
1169
+
1170
+
1171
+
1172
+ </p><div class="docstring">
1173
+ <div class="discussion">
1174
+ <p>
1175
+ Load an OpenLDAP-format schema from a named file (see notes under
1176
+ &#8216;load&#8217;)
1177
+ </p>
1178
+
1179
+
1180
+ </div>
1181
+ </div>
1182
+ <div class="tags">
1183
+
1184
+ </div><table class="source_code">
1185
+ <tr>
1186
+ <td>
1187
+ <pre class="lines">
1188
+
1189
+
1190
+ 103
1191
+ 104
1192
+ 105</pre>
1193
+ </td>
1194
+ <td>
1195
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/schema.rb', line 103</span>
1196
+
1197
+ <span class='kw'>def</span> <span class='id load_file'>load_file</span><span class='lparen'>(</span><span class='id filename'>filename</span><span class='rparen'>)</span>
1198
+ <span class='const'>File</span><span class='period'>.</span><span class='id open'>open</span><span class='lparen'>(</span><span class='id filename'>filename</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id f'>f</span><span class='op'>|</span> <span class='id load'>load</span><span class='lparen'>(</span><span class='id f'>f</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
1199
+ <span class='kw'>end</span></pre>
1200
+ </td>
1201
+ </tr>
1202
+ </table>
1203
+ </div>
1204
+
1205
+ <div class="method_details ">
1206
+ <p class="signature " id="load_system-instance_method">
1207
+
1208
+ - (<tt>Object</tt>) <strong>load_system</strong>
1209
+
1210
+
1211
+
1212
+ </p><div class="docstring">
1213
+ <div class="discussion">
1214
+ <p>
1215
+ Load in the base set of objectclasses and attributetypes, being the same
1216
+ set as OpenLDAP preloads internally. Includes objectclasses
1217
+ &#8216;top&#8217;, &#8216;objectclass&#8217;; attributetypes
1218
+ &#8216;objectclass&#8217; , &#8216;cn&#8217;, &#8216;userPassword&#8217;
1219
+ and &#8216;distinguishedName&#8217;; common operational attributes such as
1220
+ &#8216;modifyTimestamp&#8217;; plus extras needed for publishing a v3
1221
+ schema via LDAP
1222
+ </p>
1223
+
1224
+
1225
+ </div>
1226
+ </div>
1227
+ <div class="tags">
1228
+
1229
+ </div><table class="source_code">
1230
+ <tr>
1231
+ <td>
1232
+ <pre class="lines">
1233
+
1234
+
1235
+ 158
1236
+ 159
1237
+ 160
1238
+ 161
1239
+ 162
1240
+ 163
1241
+ 164
1242
+ 165
1243
+ 166
1244
+ 167
1245
+ 168
1246
+ 169
1247
+ 170
1248
+ 171
1249
+ 172
1250
+ 173
1251
+ 174
1252
+ 175
1253
+ 176
1254
+ 177
1255
+ 178
1256
+ 179
1257
+ 180
1258
+ 181
1259
+ 182
1260
+ 183
1261
+ 184
1262
+ 185
1263
+ 186
1264
+ 187
1265
+ 188
1266
+ 189
1267
+ 190
1268
+ 191
1269
+ 192
1270
+ 193
1271
+ 194
1272
+ 195
1273
+ 196
1274
+ 197
1275
+ 198
1276
+ 199
1277
+ 200
1278
+ 201
1279
+ 202
1280
+ 203</pre>
1281
+ </td>
1282
+ <td>
1283
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/schema.rb', line 158</span>
1284
+
1285
+ <span class='kw'>def</span> <span class='id load_system'>load_system</span>
1286
+ <span class='id load'>load</span><span class='lparen'>(</span><span class='heredoc_beg'>&lt;&lt;EOS</span><span class='tstring_content'>attributetype ( 1.3.6.1.4.1.250.1.57 NAME 'labeledURI' DESC 'RFC2079: Uniform Resource Identifier with optional label' EQUALITY caseExactMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
1287
+ attributetype ( 2.5.4.35 NAME 'userPassword' DESC 'RFC2256/2307: password of user' EQUALITY octetStringMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{128} )
1288
+ attributetype ( 2.5.4.3 NAME ( 'cn' 'commonName' ) DESC 'RFC2256: common name(s) for which the entity is known by' SUP name )
1289
+ attributetype ( 2.5.4.41 NAME 'name' DESC 'RFC2256: common supertype of name attributes' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} )
1290
+ attributetype ( 2.5.4.49 NAME 'distinguishedName' DESC 'RFC2256: common supertype of DN attributes' EQUALITY distinguishedNameMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
1291
+ attributetype ( 2.16.840.1.113730.3.1.34 NAME 'ref' DESC 'namedref: subordinate referral URL' EQUALITY caseExactMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 USAGE distributedOperation )
1292
+ attributetype ( 2.5.4.1 NAME ( 'aliasedObjectName' 'aliasedEntryName' ) DESC 'RFC2256: name of aliased object' EQUALITY distinguishedNameMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE )
1293
+ attributetype ( 1.3.6.1.4.1.1466.101.120.16 NAME 'ldapSyntaxes' DESC 'RFC2252: LDAP syntaxes' EQUALITY objectIdentifierFirstComponentMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.54 USAGE directoryOperation )
1294
+ attributetype ( 2.5.21.8 NAME 'matchingRuleUse' DESC 'RFC2252: matching rule uses' EQUALITY objectIdentifierFirstComponentMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.31 USAGE directoryOperation )
1295
+ attributetype ( 2.5.21.6 NAME 'objectClasses' DESC 'RFC2252: object classes' EQUALITY objectIdentifierFirstComponentMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.37 USAGE directoryOperation )
1296
+ attributetype ( 2.5.21.5 NAME 'attributeTypes' DESC 'RFC2252: attribute types' EQUALITY objectIdentifierFirstComponentMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.3 USAGE directoryOperation )
1297
+ attributetype ( 2.5.21.4 NAME 'matchingRules' DESC 'RFC2252: matching rules' EQUALITY objectIdentifierFirstComponentMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.30 USAGE directoryOperation )
1298
+ attributetype ( 1.3.6.1.1.5 NAME 'vendorVersion' DESC 'RFC3045: version of implementation' EQUALITY caseExactMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE NO-USER-MODIFICATION USAGE dSAOperation )
1299
+ attributetype ( 1.3.6.1.1.4 NAME 'vendorName' DESC 'RFC3045: name of implementation vendor' EQUALITY caseExactMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE NO-USER-MODIFICATION USAGE dSAOperation )
1300
+ attributetype ( 1.3.6.1.4.1.4203.1.3.5 NAME 'supportedFeatures' DESC 'features supported by the server' EQUALITY objectIdentifierMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 USAGE dSAOperation )
1301
+ attributetype ( 1.3.6.1.4.1.1466.101.120.14 NAME 'supportedSASLMechanisms' DESC 'RFC2252: supported SASL mechanisms' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 USAGE dSAOperation )
1302
+ attributetype ( 1.3.6.1.4.1.1466.101.120.15 NAME 'supportedLDAPVersion' DESC 'RFC2252: supported LDAP versions' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 USAGE dSAOperation )
1303
+ attributetype ( 1.3.6.1.4.1.1466.101.120.7 NAME 'supportedExtension' DESC 'RFC2252: supported extended operations' SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 USAGE dSAOperation )
1304
+ attributetype ( 1.3.6.1.4.1.1466.101.120.13 NAME 'supportedControl' DESC 'RFC2252: supported controls' SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 USAGE dSAOperation )
1305
+ attributetype ( 1.3.6.1.4.1.1466.101.120.5 NAME 'namingContexts' DESC 'RFC2252: naming contexts' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 USAGE dSAOperation )
1306
+ attributetype ( 1.3.6.1.4.1.1466.101.120.6 NAME 'altServer' DESC 'RFC2252: alternative servers' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 USAGE dSAOperation )
1307
+ attributetype ( 2.5.18.10 NAME 'subschemaSubentry' DESC 'RFC2252: name of controlling subschema entry' EQUALITY distinguishedNameMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )
1308
+ attributetype ( 2.5.18.9 NAME 'hasSubordinates' DESC 'X.501: entry has children' EQUALITY booleanMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )
1309
+ attributetype ( 2.5.18.4 NAME 'modifiersName' DESC 'RFC2252: name of last modifier' EQUALITY distinguishedNameMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )
1310
+ attributetype ( 2.5.18.3 NAME 'creatorsName' DESC 'RFC2252: name of creator' EQUALITY distinguishedNameMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )
1311
+ attributetype ( 2.5.18.2 NAME 'modifyTimestamp' DESC 'RFC2252: time which object was last modified' EQUALITY generalizedTimeMatch ORDERING generalizedTimeOrderingMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )
1312
+ attributetype ( 2.5.18.1 NAME 'createTimestamp' DESC 'RFC2252: time which object was created' EQUALITY generalizedTimeMatch ORDERING generalizedTimeOrderingMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )
1313
+ attributetype ( 2.5.21.9 NAME 'structuralObjectClass' DESC 'X.500(93): structural object class of entry' EQUALITY objectIdentifierMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )
1314
+ attributetype ( 2.5.4.0 NAME 'objectClass' DESC 'RFC2256: object classes of the entity' EQUALITY objectIdentifierMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )
1315
+ # These ones aren't published by OpenLDAP, but are referenced by the 'subschema' objectclass
1316
+ attributetype ( 2.5.21.1 NAME 'dITStructureRules' EQUALITY integerFirstComponentMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.17 USAGE directoryOperation )
1317
+ attributetype ( 2.5.21.7 NAME 'nameForms' EQUALITY objectIdentifierFirstComponentMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.35 USAGE directoryOperation )
1318
+ attributetype ( 2.5.21.2 NAME 'dITContentRules' EQUALITY objectIdentifierFirstComponentMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.16 USAGE directoryOperation )
1319
+
1320
+ objectclass ( 2.5.20.1 NAME 'subschema' DESC 'RFC2252: controlling subschema (sub)entry' AUXILIARY MAY ( dITStructureRules $ nameForms $ ditContentRules $ objectClasses $ attributeTypes $ matchingRules $ matchingRuleUse ) )
1321
+ #Don't have definition for subtreeSpecification:
1322
+ #objectClass ( 2.5.17.0 NAME 'subentry' SUP top STRUCTURAL MUST ( cn $ subtreeSpecification ) )
1323
+ objectClass ( 1.3.6.1.4.1.4203.1.4.1 NAME ( 'OpenLDAProotDSE' 'LDAProotDSE' ) DESC 'OpenLDAP Root DSE object' SUP top STRUCTURAL MAY cn )
1324
+ objectClass ( 2.16.840.1.113730.3.2.6 NAME 'referral' DESC 'namedref: named subordinate referral' SUP top STRUCTURAL MUST ref )
1325
+ objectClass ( 2.5.6.1 NAME 'alias' DESC 'RFC2256: an alias' SUP top STRUCTURAL MUST aliasedObjectName )
1326
+ objectClass ( 1.3.6.1.4.1.1466.101.120.111 NAME 'extensibleObject' DESC 'RFC2252: extensible object' SUP top AUXILIARY )
1327
+ objectClass ( 2.5.6.0 NAME 'top' DESC 'top of the superclass chain' ABSTRACT MUST objectClass )
1328
+ </span><span class='heredoc_end'>EOS
1329
+ </span><span class='rparen'>)</span>
1330
+ <span class='kw'>end</span></pre>
1331
+ </td>
1332
+ </tr>
1333
+ </table>
1334
+ </div>
1335
+
1336
+ <div class="method_details ">
1337
+ <p class="signature " id="may-instance_method">
1338
+
1339
+ - (<tt>Object</tt>) <strong>may</strong>(oc)
1340
+
1341
+
1342
+
1343
+ </p><div class="docstring">
1344
+ <div class="discussion">
1345
+ <p>
1346
+ Backwards-compatible for ruby-ldap LDAP::Schema
1347
+ </p>
1348
+
1349
+
1350
+ </div>
1351
+ </div>
1352
+ <div class="tags">
1353
+
1354
+ </div><table class="source_code">
1355
+ <tr>
1356
+ <td>
1357
+ <pre class="lines">
1358
+
1359
+
1360
+ 435
1361
+ 436
1362
+ 437</pre>
1363
+ </td>
1364
+ <td>
1365
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/schema.rb', line 435</span>
1366
+
1367
+ <span class='kw'>def</span> <span class='id may'>may</span><span class='lparen'>(</span><span class='id oc'>oc</span><span class='rparen'>)</span>
1368
+ <span class='id attr'>attr</span><span class='lparen'>(</span><span class='id oc'>oc</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>MAY</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1369
+ <span class='kw'>end</span></pre>
1370
+ </td>
1371
+ </tr>
1372
+ </table>
1373
+ </div>
1374
+
1375
+ <div class="method_details ">
1376
+ <p class="signature " id="must-instance_method">
1377
+
1378
+ - (<tt>Object</tt>) <strong>must</strong>(oc)
1379
+
1380
+
1381
+
1382
+ </p><div class="docstring">
1383
+ <div class="discussion">
1384
+ <p>
1385
+ Backwards-compatible for ruby-ldap LDAP::Schema
1386
+ </p>
1387
+
1388
+
1389
+ </div>
1390
+ </div>
1391
+ <div class="tags">
1392
+
1393
+ </div><table class="source_code">
1394
+ <tr>
1395
+ <td>
1396
+ <pre class="lines">
1397
+
1398
+
1399
+ 429
1400
+ 430
1401
+ 431</pre>
1402
+ </td>
1403
+ <td>
1404
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/schema.rb', line 429</span>
1405
+
1406
+ <span class='kw'>def</span> <span class='id must'>must</span><span class='lparen'>(</span><span class='id oc'>oc</span><span class='rparen'>)</span>
1407
+ <span class='id attr'>attr</span><span class='lparen'>(</span><span class='id oc'>oc</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>MUST</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1408
+ <span class='kw'>end</span></pre>
1409
+ </td>
1410
+ </tr>
1411
+ </table>
1412
+ </div>
1413
+
1414
+ <div class="method_details ">
1415
+ <p class="signature " id="names-instance_method">
1416
+
1417
+ - (<tt>Object</tt>) <strong>names</strong>(key)
1418
+
1419
+
1420
+
1421
+ </p><div class="docstring">
1422
+ <div class="discussion">
1423
+ <p>
1424
+ Hopefully backwards-compatible API for ruby-ldap&#8217;s LDAP::Schema.
1425
+ Since MUST/MAY/SUP may point to schema objects, convert them back to
1426
+ strings.
1427
+ </p>
1428
+
1429
+
1430
+ </div>
1431
+ </div>
1432
+ <div class="tags">
1433
+
1434
+ </div><table class="source_code">
1435
+ <tr>
1436
+ <td>
1437
+ <pre class="lines">
1438
+
1439
+
1440
+ 391
1441
+ 392
1442
+ 393
1443
+ 394
1444
+ 395
1445
+ 396
1446
+ 397
1447
+ 398
1448
+ 399
1449
+ 400
1450
+ 401
1451
+ 402
1452
+ 403
1453
+ 404</pre>
1454
+ </td>
1455
+ <td>
1456
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/schema.rb', line 391</span>
1457
+
1458
+ <span class='kw'>def</span> <span class='id names'>names</span><span class='lparen'>(</span><span class='id key'>key</span><span class='rparen'>)</span>
1459
+ <span class='kw'>case</span> <span class='id key'>key</span>
1460
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>objectClasses</span><span class='tstring_end'>'</span></span>
1461
+ <span class='kw'>return</span> <span class='id all_objectclasses'>all_objectclasses</span><span class='period'>.</span><span class='id collect'>collect</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id e'>e</span><span class='op'>|</span> <span class='id e'>e</span><span class='period'>.</span><span class='id name'>name</span> <span class='rbrace'>}</span>
1462
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>attributeTypes</span><span class='tstring_end'>'</span></span>
1463
+ <span class='kw'>return</span> <span class='id all_attrtypes'>all_attrtypes</span><span class='period'>.</span><span class='id collect'>collect</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id e'>e</span><span class='op'>|</span> <span class='id e'>e</span><span class='period'>.</span><span class='id name'>name</span> <span class='rbrace'>}</span>
1464
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>ldapSyntaxes</span><span class='tstring_end'>'</span></span>
1465
+ <span class='kw'>return</span> <span class='const'>LDAP</span><span class='op'>::</span><span class='const'>Server</span><span class='op'>::</span><span class='const'>Syntax</span><span class='period'>.</span><span class='id all_syntaxes'>all_syntaxes</span><span class='period'>.</span><span class='id collect'>collect</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id e'>e</span><span class='op'>|</span> <span class='id e'>e</span><span class='period'>.</span><span class='id name'>name</span> <span class='rbrace'>}</span>
1466
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>matchingRules</span><span class='tstring_end'>'</span></span>
1467
+ <span class='kw'>return</span> <span class='const'>LDAP</span><span class='op'>::</span><span class='const'>Server</span><span class='op'>::</span><span class='const'>MatchingRule</span><span class='period'>.</span><span class='id all_matching_rules'>all_matching_rules</span><span class='period'>.</span><span class='id collect'>collect</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id e'>e</span><span class='op'>|</span> <span class='id e'>e</span><span class='period'>.</span><span class='id name'>name</span> <span class='rbrace'>}</span>
1468
+ <span class='comment'># TODO: matchingRuleUse
1469
+ </span> <span class='kw'>end</span>
1470
+ <span class='kw'>return</span> <span class='kw'>nil</span>
1471
+ <span class='kw'>end</span></pre>
1472
+ </td>
1473
+ </tr>
1474
+ </table>
1475
+ </div>
1476
+
1477
+ <div class="method_details ">
1478
+ <p class="signature " id="resolve_oids-instance_method">
1479
+
1480
+ - (<tt>Object</tt>) <strong>resolve_oids</strong>
1481
+
1482
+
1483
+
1484
+ </p><div class="docstring">
1485
+ <div class="discussion">
1486
+ <p>
1487
+ After loading object classes and attr types: resolve oid strings to point
1488
+ to objects. This will expose schema inconsistencies (e.g. objectclass has
1489
+ unknown SUP class or points to unknown attributeType). However, unknown
1490
+ Syntaxes just create new Syntax objects.
1491
+ </p>
1492
+
1493
+
1494
+ </div>
1495
+ </div>
1496
+ <div class="tags">
1497
+
1498
+ </div><table class="source_code">
1499
+ <tr>
1500
+ <td>
1501
+ <pre class="lines">
1502
+
1503
+
1504
+ 210
1505
+ 211
1506
+ 212
1507
+ 213
1508
+ 214
1509
+ 215
1510
+ 216
1511
+ 217
1512
+ 218
1513
+ 219
1514
+ 220
1515
+ 221
1516
+ 222
1517
+ 223
1518
+ 224
1519
+ 225
1520
+ 226
1521
+ 227
1522
+ 228
1523
+ 229
1524
+ 230
1525
+ 231
1526
+ 232
1527
+ 233
1528
+ 234
1529
+ 235
1530
+ 236
1531
+ 237
1532
+ 238
1533
+ 239
1534
+ 240
1535
+ 241
1536
+ 242
1537
+ 243
1538
+ 244
1539
+ 245
1540
+ 246
1541
+ 247
1542
+ 248
1543
+ 249
1544
+ 250
1545
+ 251
1546
+ 252</pre>
1547
+ </td>
1548
+ <td>
1549
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/schema.rb', line 210</span>
1550
+
1551
+ <span class='kw'>def</span> <span class='id resolve_oids'>resolve_oids</span>
1552
+
1553
+ <span class='id all_attrtypes'>all_attrtypes</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id a'>a</span><span class='op'>|</span>
1554
+ <span class='kw'>if</span> <span class='id a'>a</span><span class='period'>.</span><span class='id sup'>sup</span>
1555
+ <span class='id s'>s</span> <span class='op'>=</span> <span class='id find_attrtype'>find_attrtype</span><span class='lparen'>(</span><span class='id a'>a</span><span class='period'>.</span><span class='id sup'>sup</span><span class='rparen'>)</span>
1556
+ <span class='id a'>a</span><span class='period'>.</span><span class='id instance_eval'>instance_eval</span> <span class='lbrace'>{</span>
1557
+ <span class='ivar'>@sup</span> <span class='op'>=</span> <span class='id s'>s</span>
1558
+ <span class='comment'># inherit properties (FIXME: This breaks to_def)
1559
+ </span> <span class='ivar'>@equality</span> <span class='op'>||=</span> <span class='id s'>s</span><span class='period'>.</span><span class='id equality'>equality</span>
1560
+ <span class='ivar'>@ordering</span> <span class='op'>||=</span> <span class='id s'>s</span><span class='period'>.</span><span class='id ordering'>ordering</span>
1561
+ <span class='ivar'>@substr</span> <span class='op'>||=</span> <span class='id s'>s</span><span class='period'>.</span><span class='id substr'>substr</span>
1562
+ <span class='ivar'>@syntax</span> <span class='op'>||=</span> <span class='id s'>s</span><span class='period'>.</span><span class='id syntax'>syntax</span>
1563
+ <span class='ivar'>@maxlen</span> <span class='op'>||=</span> <span class='id s'>s</span><span class='period'>.</span><span class='id maxlen'>maxlen</span>
1564
+ <span class='ivar'>@singlevalue</span> <span class='op'>||=</span> <span class='id s'>s</span><span class='period'>.</span><span class='id singlevalue'>singlevalue</span>
1565
+ <span class='ivar'>@collective</span> <span class='op'>||=</span> <span class='id s'>s</span><span class='period'>.</span><span class='id collective'>collective</span>
1566
+ <span class='ivar'>@nousermod</span> <span class='op'>||=</span> <span class='id s'>s</span><span class='period'>.</span><span class='id nousermod'>nousermod</span>
1567
+ <span class='ivar'>@usage</span> <span class='op'>||=</span> <span class='id s'>s</span><span class='period'>.</span><span class='id usage'>usage</span>
1568
+ <span class='rbrace'>}</span>
1569
+ <span class='kw'>end</span>
1570
+ <span class='id a'>a</span><span class='period'>.</span><span class='id instance_eval'>instance_eval</span> <span class='kw'>do</span>
1571
+ <span class='ivar'>@syntax</span> <span class='op'>=</span> <span class='const'>LDAP</span><span class='op'>::</span><span class='const'>Server</span><span class='op'>::</span><span class='const'>Syntax</span><span class='period'>.</span><span class='id find'>find</span><span class='lparen'>(</span><span class='ivar'>@syntax</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@syntax</span>
1572
+ <span class='ivar'>@equality</span> <span class='op'>=</span> <span class='const'>LDAP</span><span class='op'>::</span><span class='const'>Server</span><span class='op'>::</span><span class='const'>MatchingRule</span><span class='period'>.</span><span class='id find'>find</span><span class='lparen'>(</span><span class='ivar'>@equality</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@equality</span>
1573
+ <span class='ivar'>@ordering</span> <span class='op'>=</span> <span class='const'>LDAP</span><span class='op'>::</span><span class='const'>Server</span><span class='op'>::</span><span class='const'>MatchingRule</span><span class='period'>.</span><span class='id find'>find</span><span class='lparen'>(</span><span class='ivar'>@ordering</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@ordering</span>
1574
+ <span class='ivar'>@substr</span> <span class='op'>=</span> <span class='const'>LDAP</span><span class='op'>::</span><span class='const'>Server</span><span class='op'>::</span><span class='const'>MatchingRule</span><span class='period'>.</span><span class='id find'>find</span><span class='lparen'>(</span><span class='ivar'>@substr</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@substr</span>
1575
+ <span class='kw'>end</span>
1576
+ <span class='kw'>end</span>
1577
+
1578
+ <span class='id all_objectclasses'>all_objectclasses</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id o'>o</span><span class='op'>|</span>
1579
+ <span class='kw'>if</span> <span class='id o'>o</span><span class='period'>.</span><span class='id sup'>sup</span>
1580
+ <span class='id s'>s</span> <span class='op'>=</span> <span class='id o'>o</span><span class='period'>.</span><span class='id sup'>sup</span><span class='period'>.</span><span class='id collect'>collect</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id ss'>ss</span><span class='op'>|</span> <span class='id find_objectclass'>find_objectclass</span><span class='lparen'>(</span><span class='id ss'>ss</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
1581
+ <span class='id o'>o</span><span class='period'>.</span><span class='id instance_eval'>instance_eval</span> <span class='lbrace'>{</span> <span class='ivar'>@sup</span> <span class='op'>=</span> <span class='id s'>s</span> <span class='rbrace'>}</span>
1582
+ <span class='kw'>end</span>
1583
+ <span class='kw'>if</span> <span class='id o'>o</span><span class='period'>.</span><span class='id must'>must</span>
1584
+ <span class='id s'>s</span> <span class='op'>=</span> <span class='id o'>o</span><span class='period'>.</span><span class='id must'>must</span><span class='period'>.</span><span class='id collect'>collect</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id ss'>ss</span><span class='op'>|</span> <span class='id find_attrtype'>find_attrtype</span><span class='lparen'>(</span><span class='id ss'>ss</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
1585
+ <span class='id o'>o</span><span class='period'>.</span><span class='id instance_eval'>instance_eval</span> <span class='lbrace'>{</span> <span class='ivar'>@must</span> <span class='op'>=</span> <span class='id s'>s</span> <span class='rbrace'>}</span>
1586
+ <span class='kw'>end</span>
1587
+ <span class='kw'>if</span> <span class='id o'>o</span><span class='period'>.</span><span class='id may'>may</span>
1588
+ <span class='id s'>s</span> <span class='op'>=</span> <span class='id o'>o</span><span class='period'>.</span><span class='id may'>may</span><span class='period'>.</span><span class='id collect'>collect</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id ss'>ss</span><span class='op'>|</span> <span class='id find_attrtype'>find_attrtype</span><span class='lparen'>(</span><span class='id ss'>ss</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
1589
+ <span class='id o'>o</span><span class='period'>.</span><span class='id instance_eval'>instance_eval</span> <span class='lbrace'>{</span> <span class='ivar'>@may</span> <span class='op'>=</span> <span class='id s'>s</span> <span class='rbrace'>}</span>
1590
+ <span class='kw'>end</span>
1591
+ <span class='kw'>end</span>
1592
+
1593
+ <span class='kw'>end</span></pre>
1594
+ </td>
1595
+ </tr>
1596
+ </table>
1597
+ </div>
1598
+
1599
+ <div class="method_details ">
1600
+ <p class="signature " id="subschema_dn-instance_method">
1601
+
1602
+ - (<tt>Object</tt>) <strong>subschema_dn</strong>
1603
+
1604
+
1605
+
1606
+ </p><div class="docstring">
1607
+ <div class="discussion">
1608
+ <p>
1609
+ return the DN of the subschema subentry
1610
+ </p>
1611
+
1612
+
1613
+ </div>
1614
+ </div>
1615
+ <div class="tags">
1616
+
1617
+ </div><table class="source_code">
1618
+ <tr>
1619
+ <td>
1620
+ <pre class="lines">
1621
+
1622
+
1623
+ 25
1624
+ 26
1625
+ 27</pre>
1626
+ </td>
1627
+ <td>
1628
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/schema.rb', line 25</span>
1629
+
1630
+ <span class='kw'>def</span> <span class='id subschema_dn'>subschema_dn</span>
1631
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='const'>SUBSCHEMA_ENTRY_ATTR</span><span class='rbrace'>}</span><span class='tstring_content'>=</span><span class='embexpr_beg'>#{</span><span class='const'>SUBSCHEMA_ENTRY_VALUE</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
1632
+ <span class='kw'>end</span></pre>
1633
+ </td>
1634
+ </tr>
1635
+ </table>
1636
+ </div>
1637
+
1638
+ <div class="method_details ">
1639
+ <p class="signature " id="subschema_subentry-instance_method">
1640
+
1641
+ - (<tt>Object</tt>) <strong>subschema_subentry</strong>
1642
+
1643
+
1644
+
1645
+ </p><div class="docstring">
1646
+ <div class="discussion">
1647
+ <p>
1648
+ Return an av hash object giving the subschema subentry. This is cached, so
1649
+ call Schema#changed if it needs to be rebuilt
1650
+ </p>
1651
+
1652
+
1653
+ </div>
1654
+ </div>
1655
+ <div class="tags">
1656
+
1657
+ </div><table class="source_code">
1658
+ <tr>
1659
+ <td>
1660
+ <pre class="lines">
1661
+
1662
+
1663
+ 32
1664
+ 33
1665
+ 34
1666
+ 35
1667
+ 36
1668
+ 37
1669
+ 38
1670
+ 39
1671
+ 40
1672
+ 41
1673
+ 42</pre>
1674
+ </td>
1675
+ <td>
1676
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/schema.rb', line 32</span>
1677
+
1678
+ <span class='kw'>def</span> <span class='id subschema_subentry'>subschema_subentry</span>
1679
+ <span class='ivar'>@subschema_cache</span> <span class='op'>||=</span> <span class='lbrace'>{</span>
1680
+ <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>objectClass</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>top</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>subschema</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>extensibleObject</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
1681
+ <span class='const'>SUBSCHEMA_ENTRY_ATTR</span> <span class='op'>=&gt;</span> <span class='lbracket'>[</span><span class='const'>SUBSCHEMA_ENTRY_VALUE</span><span class='rbracket'>]</span><span class='comma'>,</span>
1682
+ <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>objectClasses</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='id all_objectclasses'>all_objectclasses</span><span class='period'>.</span><span class='id collect'>collect</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id s'>s</span><span class='op'>|</span> <span class='id s'>s</span><span class='period'>.</span><span class='id to_def'>to_def</span> <span class='rbrace'>}</span><span class='comma'>,</span>
1683
+ <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>attributeTypes</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='id all_attrtypes'>all_attrtypes</span><span class='period'>.</span><span class='id collect'>collect</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id s'>s</span><span class='op'>|</span> <span class='id s'>s</span><span class='period'>.</span><span class='id to_def'>to_def</span> <span class='rbrace'>}</span><span class='comma'>,</span>
1684
+ <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>ldapSyntaxes</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='const'>LDAP</span><span class='op'>::</span><span class='const'>Server</span><span class='op'>::</span><span class='const'>Syntax</span><span class='period'>.</span><span class='id all_syntaxes'>all_syntaxes</span><span class='period'>.</span><span class='id collect'>collect</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id s'>s</span><span class='op'>|</span> <span class='id s'>s</span><span class='period'>.</span><span class='id to_def'>to_def</span> <span class='rbrace'>}</span><span class='comma'>,</span>
1685
+ <span class='comment'>#'matchingRules' =&gt;
1686
+ </span> <span class='comment'>#'matchingRuleUse' =&gt;
1687
+ </span> <span class='rbrace'>}</span>
1688
+ <span class='kw'>end</span></pre>
1689
+ </td>
1690
+ </tr>
1691
+ </table>
1692
+ </div>
1693
+
1694
+ <div class="method_details ">
1695
+ <p class="signature " id="sup-instance_method">
1696
+
1697
+ - (<tt>Object</tt>) <strong>sup</strong>(oc)
1698
+
1699
+
1700
+
1701
+ </p><div class="docstring">
1702
+ <div class="discussion">
1703
+ <p>
1704
+ Backwards-compatible for ruby-ldap LDAP::Schema
1705
+ </p>
1706
+
1707
+
1708
+ </div>
1709
+ </div>
1710
+ <div class="tags">
1711
+
1712
+ </div><table class="source_code">
1713
+ <tr>
1714
+ <td>
1715
+ <pre class="lines">
1716
+
1717
+
1718
+ 441
1719
+ 442
1720
+ 443</pre>
1721
+ </td>
1722
+ <td>
1723
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/schema.rb', line 441</span>
1724
+
1725
+ <span class='kw'>def</span> <span class='id sup'>sup</span><span class='lparen'>(</span><span class='id oc'>oc</span><span class='rparen'>)</span>
1726
+ <span class='id attr'>attr</span><span class='lparen'>(</span><span class='id oc'>oc</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>SUP</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1727
+ <span class='kw'>end</span></pre>
1728
+ </td>
1729
+ </tr>
1730
+ </table>
1731
+ </div>
1732
+
1733
+ <div class="method_details ">
1734
+ <p class="signature " id="validate-instance_method">
1735
+
1736
+ - (<tt>Object</tt>) <strong>validate</strong>(mods, entry = {})
1737
+
1738
+
1739
+
1740
+ </p><div class="docstring">
1741
+ <div class="discussion">
1742
+ <p>
1743
+ Validate a new entry or update. For a new entry, just pass a hash of
1744
+ attr=>[val, val, &#8230;]; for an update, the first parameter is a hash of
1745
+ attr=>[:modtype, val, val&#8230;] and the second parameter is the existing
1746
+ entry, where it is assumed that the attribute names are already in their
1747
+ standard string forms (as returned by attr#name)
1748
+ </p>
1749
+ <p>
1750
+ Returns a hash containing the updated entry.
1751
+ </p>
1752
+ <p>
1753
+ If a block is given, it is called to decide whether the user is allowed to
1754
+ update an attribute; parameter is the attr <b>object</b> (not name; use
1755
+ #name if you need its name instead). Return false if the update is not
1756
+ permitted. Otherwise, the only restriction will be that updates to
1757
+ attributes declared &#8216;nousermod&#8217; are forbidden.
1758
+ </p>
1759
+ <p>
1760
+ No DN checks are done here, since we don&#8217;t know the DN. Checking that
1761
+ the entry contains an attribute for the RDN is the responsibility of the
1762
+ caller.
1763
+ </p>
1764
+
1765
+
1766
+ </div>
1767
+ </div>
1768
+ <div class="tags">
1769
+
1770
+ </div><table class="source_code">
1771
+ <tr>
1772
+ <td>
1773
+ <pre class="lines">
1774
+
1775
+
1776
+ 272
1777
+ 273
1778
+ 274
1779
+ 275
1780
+ 276
1781
+ 277
1782
+ 278
1783
+ 279
1784
+ 280
1785
+ 281
1786
+ 282
1787
+ 283
1788
+ 284
1789
+ 285
1790
+ 286
1791
+ 287
1792
+ 288
1793
+ 289
1794
+ 290
1795
+ 291
1796
+ 292
1797
+ 293
1798
+ 294
1799
+ 295
1800
+ 296
1801
+ 297
1802
+ 298
1803
+ 299
1804
+ 300
1805
+ 301
1806
+ 302
1807
+ 303
1808
+ 304
1809
+ 305
1810
+ 306
1811
+ 307
1812
+ 308
1813
+ 309
1814
+ 310
1815
+ 311
1816
+ 312
1817
+ 313
1818
+ 314
1819
+ 315
1820
+ 316
1821
+ 317
1822
+ 318
1823
+ 319
1824
+ 320
1825
+ 321
1826
+ 322
1827
+ 323
1828
+ 324
1829
+ 325
1830
+ 326
1831
+ 327
1832
+ 328
1833
+ 329
1834
+ 330
1835
+ 331
1836
+ 332
1837
+ 333
1838
+ 334
1839
+ 335
1840
+ 336
1841
+ 337
1842
+ 338
1843
+ 339
1844
+ 340
1845
+ 341
1846
+ 342
1847
+ 343
1848
+ 344
1849
+ 345
1850
+ 346
1851
+ 347
1852
+ 348
1853
+ 349
1854
+ 350
1855
+ 351
1856
+ 352
1857
+ 353
1858
+ 354
1859
+ 355
1860
+ 356
1861
+ 357
1862
+ 358
1863
+ 359
1864
+ 360
1865
+ 361
1866
+ 362
1867
+ 363
1868
+ 364
1869
+ 365
1870
+ 366
1871
+ 367
1872
+ 368
1873
+ 369
1874
+ 370
1875
+ 371
1876
+ 372
1877
+ 373
1878
+ 374
1879
+ 375
1880
+ 376
1881
+ 377
1882
+ 378
1883
+ 379
1884
+ 380
1885
+ 381
1886
+ 382
1887
+ 383
1888
+ 384
1889
+ 385</pre>
1890
+ </td>
1891
+ <td>
1892
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/schema.rb', line 272</span>
1893
+
1894
+ <span class='kw'>def</span> <span class='id validate'>validate</span><span class='lparen'>(</span><span class='id mods'>mods</span><span class='comma'>,</span> <span class='id entry'>entry</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
1895
+
1896
+ <span class='comment'># Run through the mods, make the normalized names, and perform any
1897
+ </span> <span class='comment'># updates
1898
+ </span>
1899
+ <span class='comment'># FIXME: I don't know if these are the right results to return
1900
+ </span> <span class='comment'># for the various types of validation errors
1901
+ </span>
1902
+ <span class='id oc_changed'>oc_changed</span> <span class='op'>=</span> <span class='kw'>false</span>
1903
+ <span class='id res'>res</span> <span class='op'>=</span> <span class='id entry'>entry</span><span class='period'>.</span><span class='id dup'>dup</span>
1904
+ <span class='id mods'>mods</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id attrname'>attrname</span><span class='comma'>,</span> <span class='id nv'>nv</span><span class='op'>|</span>
1905
+ <span class='id attr'>attr</span> <span class='op'>=</span> <span class='id find_attrtype'>find_attrtype</span><span class='lparen'>(</span><span class='id attrname'>attrname</span><span class='rparen'>)</span>
1906
+ <span class='id attrname'>attrname</span> <span class='op'>=</span> <span class='id attr'>attr</span><span class='period'>.</span><span class='id to_s'>to_s</span>
1907
+ <span class='id raise'>raise</span> <span class='const'>LDAP</span><span class='op'>::</span><span class='const'>ResultError</span><span class='op'>::</span><span class='const'>ConstraintViolation</span><span class='comma'>,</span>
1908
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Cannot modify </span><span class='embexpr_beg'>#{</span><span class='id attrname'>attrname</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id attr'>attr</span><span class='period'>.</span><span class='id nousermod'>nousermod</span> <span class='kw'>or</span>
1909
+ <span class='lparen'>(</span><span class='id block_given?'>block_given?</span> <span class='kw'>and</span> <span class='op'>!</span><span class='kw'>yield</span><span class='lparen'>(</span><span class='id attr'>attr</span><span class='rparen'>)</span><span class='rparen'>)</span>
1910
+ <span class='comment'># Perform the update
1911
+ </span> <span class='id vals'>vals</span> <span class='op'>=</span> <span class='id res'>res</span><span class='lbracket'>[</span><span class='id attrname'>attrname</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
1912
+ <span class='id checkvals'>checkvals</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
1913
+ <span class='id nv'>nv</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id nv'>nv</span><span class='rbracket'>]</span> <span class='kw'>unless</span> <span class='id nv'>nv</span><span class='period'>.</span><span class='id is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Array</span><span class='rparen'>)</span>
1914
+
1915
+ <span class='kw'>case</span> <span class='id nv'>nv</span><span class='period'>.</span><span class='id first'>first</span>
1916
+ <span class='kw'>when</span> <span class='symbol'>:add</span>
1917
+ <span class='id checkvals'>checkvals</span> <span class='op'>=</span> <span class='id nv'>nv</span><span class='lbracket'>[</span><span class='int'>1</span><span class='op'>..</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span>
1918
+ <span class='id vals'>vals</span> <span class='op'>+=</span> <span class='id checkvals'>checkvals</span>
1919
+ <span class='id vals'>vals</span><span class='period'>.</span><span class='id uniq!'>uniq!</span> <span class='comment'># FIXME: ?? error if duplicate values
1920
+ </span> <span class='comment'># FIXME: normalize values? e.g. c: gb and c: GB are same value.
1921
+ </span> <span class='kw'>when</span> <span class='symbol'>:delete</span>
1922
+ <span class='id nv'>nv</span> <span class='op'>=</span> <span class='id nv'>nv</span><span class='lbracket'>[</span><span class='int'>1</span><span class='op'>..</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span>
1923
+ <span class='kw'>if</span> <span class='id nv'>nv</span><span class='period'>.</span><span class='id empty?'>empty?</span>
1924
+ <span class='id vals'>vals</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='comment'># ?? error if does not exist
1925
+ </span> <span class='kw'>else</span>
1926
+ <span class='id nv'>nv</span><span class='period'>.</span><span class='id each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id v'>v</span><span class='op'>|</span> <span class='id vals'>vals</span><span class='period'>.</span><span class='id delete'>delete</span><span class='lparen'>(</span><span class='id v'>v</span><span class='rparen'>)</span> <span class='rbrace'>}</span> <span class='comment'># ?? error if value missing
1927
+ </span> <span class='kw'>end</span>
1928
+ <span class='kw'>when</span> <span class='symbol'>:replace</span>
1929
+ <span class='id vals'>vals</span> <span class='op'>=</span> <span class='id checkvals'>checkvals</span> <span class='op'>=</span> <span class='id nv'>nv</span><span class='lbracket'>[</span><span class='int'>1</span><span class='op'>..</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span>
1930
+ <span class='kw'>else</span>
1931
+ <span class='id vals'>vals</span> <span class='op'>=</span> <span class='id checkvals'>checkvals</span> <span class='op'>=</span> <span class='id nv'>nv</span>
1932
+ <span class='kw'>end</span>
1933
+ <span class='kw'>if</span> <span class='id vals'>vals</span> <span class='op'>==</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
1934
+ <span class='id res'>res</span><span class='period'>.</span><span class='id delete'>delete</span><span class='lparen'>(</span><span class='id attrname'>attrname</span><span class='rparen'>)</span>
1935
+ <span class='kw'>else</span>
1936
+ <span class='id res'>res</span><span class='lbracket'>[</span><span class='id attrname'>attrname</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id vals'>vals</span>
1937
+ <span class='kw'>end</span>
1938
+
1939
+ <span class='comment'># Attribute validation
1940
+ </span> <span class='id raise'>raise</span> <span class='const'>LDAP</span><span class='op'>::</span><span class='const'>ResultError</span><span class='op'>::</span><span class='const'>ObjectClassViolation</span><span class='comma'>,</span>
1941
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Attribute </span><span class='embexpr_beg'>#{</span><span class='id attr'>attr</span><span class='rbrace'>}</span><span class='tstring_content'> is SINGLE-VALUE</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id attr'>attr</span><span class='period'>.</span><span class='id singlevalue'>singlevalue</span> <span class='kw'>and</span> <span class='id vals'>vals</span><span class='period'>.</span><span class='id size'>size</span> <span class='op'>&gt;</span> <span class='int'>1</span>
1942
+
1943
+ <span class='id checkvals'>checkvals</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id val'>val</span><span class='op'>|</span>
1944
+ <span class='id raise'>raise</span> <span class='const'>LDAP</span><span class='op'>::</span><span class='const'>ResultError</span><span class='op'>::</span><span class='const'>InvalidAttributeSyntax</span><span class='comma'>,</span>
1945
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Nil or empty value for attribute </span><span class='embexpr_beg'>#{</span><span class='id attr'>attr</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id val'>val</span><span class='period'>.</span><span class='id nil?'>nil?</span> <span class='kw'>or</span> <span class='id val'>val</span><span class='period'>.</span><span class='id empty?'>empty?</span>
1946
+ <span class='id raise'>raise</span> <span class='const'>LDAP</span><span class='op'>::</span><span class='const'>ResultError</span><span class='op'>::</span><span class='const'>InvalidAttributeSyntax</span><span class='comma'>,</span>
1947
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Bad value for </span><span class='embexpr_beg'>#{</span><span class='id attr'>attr</span><span class='rbrace'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id val'>val</span><span class='period'>.</span><span class='id inspect'>inspect</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id attr'>attr</span><span class='period'>.</span><span class='id syntax'>syntax</span> <span class='kw'>and</span> <span class='op'>!</span> <span class='id attr'>attr</span><span class='period'>.</span><span class='id syntax'>syntax</span><span class='period'>.</span><span class='id match'>match</span><span class='lparen'>(</span><span class='id val'>val</span><span class='rparen'>)</span>
1948
+ <span class='id raise'>raise</span> <span class='const'>LDAP</span><span class='op'>::</span><span class='const'>ResultError</span><span class='op'>::</span><span class='const'>InvalidAttributeSyntax</span><span class='comma'>,</span>
1949
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Value too long for </span><span class='embexpr_beg'>#{</span><span class='id attr'>attr</span><span class='rbrace'>}</span><span class='tstring_content'> (max </span><span class='embexpr_beg'>#{</span><span class='id attr'>attr</span><span class='period'>.</span><span class='id maxlen'>maxlen</span><span class='rbrace'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id attr'>attr</span><span class='period'>.</span><span class='id maxlen'>maxlen</span> <span class='kw'>and</span> <span class='id val'>val</span><span class='period'>.</span><span class='id length'>length</span> <span class='op'>&gt;</span> <span class='id attr'>attr</span><span class='period'>.</span><span class='id maxlen'>maxlen</span>
1950
+ <span class='kw'>end</span>
1951
+
1952
+ <span class='id oc_changed'>oc_changed</span> <span class='op'>=</span> <span class='kw'>true</span> <span class='kw'>if</span> <span class='id attrname'>attrname</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>objectClass</span><span class='tstring_end'>'</span></span>
1953
+ <span class='kw'>end</span>
1954
+
1955
+ <span class='comment'># Now do objectClass checks
1956
+ </span> <span class='id oc'>oc</span> <span class='op'>=</span> <span class='id res'>res</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>objectClass</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
1957
+ <span class='kw'>unless</span> <span class='id oc'>oc</span>
1958
+ <span class='id raise'>raise</span> <span class='const'>LDAP</span><span class='op'>::</span><span class='const'>ResultError</span><span class='op'>::</span><span class='const'>ObjectClassViolation</span><span class='comma'>,</span>
1959
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>objectClass attribute missing</span><span class='tstring_end'>&quot;</span></span>
1960
+ <span class='kw'>end</span>
1961
+ <span class='id oc'>oc</span> <span class='op'>=</span> <span class='id oc'>oc</span><span class='period'>.</span><span class='id collect'>collect</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id val'>val</span><span class='op'>|</span> <span class='id find_objectclass'>find_objectclass</span><span class='lparen'>(</span><span class='id val'>val</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
1962
+
1963
+ <span class='kw'>if</span> <span class='id oc_changed'>oc_changed</span>
1964
+ <span class='comment'># Add superior objectClasses (note: growing an array while you
1965
+ </span> <span class='comment'># iterate over it seems to work, in ruby-1.8.2 anyway!)
1966
+ </span> <span class='id oc'>oc</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id objectclass'>objectclass</span><span class='op'>|</span>
1967
+ <span class='id objectclass'>objectclass</span><span class='period'>.</span><span class='id sup'>sup</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id s'>s</span><span class='op'>|</span>
1968
+ <span class='id oc'>oc</span><span class='period'>.</span><span class='id push'>push</span><span class='lparen'>(</span><span class='id s'>s</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id oc'>oc</span><span class='period'>.</span><span class='id include?'>include?</span><span class='lparen'>(</span><span class='id s'>s</span><span class='rparen'>)</span>
1969
+ <span class='kw'>end</span>
1970
+ <span class='kw'>end</span>
1971
+ <span class='id res'>res</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>objectClass</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id oc'>oc</span><span class='period'>.</span><span class='id collect'>collect</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id oo'>oo</span><span class='op'>|</span> <span class='id oo'>oo</span><span class='period'>.</span><span class='id to_s'>to_s</span> <span class='rbrace'>}</span>
1972
+
1973
+ <span class='comment'># Check that exactly one structural objectClass is present
1974
+ </span> <span class='kw'>unless</span> <span class='id oc'>oc</span><span class='period'>.</span><span class='id find_all'>find_all</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id s'>s</span><span class='op'>|</span> <span class='id s'>s</span><span class='period'>.</span><span class='id struct'>struct</span> <span class='op'>==</span> <span class='symbol'>:structural</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id size'>size</span> <span class='op'>&gt;=</span> <span class='int'>1</span>
1975
+ <span class='id raise'>raise</span> <span class='const'>LDAP</span><span class='op'>::</span><span class='const'>ResultError</span><span class='op'>::</span><span class='const'>ObjectClassViolation</span><span class='comma'>,</span>
1976
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Entry must have at least one structural objectClass</span><span class='tstring_end'>&quot;</span></span>
1977
+ <span class='comment'># Exactly one? But you have to sort out the inheritance problem
1978
+ </span> <span class='comment'># (e.g. both person and organizationalPerson are declared
1979
+ </span> <span class='comment'># structural)
1980
+ </span> <span class='kw'>end</span>
1981
+ <span class='kw'>end</span>
1982
+
1983
+ <span class='comment'># Ensure that all MUST attributes are present
1984
+ </span> <span class='id allow_attr'>allow_attr</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
1985
+ <span class='id oc'>oc</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id objectclass'>objectclass</span><span class='op'>|</span>
1986
+ <span class='id objectclass'>objectclass</span><span class='period'>.</span><span class='id must'>must</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id m'>m</span><span class='op'>|</span>
1987
+ <span class='kw'>unless</span> <span class='id res'>res</span><span class='lbracket'>[</span><span class='id m'>m</span><span class='period'>.</span><span class='id name'>name</span><span class='rbracket'>]</span> <span class='kw'>and</span> <span class='id res'>res</span><span class='lbracket'>[</span><span class='id m'>m</span><span class='period'>.</span><span class='id name'>name</span><span class='rbracket'>]</span> <span class='op'>!=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
1988
+ <span class='id raise'>raise</span> <span class='const'>LDAP</span><span class='op'>::</span><span class='const'>ResultError</span><span class='op'>::</span><span class='const'>ObjectClassViolation</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Missing attribute </span><span class='embexpr_beg'>#{</span><span class='id m'>m</span><span class='rbrace'>}</span><span class='tstring_content'> required by objectClass </span><span class='embexpr_beg'>#{</span><span class='id objectclass'>objectclass</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
1989
+ <span class='kw'>end</span>
1990
+ <span class='id allow_attr'>allow_attr</span><span class='lbracket'>[</span><span class='id m'>m</span><span class='period'>.</span><span class='id name'>name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>true</span>
1991
+ <span class='kw'>end</span>
1992
+ <span class='id objectclass'>objectclass</span><span class='period'>.</span><span class='id may'>may</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id m'>m</span><span class='op'>|</span>
1993
+ <span class='id allow_attr'>allow_attr</span><span class='lbracket'>[</span><span class='id m'>m</span><span class='period'>.</span><span class='id name'>name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>true</span>
1994
+ <span class='kw'>end</span>
1995
+ <span class='kw'>end</span>
1996
+
1997
+ <span class='kw'>unless</span> <span class='id oc'>oc</span><span class='period'>.</span><span class='id find'>find</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id objectclass'>objectclass</span><span class='op'>|</span> <span class='id objectclass'>objectclass</span><span class='period'>.</span><span class='id name'>name</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>extensibleObject</span><span class='tstring_end'>'</span></span> <span class='rbrace'>}</span>
1998
+ <span class='comment'># Now check all the attributes given are permitted by MUST or MAY
1999
+ </span> <span class='id res'>res</span><span class='period'>.</span><span class='id each_key'>each_key</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id attr'>attr</span><span class='op'>|</span>
2000
+ <span class='kw'>unless</span> <span class='id allow_attr'>allow_attr</span><span class='lbracket'>[</span><span class='id attr'>attr</span><span class='rbracket'>]</span> <span class='kw'>or</span> <span class='id find_attrtype'>find_attrtype</span><span class='lparen'>(</span><span class='id attr'>attr</span><span class='rparen'>)</span><span class='period'>.</span><span class='id usage'>usage</span> <span class='op'>==</span> <span class='symbol'>:directoryOperation</span>
2001
+ <span class='id raise'>raise</span> <span class='const'>LDAP</span><span class='op'>::</span><span class='const'>ResultError</span><span class='op'>::</span><span class='const'>ObjectClassViolation</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Attribute </span><span class='embexpr_beg'>#{</span><span class='id attr'>attr</span><span class='rbrace'>}</span><span class='tstring_content'> not permitted by objectClass</span><span class='tstring_end'>&quot;</span></span>
2002
+ <span class='kw'>end</span>
2003
+ <span class='kw'>end</span>
2004
+ <span class='kw'>end</span>
2005
+
2006
+ <span class='kw'>return</span> <span class='id res'>res</span>
2007
+ <span class='kw'>end</span></pre>
2008
+ </td>
2009
+ </tr>
2010
+ </table>
2011
+ </div>
2012
+
2013
+ </div>
2014
+
2015
+ </div>
2016
+
2017
+ <div id="footer">
2018
+ Generated on Mon Sep 13 13:27:17 2010 by
2019
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2020
+ 0.6.0 (ruby-1.9.2).
2021
+ </div>
2022
+
2023
+ </body>
2024
+ </html>