| Class | ActiveLdap::Schema::Attribute |
| In: |
lib/active_ldap/schema.rb
|
| Parent: | Entry |
| super_attribute | [R] |
# File lib/active_ldap/schema.rb, line 353
353: def initialize(name, schema)
354: super(name, schema, "attributeTypes")
355: end
Returns true if the value MUST be transferred in binary
# File lib/active_ldap/schema.rb, line 385
385: def binary_required?
386: @binary_required
387: end
# File lib/active_ldap/schema.rb, line 405
405: def normalize_value(value)
406: send_to_syntax(value, :normalize_value, value)
407: end
Returns true if an attribute is read-only NO-USER-MODIFICATION
# File lib/active_ldap/schema.rb, line 361
361: def read_only?
362: @read_only
363: end
Returns true if an attribute can only have one value defined SINGLE-VALUE
# File lib/active_ldap/schema.rb, line 370
370: def single_value?
371: @single_value
372: end
# File lib/active_ldap/schema.rb, line 389
389: def syntax
390: (@derived_syntax ||= [derived_syntax])[0]
391: end
# File lib/active_ldap/schema.rb, line 409
409: def syntax_description
410: send_to_syntax(nil, :description)
411: end
# File lib/active_ldap/schema.rb, line 401
401: def type_cast(value)
402: send_to_syntax(value, :type_cast, value)
403: end
# File lib/active_ldap/schema.rb, line 393
393: def valid?(value)
394: validate(value).nil?
395: end
# File lib/active_ldap/schema.rb, line 397
397: def validate(value)
398: send_to_syntax(nil, :validate, value)
399: end
# File lib/active_ldap/schema.rb, line 414
414: def attribute(attribute_name, name=@name)
415: @schema.attribute_type(name, attribute_name)
416: end
# File lib/active_ldap/schema.rb, line 418
418: def collect_info
419: @description = attribute("DESC")[0]
420: @super_attribute = attribute("SUP")[0]
421: if @super_attribute
422: @super_attribute = @schema.attribute(@super_attribute)
423: @super_attribute = nil if @super_attribute.id.nil?
424: end
425: @read_only = attribute('NO-USER-MODIFICATION')[0] == 'TRUE'
426: @single_value = attribute('SINGLE-VALUE')[0] == 'TRUE'
427: @syntax = attribute("SYNTAX")[0]
428: @syntax = @schema.ldap_syntax(@syntax) if @syntax
429: if @syntax
430: @binary_required = @syntax.binary_transfer_required?
431: @binary = (@binary_required or !@syntax.human_readable?)
432: else
433: @binary_required = false
434: @binary = false
435: end
436: end
# File lib/active_ldap/schema.rb, line 438
438: def derived_syntax
439: return @syntax if @syntax
440: return @super_attribute.syntax if @super_attribute
441: nil
442: end