class ROM::LDAP::Attribute
Extended schema attributes tailored for LDAP
directories
@api public
Public Class Methods
@param args [Mixed]
@return [ROM::LDAP::Attribute]
@api public
# File lib/rom/ldap/attribute.rb, line 20 def self.[](*args) fetch_or_store(args) { new(*args) } end
Public Instance Methods
@param value [Mixed]
@return [Array]
@api public
# File lib/rom/ldap/attribute.rb, line 318 def bitwise(value) [:op_eql, name, value] end
Return a new attribute in its canonical form
@see Dataset#export
@return [LDAP::Attribute]
@api public
# File lib/rom/ldap/attribute.rb, line 158 def canonical if aliased? meta(alias: nil) else self end end
OID description
@return [String]
@api public
# File lib/rom/ldap/attribute.rb, line 120 def description meta[:description] end
Attribute
definition identifies this is not a directory internal attribute and values can be altered.
@return [Boolean]
@api public
# File lib/rom/ldap/attribute.rb, line 30 def editable? meta[:editable].equal?(true) end
@example
users.where { given_name.exists } users.where { ~given_name }
@return [Array]
@api public
# File lib/rom/ldap/attribute.rb, line 173 def exists [:op_eql, name, :wildcard] end
@param value [Mixed]
@see ldapwiki.com/wiki/ExtensibleMatch
@return [Array]
@api public
# File lib/rom/ldap/attribute.rb, line 309 def extensible(value) [:op_ext, name, value] end
Return a new attribute marked as a FK
@return [LDAP::Attribute]
@api public
# File lib/rom/ldap/attribute.rb, line 84 def foreign_key meta(foreign_key: true) end
@param value [Mixed]
@example
users.where { uid_number.gt(101) } users.where { uid_number > 101 }
@return [Array]
@api public
# File lib/rom/ldap/attribute.rb, line 227 def gt(value) [:con_not, lte(value)] end
@param value [Mixed]
@example
users.where { uid_number.gte(101) } users.where { uid_number >= 101 }
@return [Array]
@api public
# File lib/rom/ldap/attribute.rb, line 255 def gte(value) [:op_gte, name, value] end
Returns a new attribute marked as indexed
@return [LDAP::Attribute]
@api public
# File lib/rom/ldap/attribute.rb, line 147 def indexed meta(index: true) end
@return [Boolean]
@api public
# File lib/rom/ldap/attribute.rb, line 138 def indexed? meta[:index].equal?(true) end
@param value [Mixed]
@example
users.where { id.is(1) } users.where { id == 1 } users.where(users[:id].is(1))
@return [Array]
@api public
# File lib/rom/ldap/attribute.rb, line 199 def is(value) [:op_eql, name, value] end
Return a new attribute marked as joined
Whenever you join two schemas, the right schema's attribute will be marked as joined using this method
@return [LDAP::Attribute] Original attribute marked as joined
@api public
# File lib/rom/ldap/attribute.rb, line 60 def joined meta(joined: true) end
Return if an attribute was used in a join
@example
schema = users.schema.join(tasks.schema) schema[:id, :tasks].joined? # => true
@return [Boolean]
@api public
# File lib/rom/ldap/attribute.rb, line 75 def joined? meta[:joined].equal?(true) end
@param value [Mixed]
@example
users.where { given_name.like('peter') } users.where { given_name =~ 'peter' }
@return [Array]
@api public
# File lib/rom/ldap/attribute.rb, line 283 def like(value) [:op_prx, name, value] end
@param value [Mixed]
@example
users.where { uid_number.lt(101) } users.where { uid_number < 101 }
@return [Array]
@api public
# File lib/rom/ldap/attribute.rb, line 241 def lt(value) [:con_not, gte(value)] end
@param value [Mixed]
@example
users.where { uid_number.lte(101) } users.where { uid_number <= 101 }
@return [Array]
@api public
# File lib/rom/ldap/attribute.rb, line 269 def lte(value) [:op_lte, name, value] end
OID permits multiple values?
@return [Boolean]
@api public
# File lib/rom/ldap/attribute.rb, line 48 def multiple? meta[:single].equal?(false) end
@param value [Mixed]
@example
users.where { id.not(1) } users.where { id != 1 }
@return [Array]
@api public
# File lib/rom/ldap/attribute.rb, line 213 def not(value) [:con_not, is(value)] end
@param value [Mixed]
@example
users.where { given_name.not_like('peter') } users.where { given_name !~ 'peter' }
@return [Array]
@api public
# File lib/rom/ldap/attribute.rb, line 297 def not_like(value) [:con_not, like(value)] end
Attribute
Numeric Object Identifier
@return [String]
@api public
# File lib/rom/ldap/attribute.rb, line 93 def oid meta[:oid] end
Attribute
definition identifies this attribute can not have multiple values.
@return [Boolean]
@api public
# File lib/rom/ldap/attribute.rb, line 39 def single? meta[:single].equal?(true) end
Attribute's syntax Numeric Object Identifier
@return [String]
@api public
# File lib/rom/ldap/attribute.rb, line 111 def syntax meta[:syntax] end
Convert to string for ldap query using original name The canonical attribute name defined in RFC4512.
@return [String]
@api public
# File lib/rom/ldap/attribute.rb, line 130 def to_s meta[:canonical] || name.to_s end