Class ActiveLdap::Schema::Attribute
In: lib/active_ldap/schema.rb
Parent: Entry
Error DeleteError LdapError AdapterNotSpecified OperationNotPermitted RequiredAttributeMissed LdifInvalid AttributeAssignmentError RequiredObjectClassMissed DistinguishedNameNotSetError StrongAuthenticationRequired ConnectionError SaveError EntryNotFound AuthenticationError EntryNotSaved UnknownAttribute ConnectionNotEstablished TimeoutError ConfigurationError AdapterNotFound DistinguishedNameInvalid ObjectClassError EntryInvalid EntryAlreadyExist Base DistinguishedName Ldif Reloadable::Deprecated Reloadable::Subclasses Enumerable Collection StandardError Children HasMany HasManyWrap BelongsToMany Proxy BelongsTo Common Find LDIF Delete Update GetText Parser GetTextSupport Base\n[lib/active_ldap/adapter/base.rb\nlib/active_ldap/adapter/ldap.rb\nlib/active_ldap/adapter/net_ldap.rb] Ldap NetLdap Normalize ActiveRecord::Callbacks ActiveRecord::Validations Schema\n[lib/active_ldap/schema.rb\nlib/active_ldap/schema/syntaxes.rb] lib/active_ldap/base.rb lib/active_ldap/schema.rb lib/active_ldap/ldif.rb lib/active_ldap/distinguished_name.rb lib/active_ldap/ldap_error.rb ClassMethods Associations ClassMethods HumanReadable lib/active_ldap/association/has_many_wrap.rb lib/active_ldap/association/has_many.rb lib/active_ldap/association/proxy.rb lib/active_ldap/association/children.rb lib/active_ldap/association/collection.rb lib/active_ldap/association/belongs_to_many.rb lib/active_ldap/association/belongs_to.rb HasManyUtils Association ClassMethods Tree Acts Common LDIF Delete Find Update Operations lib/active_ldap/get_text/parser.rb GetText ClassMethods Configuration Command lib/active_ldap/adapter/net_ldap.rb lib/active_ldap/adapter/ldap.rb Adapter GetTextSupport Normalize ClassMethods Attributes Escape Callbacks ClassMethods ObjectClass Helper Validations ClassMethods Connection GetTextFallback Populate Salt UserPassword ActiveLdap dot/m_40_0.png

Methods

Attributes

super_attribute  [R] 

Public Class methods

[Source]

     # File lib/active_ldap/schema.rb, line 353
353:       def initialize(name, schema)
354:         super(name, schema, "attributeTypes")
355:       end

Public Instance methods

binary?

Returns true if the given attribute‘s syntax is X-NOT-HUMAN-READABLE or X-BINARY-TRANSFER-REQUIRED

[Source]

     # File lib/active_ldap/schema.rb, line 378
378:       def binary?
379:         @binary
380:       end

binary_required?

Returns true if the value MUST be transferred in binary

[Source]

     # File lib/active_ldap/schema.rb, line 385
385:       def binary_required?
386:         @binary_required
387:       end

[Source]

     # File lib/active_ldap/schema.rb, line 405
405:       def normalize_value(value)
406:         send_to_syntax(value, :normalize_value, value)
407:       end

read_only?

Returns true if an attribute is read-only NO-USER-MODIFICATION

[Source]

     # File lib/active_ldap/schema.rb, line 361
361:       def read_only?
362:         @read_only
363:       end

single_value?

Returns true if an attribute can only have one value defined SINGLE-VALUE

[Source]

     # File lib/active_ldap/schema.rb, line 370
370:       def single_value?
371:         @single_value
372:       end

[Source]

     # File lib/active_ldap/schema.rb, line 389
389:       def syntax
390:         (@derived_syntax ||= [derived_syntax])[0]
391:       end

[Source]

     # File lib/active_ldap/schema.rb, line 409
409:       def syntax_description
410:         send_to_syntax(nil, :description)
411:       end

[Source]

     # File lib/active_ldap/schema.rb, line 401
401:       def type_cast(value)
402:         send_to_syntax(value, :type_cast, value)
403:       end

[Source]

     # File lib/active_ldap/schema.rb, line 393
393:       def valid?(value)
394:         validate(value).nil?
395:       end

[Source]

     # File lib/active_ldap/schema.rb, line 397
397:       def validate(value)
398:         send_to_syntax(nil, :validate, value)
399:       end

Private Instance methods

[Source]

     # File lib/active_ldap/schema.rb, line 414
414:       def attribute(attribute_name, name=@name)
415:         @schema.attribute_type(name, attribute_name)
416:       end

[Source]

     # 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

[Source]

     # 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

[Source]

     # File lib/active_ldap/schema.rb, line 444
444:       def send_to_syntax(default_value, method_name, *args)
445:         _syntax = syntax
446:         if _syntax
447:           _syntax.send(method_name, *args)
448:         else
449:           default_value
450:         end
451:       end

[Validate]