passiveldap 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +272 -0
- data/ChangeLog +22 -0
- data/LICENCE +55 -0
- data/README +28 -0
- data/lib/passiveldap.rb +1473 -0
- data/lib/user.rb +423 -0
- data/tests/README +20 -0
- data/tests/scheme_adam.ldif +19 -0
- data/tests/tc_attributes.rb +87 -0
- data/tests/tc_class.rb +77 -0
- data/tests/tc_instance.rb +98 -0
- data/tests/tc_validate.rb +55 -0
- data/tests/ts_all.rb +5 -0
- data/tests/user.rb +39 -0
- metadata +93 -0
data/lib/user.rb
ADDED
@@ -0,0 +1,423 @@
|
|
1
|
+
require "passiveldap"
|
2
|
+
require "iconv"
|
3
|
+
|
4
|
+
# the User class is a real-life example of the usage of PassiveLDAP.
|
5
|
+
#
|
6
|
+
# Most of the attributes are commented out, because I don't really use them, but they have their :multi_valued
|
7
|
+
# attribute set if they may be multi_valued (using A/D and the following objectclasses: top,person,user,organizationalperson),
|
8
|
+
# so they can be safely uncommented if needed.
|
9
|
+
#
|
10
|
+
# Some of the attributes are renamed, because they are used to represent something else (like workshops instead of department)
|
11
|
+
class User < PassiveLDAP::Base
|
12
|
+
|
13
|
+
COUNTRIES = [
|
14
|
+
[ "(válassz)", "" ],
|
15
|
+
[ "Afganisztán", "AF" ],
|
16
|
+
[ "Aland", "AX" ],
|
17
|
+
[ "Albánia", "AL" ],
|
18
|
+
[ "Algéria", "DZ" ],
|
19
|
+
[ "Amerikai Csendes-óceáni szigetek", "UM" ],
|
20
|
+
[ "Amerikai Egyesült Államok", "US" ],
|
21
|
+
[ "Amerikai Szamoa", "AS" ],
|
22
|
+
[ "Amerikai Virgin-szigetek", "VI" ],
|
23
|
+
[ "Andorra", "AD" ],
|
24
|
+
[ "Angola", "AO" ],
|
25
|
+
[ "Anguilla", "AI" ],
|
26
|
+
[ "Antarktisz", "AQ" ],
|
27
|
+
[ "Antigua és Barbuda", "AG" ],
|
28
|
+
[ "Argentína", "AR" ],
|
29
|
+
[ "Aruba", "AW" ],
|
30
|
+
[ "Ausztrália", "AU" ],
|
31
|
+
[ "Ausztria", "AT" ],
|
32
|
+
[ "Azerbajdzsán", "AZ" ],
|
33
|
+
[ "Bahama-szigetek", "BS" ],
|
34
|
+
[ "Bahrein", "BH" ],
|
35
|
+
[ "Banglades", "BD" ],
|
36
|
+
[ "Barbados", "BB" ],
|
37
|
+
[ "Belgium", "BE" ],
|
38
|
+
[ "Belize", "BZ" ],
|
39
|
+
[ "Benin", "BJ" ],
|
40
|
+
[ "Bermuda", "BM" ],
|
41
|
+
[ "Bhután", "BT" ],
|
42
|
+
[ "Bissau-Guinea", "GW" ],
|
43
|
+
[ "Bolívia", "BO" ],
|
44
|
+
[ "Bosznia-Hercegovina", "BA" ],
|
45
|
+
[ "Botswana", "BW" ],
|
46
|
+
[ "Bouvet-sziget", "BV" ],
|
47
|
+
[ "Brazília", "BR" ],
|
48
|
+
[ "Brit Indiai-óceáni terület", "IO" ],
|
49
|
+
[ "Brit Virgin-szigetek", "VG" ],
|
50
|
+
[ "Brunei", "BN" ],
|
51
|
+
[ "Bulgária", "BG" ],
|
52
|
+
[ "Burkina Faso", "BF" ],
|
53
|
+
[ "Burundi", "BI" ],
|
54
|
+
[ "Chile", "CL" ],
|
55
|
+
[ "Ciprus", "CY" ],
|
56
|
+
[ "Comore-szigetek", "KM" ],
|
57
|
+
[ "Cook-szigetek", "CK" ],
|
58
|
+
[ "Costa Rica", "CR" ],
|
59
|
+
[ "Csád", "TD" ],
|
60
|
+
[ "Csehország", "CZ" ],
|
61
|
+
[ "Dánia", "DK" ],
|
62
|
+
[ "Dél-afrikai Köztársaság", "ZA" ],
|
63
|
+
[ "Dél-Georgia és Déli-Sandwich-szigetek", "GS" ],
|
64
|
+
[ "Dominikai Közösség", "DM" ],
|
65
|
+
[ "Dominikai Köztársaság", "DO" ],
|
66
|
+
[ "Dzsibuti", "DJ" ],
|
67
|
+
[ "Ecuador", "EC" ],
|
68
|
+
[ "Egyenlítői-Guinea", "GQ" ],
|
69
|
+
[ "Egyesült Arab Emírségek", "AE" ],
|
70
|
+
[ "Egyiptom", "EG" ],
|
71
|
+
[ "Elefántcsontpart", "CI" ],
|
72
|
+
[ "El Salvador", "SV" ],
|
73
|
+
[ "Eritrea", "ER" ],
|
74
|
+
[ "Északi-Mariana-szigetek", "MP" ],
|
75
|
+
[ "Észtország", "EE" ],
|
76
|
+
[ "Etiópia", "ET" ],
|
77
|
+
[ "Falkland-szigetek", "FK" ],
|
78
|
+
[ "Fehéroroszország", "BY" ],
|
79
|
+
[ "Feröer", "FO" ],
|
80
|
+
[ "Fidzsi", "FJ" ],
|
81
|
+
[ "Finnország", "FI" ],
|
82
|
+
[ "Francia déli és antarktiszi területek", "TF" ],
|
83
|
+
[ "Francia Guyana", "GF" ],
|
84
|
+
[ "Franciaország", "FR" ],
|
85
|
+
[ "Francia Polinézia", "PF" ],
|
86
|
+
[ "Fülöp-szigetek", "PH" ],
|
87
|
+
[ "Gabon", "GA" ],
|
88
|
+
[ "Gambia", "GM" ],
|
89
|
+
[ "Ghána", "GH" ],
|
90
|
+
[ "Gibraltár", "GI" ],
|
91
|
+
[ "Görögország", "GR" ],
|
92
|
+
[ "Grenada", "GD" ],
|
93
|
+
[ "Grönland", "GL" ],
|
94
|
+
[ "Grúzia", "GE" ],
|
95
|
+
[ "Guadeloupe", "GP" ],
|
96
|
+
[ "Guam", "GU" ],
|
97
|
+
[ "Guatemala", "GT" ],
|
98
|
+
[ "Guinea", "GN" ],
|
99
|
+
[ "Guyana", "GY" ],
|
100
|
+
[ "Haiti", "HT" ],
|
101
|
+
[ "Heard-sziget és McDonald-szigetek", "HM" ],
|
102
|
+
[ "Holland Antillák", "AN" ],
|
103
|
+
[ "Hollandia", "NL" ],
|
104
|
+
[ "Honduras", "HN" ],
|
105
|
+
[ "Hongkong", "HK" ],
|
106
|
+
[ "Horvátország", "HR" ],
|
107
|
+
[ "India", "IN" ],
|
108
|
+
[ "Indonézia", "ID" ],
|
109
|
+
[ "Irak", "IQ" ],
|
110
|
+
[ "Irán", "IR" ],
|
111
|
+
[ "Írország", "IE" ],
|
112
|
+
[ "Izland", "IS" ],
|
113
|
+
[ "Izrael", "IL" ],
|
114
|
+
[ "Jamaika", "JM" ],
|
115
|
+
[ "Japán", "JP" ],
|
116
|
+
[ "Jemen", "YE" ],
|
117
|
+
[ "Jordánia", "JO" ],
|
118
|
+
[ "Kajmán-szigetek", "KY" ],
|
119
|
+
[ "Kambodzsa", "KH" ],
|
120
|
+
[ "Kamerun", "CM" ],
|
121
|
+
[ "Kanada", "CA" ],
|
122
|
+
[ "Karácsony-sziget", "CX" ],
|
123
|
+
[ "Katar", "QA" ],
|
124
|
+
[ "Kazahsztán", "KZ" ],
|
125
|
+
[ "Kelet-Timor", "TL" ],
|
126
|
+
[ "Kenya", "KE" ],
|
127
|
+
[ "Kína", "CN" ],
|
128
|
+
[ "Kirgizisztán", "KG" ],
|
129
|
+
[ "Kiribati", "KI" ],
|
130
|
+
[ "Kókusz (Keeling)-szigetek", "CC" ],
|
131
|
+
[ "Kolumbia", "CO" ],
|
132
|
+
[ "Kongói Demokratikus Köztársaság (Zaire)", "CD" ],
|
133
|
+
[ "Kongói Köztársaság (Kongó)", "CG" ],
|
134
|
+
[ "Dél-Korea (Koreai Köztársaság)", "KR" ],
|
135
|
+
[ "Észak-Korea (Koreai NDK)", "KP" ],
|
136
|
+
[ "Közép-Afrika", "CF" ],
|
137
|
+
[ "Kuba", "CU" ],
|
138
|
+
[ "Kuvait", "KW" ],
|
139
|
+
[ "Laosz", "LA" ],
|
140
|
+
[ "Lengyelország", "PL" ],
|
141
|
+
[ "Lesotho", "LS" ],
|
142
|
+
[ "Lettország", "LV" ],
|
143
|
+
[ "Libanon", "LB" ],
|
144
|
+
[ "Libéria", "LR" ],
|
145
|
+
[ "Líbia", "LY" ],
|
146
|
+
[ "Liechtenstein", "LI" ],
|
147
|
+
[ "Litvánia", "LT" ],
|
148
|
+
[ "Luxemburg", "LU" ],
|
149
|
+
[ "Macedónia", "MK" ],
|
150
|
+
[ "Madagaszkár", "MG" ],
|
151
|
+
[ "Magyarország", "HU" ],
|
152
|
+
[ "Makaó", "MO" ],
|
153
|
+
[ "Malajzia", "MY" ],
|
154
|
+
[ "Malawi", "MW" ],
|
155
|
+
[ "Maldív-szigetek", "MV" ],
|
156
|
+
[ "Mali", "ML" ],
|
157
|
+
[ "Málta", "MT" ],
|
158
|
+
[ "Marokkó", "MA" ],
|
159
|
+
[ "Marshall-szigetek", "MH" ],
|
160
|
+
[ "Martinique", "MQ" ],
|
161
|
+
[ "Mauritánia", "MR" ],
|
162
|
+
[ "Mauritius", "MU" ],
|
163
|
+
[ "Mayotte", "YT" ],
|
164
|
+
[ "Mexikó", "MX" ],
|
165
|
+
[ "Mianmar", "MM" ],
|
166
|
+
[ "Mikronézia", "FM" ],
|
167
|
+
[ "Moldova", "MD" ],
|
168
|
+
[ "Monaco", "MC" ],
|
169
|
+
[ "Mongólia", "MN" ],
|
170
|
+
[ "Montserrat", "MS" ],
|
171
|
+
[ "Mozambik", "MZ" ],
|
172
|
+
[ "Nagy-Britannia (Egyesült Királyság)", "GB" ],
|
173
|
+
[ "Namíbia", "NA" ],
|
174
|
+
[ "Nauru", "NR" ],
|
175
|
+
[ "Németország", "DE" ],
|
176
|
+
[ "Nepál", "NP" ],
|
177
|
+
[ "Nicaragua", "NI" ],
|
178
|
+
[ "Niger", "NE" ],
|
179
|
+
[ "Nigéria", "NG" ],
|
180
|
+
[ "Niue", "NU" ],
|
181
|
+
[ "Norfolk-sziget", "NF" ],
|
182
|
+
[ "Norvégia", "NO" ],
|
183
|
+
[ "Nyugat-Szahara", "EH" ],
|
184
|
+
[ "Olaszország", "IT" ],
|
185
|
+
[ "Omán", "OM" ],
|
186
|
+
[ "Oroszország", "RU" ],
|
187
|
+
[ "Örményország", "AM" ],
|
188
|
+
[ "Pakisztán", "PK" ],
|
189
|
+
[ "Palau", "PW" ],
|
190
|
+
[ "Palesztina", "PS" ],
|
191
|
+
[ "Panama", "PA" ],
|
192
|
+
[ "Pápua Új-Guinea", "PG" ],
|
193
|
+
[ "Paraguay", "PY" ],
|
194
|
+
[ "Peru", "PE" ],
|
195
|
+
[ "Pitcairn-szigetek", "PN" ],
|
196
|
+
[ "Portugália", "PT" ],
|
197
|
+
[ "Puerto Rico", "PR" ],
|
198
|
+
[ "Réunion", "RE" ],
|
199
|
+
[ "Románia", "RO" ],
|
200
|
+
[ "Ruanda", "RW" ],
|
201
|
+
[ "Saint Kitts és Nevis", "KN" ],
|
202
|
+
[ "Saint Lucia", "LC" ],
|
203
|
+
[ "Saint Pierre és Miquelon", "PM" ],
|
204
|
+
[ "Saint Vincent és a Grenadine-szigetek", "VC" ],
|
205
|
+
[ "Salamon-szigetek", "SB" ],
|
206
|
+
[ "San Marino", "SM" ],
|
207
|
+
[ "Sao Tomé és Príncipe", "ST" ],
|
208
|
+
[ "Seychelle-szigetek", "SC" ],
|
209
|
+
[ "Sierra Leone", "SL" ],
|
210
|
+
[ "Spanyolország", "ES" ],
|
211
|
+
[ "Srí Lanka", "LK" ],
|
212
|
+
[ "Suriname", "SR" ],
|
213
|
+
[ "Svájc", "CH" ],
|
214
|
+
[ "Svalbard (Spitzbergák) és Jan Mayen", "SJ" ],
|
215
|
+
[ "Svédország", "SE" ],
|
216
|
+
[ "Szamoa", "WS" ],
|
217
|
+
[ "Szaúd-Arábia", "SA" ],
|
218
|
+
[ "Szenegál", "SN" ],
|
219
|
+
[ "Szent Ilona", "SH" ],
|
220
|
+
[ "Szerbia és Montenegró", "CS" ],
|
221
|
+
[ "Szingapúr", "SG" ],
|
222
|
+
[ "Szíria", "SY" ],
|
223
|
+
[ "Szlovákia", "SK" ],
|
224
|
+
[ "Szlovénia", "SI" ],
|
225
|
+
[ "Szomália", "SO" ],
|
226
|
+
[ "Szudán", "SD" ],
|
227
|
+
[ "Szváziföld", "SZ" ],
|
228
|
+
[ "Tádzsikisztán", "TJ" ],
|
229
|
+
[ "Tajvan", "TW" ],
|
230
|
+
[ "Tanzánia", "TZ" ],
|
231
|
+
[ "Thaiföld", "TH" ],
|
232
|
+
[ "Togó", "TG" ],
|
233
|
+
[ "Tokelau", "TK" ],
|
234
|
+
[ "Tonga", "TO" ],
|
235
|
+
[ "Törökország", "TR" ],
|
236
|
+
[ "Trinidad és Tobago", "TT" ],
|
237
|
+
[ "Tunézia", "TN" ],
|
238
|
+
[ "Turks- és Caicos-szigetek", "TC" ],
|
239
|
+
[ "Tuvalu", "TV" ],
|
240
|
+
[ "Türkmenisztán", "TM" ],
|
241
|
+
[ "Uganda", "UG" ],
|
242
|
+
[ "Új-Kaledónia", "NC" ],
|
243
|
+
[ "Új-Zéland", "NZ" ],
|
244
|
+
[ "Ukrajna", "UA" ],
|
245
|
+
[ "Uruguay", "UY" ],
|
246
|
+
[ "Üzbegisztán", "UZ" ],
|
247
|
+
[ "Vanuatu", "VU" ],
|
248
|
+
[ "Vatikán", "VA" ],
|
249
|
+
[ "Venezuela", "VE" ],
|
250
|
+
[ "Vietnam", "VN" ],
|
251
|
+
[ "Wallis és Futuna", "WF" ],
|
252
|
+
[ "Zambia", "ZM" ],
|
253
|
+
[ "Zimbabwe", "ZW" ],
|
254
|
+
[ "Zöld-foki-szigetek", "CV" ],
|
255
|
+
]
|
256
|
+
|
257
|
+
passive_ldap \
|
258
|
+
:id_attribute => :uidnumber,
|
259
|
+
:record_base => "cn=Users,dc=eotvos,dc=elte,dc=hu",
|
260
|
+
:default_array_separator => "\n",
|
261
|
+
:default_protection_level => 2
|
262
|
+
passive_ldap_attr \
|
263
|
+
:badpwdcount => { :name => :bad_password_count,
|
264
|
+
:read_only => true },
|
265
|
+
:c => { :name => :country_id, :default_value => "HU", :level => 1 },
|
266
|
+
:cn => { :name => :common_name,
|
267
|
+
:default_value => Proc.new { |s| "user_#{s.id}" } },
|
268
|
+
# :co => { :name => :country },
|
269
|
+
:codepage => { :default_value => "0",
|
270
|
+
:read_only => true,
|
271
|
+
:hidden => true },
|
272
|
+
:comment => { },
|
273
|
+
:company => { :name => :university },
|
274
|
+
# :countrycode => { :name => :country_code },
|
275
|
+
:department => { :name => :main_workshop, :default_value => "other", :level => 1 },
|
276
|
+
:departmentnumber => { :name => :workshops,
|
277
|
+
:multi_valued => true, :level => 1},
|
278
|
+
:description => { :name => :about,
|
279
|
+
:multi_valued => true },
|
280
|
+
# :displayname => attribute is at the end of the list!
|
281
|
+
# :division => { },
|
282
|
+
:dn => { :default_value => Proc.new { |s| "cn=#{s.common_name},#{s.class.settings[:record_base]}" },
|
283
|
+
:read_only => true,
|
284
|
+
:hidden => true },
|
285
|
+
# :employeeid => { :name => :employee_id },
|
286
|
+
# :employeenumber => { :name => :employee_number },
|
287
|
+
:employeetype => { :name => :user_status, :level => 1, :default_value => "Bentlakó hallgató" },
|
288
|
+
# :facsimiletelephonenumber => { :name => :fax },
|
289
|
+
:gidnumber => { :name => :linux_group_id,
|
290
|
+
:default_value => "10001",
|
291
|
+
:read_only => true,
|
292
|
+
:hidden => true },
|
293
|
+
:givenname => { :name => :first_name, :level => 1 },
|
294
|
+
# :homedirectory => { :name => :home_directory,
|
295
|
+
# :read_only => true,
|
296
|
+
# :default_value => Proc.new { |s| "/home/#{s.common_name}" } },
|
297
|
+
:homephone => { :name => :home_phone, :level => 1 },
|
298
|
+
# :homepostaladdress => { :name => :home_postal_address },
|
299
|
+
# :houseidentifier => { :name => :house_identifier,
|
300
|
+
# :multi_valued => true},
|
301
|
+
:info => { },
|
302
|
+
# :initials => { },
|
303
|
+
:ipphone => { :name => :ip_phone, :level => 1 },
|
304
|
+
:l => { :name => :location, :level => 1 },
|
305
|
+
:lastlogoff => { :name => :last_logoff,
|
306
|
+
:read_only => true,
|
307
|
+
:type => PassiveLDAP::Types::ANSI_Date },
|
308
|
+
:lastlogon => { :name => :last_logon,
|
309
|
+
:read_only => true,
|
310
|
+
:type => PassiveLDAP::Types::ANSI_Date },
|
311
|
+
:loginshell => { :name => :linux_login_shell,
|
312
|
+
:default_value => "/usr/bin/rssh",
|
313
|
+
:read_only => true,
|
314
|
+
:hidden => true },
|
315
|
+
:logoncount => { :name => :logon_count,
|
316
|
+
:read_only => true },
|
317
|
+
:mail => { :level => 1},
|
318
|
+
:mssfu30name => { :name => :linux_account_name,
|
319
|
+
:default_value => Proc.new { |s| s.common_name },
|
320
|
+
:read_only => true,
|
321
|
+
:hidden => true },
|
322
|
+
:mssfu30nisdomain => { :name => :linux_domain,
|
323
|
+
:default_value => "eotvos",
|
324
|
+
:read_only => true,
|
325
|
+
:hidden => true },
|
326
|
+
:middlename => { :name => :middle_name, :level => 1 },
|
327
|
+
:mobile => { :level => 1},
|
328
|
+
# :networkaddress => { :name => :network_address },
|
329
|
+
:o => { :name => :organization },
|
330
|
+
:objectclass => { :name => :object_class,
|
331
|
+
:default_value => %w{top person organizationalPerson user},
|
332
|
+
:multi_valued => true,
|
333
|
+
:read_only => true,
|
334
|
+
:hidden => true },
|
335
|
+
# :otherfacsimiletelephonenumber => { :name => :other_faxes,
|
336
|
+
# :multi_valued => true },
|
337
|
+
:otherhomephone => { :name => :other_home_phones,
|
338
|
+
:multi_valued => true, :level => 1 },
|
339
|
+
:otheripphone => { :name => :other_ip_phones,
|
340
|
+
:multi_valued => true, :level => 1 },
|
341
|
+
:othermailbox => { :name => :other_mailboxes,
|
342
|
+
:multi_valued => true, :level => 1 },
|
343
|
+
:othermobile => { :name => :other_mobiles,
|
344
|
+
:multi_valued => true, :level => 1 },
|
345
|
+
# :otherpager => { :name => :other_pagers,
|
346
|
+
# :multi_valued => true },
|
347
|
+
# :othertelephone => { :name => :other_phones,
|
348
|
+
# :multi_valued => true },
|
349
|
+
# :ou => { :name => :organizational_unit,
|
350
|
+
# :multi_valued => true },
|
351
|
+
# :pager => { },
|
352
|
+
# :personaltitle => { :name => :personal_title },
|
353
|
+
:physicaldeliveryofficename => { :name => :office_name },
|
354
|
+
# :postaladdress => { :name => :postal_address,
|
355
|
+
# :multi_valued => true},
|
356
|
+
:postalcode => { :name => :postal_code, :level => 1 },
|
357
|
+
# :postofficebox => { :name => :post_office_box,
|
358
|
+
# :multi_valued => true},
|
359
|
+
# :primarygroupid => { :name => :primary_group_id,
|
360
|
+
# :read_only => true },
|
361
|
+
# :profilepath => { :name => :profile_path,
|
362
|
+
# :read_only => true },
|
363
|
+
:pwdlastset => { :name => :password_last_set,
|
364
|
+
:read_only => true,
|
365
|
+
:type => PassiveLDAP::Types::ANSI_Date },
|
366
|
+
:roomnumber => { :name => :room_number, :level => 1 },
|
367
|
+
:samaccountname => { :name => :sam_account_name,
|
368
|
+
:read_only => true,
|
369
|
+
:default_value => Proc.new { |s| s.common_name },
|
370
|
+
:hidden => true },
|
371
|
+
# :samaccounttype => { :name => :sam_account_type,
|
372
|
+
# :default_value => "805306368", # beware! can't set default_value of this attribute at creation, it will result in an error
|
373
|
+
# :read_only => true,
|
374
|
+
# :hidden => true },
|
375
|
+
# :scriptpath => { :name => :script_path,
|
376
|
+
# :read_only => true },
|
377
|
+
:sn => { :name => :surname,
|
378
|
+
:default_value => Proc.new { |s| s.common_name }, :level => 1 },
|
379
|
+
:st => { :name => :state, :level => 1 },
|
380
|
+
# :street => { :name => :street },
|
381
|
+
:streetaddress => { :name => :street_address, :level => 1 },
|
382
|
+
# :telephonenumber => { :name => :phone },
|
383
|
+
:title => { :name => :occupation },
|
384
|
+
:uid => { :multi_valued => true,
|
385
|
+
:default_value => Proc.new { |s| [s.common_name] },
|
386
|
+
:read_only => true,
|
387
|
+
:hidden => true },
|
388
|
+
:unicodepwd => { :default_value => Proc.new { |s| if s.new_record? then Iconv.conv("UCS-2LE","UTF-8",'"aBc123!?"') else nil end },
|
389
|
+
:read_only => true,
|
390
|
+
:hidden => true },
|
391
|
+
# AD uses UCS-2 Little Endian encoding, and the password string is quoted with "-s.
|
392
|
+
# Because the unicodePwd is write-only and invisible in AD, we only want a default_value
|
393
|
+
# if the record is new, that is why we return nil if the record is not new.
|
394
|
+
# See PassiveLDAP::Base#set_password for more info
|
395
|
+
:unixhomedirectory => { :name => :linux_home_directory,
|
396
|
+
:default_value => Proc.new { |s| "/home/#{s.common_name}" },
|
397
|
+
:read_only => true,
|
398
|
+
:hidden => true },
|
399
|
+
:url => { :multi_valued => true, :level => 1 },
|
400
|
+
:useraccountcontrol => { :default_value => "512",
|
401
|
+
:read_only => true,
|
402
|
+
:hidden => true },
|
403
|
+
:userprincipalname => { :name => :user_principal_name,
|
404
|
+
:default_value => Proc.new { |s| "#{s.common_name}@eotvos.elte.hu" },
|
405
|
+
:read_only => true,
|
406
|
+
:hidden => true },
|
407
|
+
:wwwhomepage => { :level => 1},
|
408
|
+
# this attribute is at the end, because it's default value uses surname and firstname
|
409
|
+
:displayname => { :name => :display_name, :level => 1,
|
410
|
+
:default_value => Proc.new { |s| "#{s.surname} #{s.first_name}"} }
|
411
|
+
|
412
|
+
validates_presence_of :surname, :first_name, :message => "A neveket meg kell adni"
|
413
|
+
validates_format_of :mail, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i, :allow_nil => true, :allow_blank => true, :message => "Az e-mail cím formátuma hibás!"
|
414
|
+
validates_format_of_each :other_mailboxes, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i, :allow_nil => true, :allow_blank => true, :message => "A további e-mail címek valamelyike hibás formátumú!"
|
415
|
+
validates_format_of :mobile, :with => /\A[-+ _0-9]*\Z/, :allow_nil => true, :allow_blank => true,:message => "A mobiltelefonszám csak számokat és a \"-\", \"+\", \" \", \"_\" jeleket tartalmazhatja!"
|
416
|
+
validates_format_of :postal_code, :with => /\A[0-9]*\Z/,:allow_nil => true, :allow_blank => true, :message => "Az irányítószám csak szám lehet!"
|
417
|
+
validates_format_of :room_number, :with => /\A[0-9]*\Z/, :allow_nil => true, :allow_blank => true,:message => "A szobaszám csak szám lehet!"
|
418
|
+
validates_format_of :home_phone, :with => /\A[-+ _0-9]*\Z/, :allow_nil => true, :allow_blank => true,:message => "A telefonszám csak számokat és a \"-\", \"+\", \" \", \"_\" jeleket tartalmazhatja!"
|
419
|
+
validates_format_of_each :other_mobiles, :with => /\A[-+ _0-9]*\Z/, :allow_nil => true, :allow_blank => true,:message => "A mobilszámok csak számokat és a \"-\", \"+\", \" \", \"_\" jeleket tartalmazhatják!"
|
420
|
+
validates_format_of_each :other_home_phones, :with => /\A[-+ _0-9]*\Z/, :allow_nil => true, :allow_blank => true,:message => "A telefonszámok csak számokat és a \"-\", \"+\", \" \", \"_\" jeleket tartalmazhatják!"
|
421
|
+
|
422
|
+
validates_inclusion_of :country_id, :in => COUNTRIES.map { |disp, value| value }
|
423
|
+
end
|
data/tests/README
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
== Info
|
2
|
+
|
3
|
+
These tests should run by an ADAM instance, whose schema has been
|
4
|
+
extended by the schema_adam.ldif file (change the CN=X to your
|
5
|
+
configuration base), and the person class has been extended with
|
6
|
+
this uidnumber attribute. The :record_base and some other config
|
7
|
+
values are hard-coded in the user.rb test files, so you should change
|
8
|
+
it too.
|
9
|
+
|
10
|
+
Of course other LDAP servers should work too, but I only tested this in
|
11
|
+
an ADAM instance, because I didn't want to make a test environment
|
12
|
+
in our production AD server. Some functions could not be tested
|
13
|
+
in ADAM (for example I could only bind to an ADAM instence
|
14
|
+
using anonymous connection, so things like set_protection_level,
|
15
|
+
bind, or anything else that needs authentication are untested)
|
16
|
+
|
17
|
+
Be sure to allow anonymous access, read/write, etc in your ADAM server!
|
18
|
+
|
19
|
+
If you use some other servers please modify the test so they could work on
|
20
|
+
them, and send those tests to me!
|
@@ -0,0 +1,19 @@
|
|
1
|
+
dn: CN=Uid-Number,CN=Schema,CN=Configuration,CN=X
|
2
|
+
changetype: ntdsschemaadd
|
3
|
+
objectClass: top
|
4
|
+
objectClass: attributeSchema
|
5
|
+
cn: Uid-Number
|
6
|
+
attributeID: 1.2.840.113556.1.4.302.1.2.3.4.5.6.7
|
7
|
+
attributeSyntax: 2.5.5.9
|
8
|
+
isSingleValued: TRUE
|
9
|
+
rangeLower: 1
|
10
|
+
rangeUpper: 100000
|
11
|
+
showInAdvancedViewOnly: TRUE
|
12
|
+
adminDisplayName: Uid-Number
|
13
|
+
adminDescription: Uid-Number
|
14
|
+
instanceType: 4
|
15
|
+
oMSyntax: 2
|
16
|
+
searchFlags: 0
|
17
|
+
lDAPDisplayName: uidNumber
|
18
|
+
schemaIDGUID:: MnqWv+YM0BGihQCqADBJ4g==
|
19
|
+
systemOnly: FALSE
|