ODRecord Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/OpenDirectory.framework
Availability
Available in OS X v10.6 and later.
Declared in
ODRecord.h

Overview

An ODRecord object serves as a Cocoa wrapper for an Open Directory record.

Tasks

Managing Authentication

Managing Group Records

Managing Record Attributes

Deleting a Record

Properties

recordName

The official name of the record. (read-only)

@property(nonatomic, readonly, copy) NSString *recordName
Availability
  • Available in OS X v10.6 and later.
Declared In
ODRecord.h

recordType

The record’s type. (read-only)

@property(nonatomic, readonly, copy) NSString *recordType
Availability
  • Available in OS X v10.6 and later.
Declared In
ODRecord.h

Instance Methods

addMemberRecord:error:

Adds a member record to this group record.

- (BOOL)addMemberRecord:(ODRecord *)inRecord error:(NSError **)outError
Parameters
inRecord

The member record to add.

outError

An error reference for error details. Can be nil.

Return Value

YES if the member record is successfully added; otherwise, NO.

Discussion

This method produces an error if this record is not a group record, or if inRecord is not an appropriate type.

Availability
  • Available in OS X v10.6 and later.
Declared In
ODRecord.h

addValue:toAttribute:error:

Adds a value to an attribute of the record.

- (BOOL)addValue:(id)inValue toAttribute:(ODAttributeType)inAttribute error:(NSError **)outError
Parameters
inValue

The value. Should be of type NSString or NSData.

inAttribute

The attribute.

outError

An error reference for error details. Can be nil.

Return Value

YES if the value is successfully added; otherwise, NO.

Availability
  • Available in OS X v10.6 and later.
Declared In
ODRecord.h

changePassword:toPassword:error:

Changes the record’s password.

- (BOOL)changePassword:(NSString *)oldPassword toPassword:(NSString *)newPassword error:(NSError **)outError
Parameters
oldPassword

The record’s old password. Can be nil if the user has the proper permissions.

newPassword

The new password.

outError

An error reference for error details. Can be nil.

Return Value

YES if the password is successfully changed; otherwise, NO.

Availability
  • Available in OS X v10.6 and later.
Declared In
ODRecord.h

deleteRecordAndReturnError:

Deletes the record from its node and invalidates it.

- (BOOL)deleteRecordAndReturnError:(NSError **)outError
Parameters
outError

An error reference for error details. Can be nil.

Return Value

YES if the record is successfully deleted; otherwise, NO.

Discussion

The record should be released after this method is called.

Availability
  • Available in OS X v10.6 and later.
Declared In
ODRecord.h

isMemberRecord:error:

Determines whether a given record is a member of this group record.

- (BOOL)isMemberRecord:(ODRecord *)inRecord error:(NSError **)outError
Parameters
inRecord

The record to test for membership.

outError

An error reference for error details. Can be nil.

Return Value

YES if inRecord is a member of this group record; otherwise, NO.

Discussion

If this record is not a group record, this method returns NO.

Availability
  • Available in OS X v10.6 and later.
Declared In
ODRecord.h

passwordPolicyAndReturnError:

Returns a dictionary containing the password policy for the record.

- (NSDictionary *)passwordPolicyAndReturnError:(NSError **)outError
Parameters
outError

An error reference for error details. Can be nil.

Return Value

The password policy for the record.

Availability
  • Available in OS X v10.6 and later.
Declared In
ODRecord.h

recordDetailsForAttributes:error:

Returns a dictionary of attributes with their respective values.

- (NSDictionary *)recordDetailsForAttributes:(NSArray *)inAttributes error:(NSError **)outError
Parameters
inAttributes

An array of attributes. Can be nil.

outError

An error reference for error details. Can be nil.

Return Value

A dictionary of the attributes in inAttributes with their respective values.

Discussion

If inAttributes is nil, all currently retrieved attributes are returned.

Availability
  • Available in OS X v10.6 and later.
Declared In
ODRecord.h

removeMemberRecord:error:

Removes a record as a member of this group record.

- (BOOL)removeMemberRecord:(ODRecord *)inRecord error:(NSError **)outError
Parameters
inRecord

The member record.

outError

An error reference for error details. Can be nil.

Return Value

YES if inRecord is successfully removed from this group record; otherwise, NO.

Discussion

This method produces an error if this record is not a group record, or if inRecord is not an appropriate type.

Availability
  • Available in OS X v10.6 and later.
Declared In
ODRecord.h

removeValue:fromAttribute:error:

Removes a value from an attribute of the record.

- (BOOL)removeValue:(id)inValue fromAttribute:(ODAttributeType)inAttribute error:(NSError **)outError
Parameters
inValue

The value. Should be of type NSString or NSData.

inAttribute

The attribute.

outError

An error reference for error details. Can be nil.

Return Value

YES if the value is successfully removed; otherwise, NO.

Availability
  • Available in OS X v10.6 and later.
Declared In
ODRecord.h

removeValuesForAttribute:error:

Removes all values from an attribute of the record.

- (BOOL)removeValuesForAttribute:(ODAttributeType)inAttribute error:(NSError **)outError
Parameters
inAttribute

The attribute.

outError

An error reference for error details. Can be nil.

Return Value

YES if the values are successfully removed; otherwise, NO.

Availability
  • Available in OS X v10.6 and later.
Declared In
ODRecord.h

setNodeCredentials:password:error:

Sets credentials for the record’s node.

- (BOOL)setNodeCredentials:(NSString *)inUsername password:(NSString *)inPassword error:(NSError **)outError
Parameters
inUsername

The username to use to authenticate with the node.

inPassword

The password to use to authenticate with the node.

outError

An error reference for error details. Can be nil.

Return Value

YES if the credentials are successfully set; otherwise, NO.

Discussion

If this function fails, the previous credentials for the node are used.

Availability
  • Available in OS X v10.6 and later.
Declared In
ODRecord.h

setNodeCredentialsWithRecordType:authenticationType:authenticationItems:continueItems:context:error:

Sets the credentials for interaction with the record’s node using other types of authentication available to Open Directory.

- (BOOL)setNodeCredentialsWithRecordType:(ODRecordType)inRecordType authenticationType:(ODAuthenticationType)inType authenticationItems:(NSArray *)inItems continueItems:(NSArray **)outItems context:(id *)outContext error:(NSError **)outError
Parameters
inRecordType

The record type that uses the credentials. Can be nil. The default value is kODRecordTypeUsers.

inType

The authentication type.

inItems

An array of NSString or NSData objects to be used in the authentication process.

outItems

An array of NSData objects returned from the authentication process, if any are returned; nil otherwise.

outContext

The proper context if the authentication attempt requires a context; nil otherwise. If not nil, then more calls must be made with the Context to continue the authentication.

outError

An error reference for error details. Can be nil.

Return Value

YES if no error occurs; otherwise, NO.

Discussion

If this function fails, the previous credentials for the node are used.

Availability
  • Available in OS X v10.6 and later.
Declared In
ODRecord.h

setValue:forAttribute:error:

Sets the values of an attribute of the record.

- (BOOL)setValue:(id)inValueOrValues forAttribute:(ODAttributeType)inAttribute error:(NSError **)outError
Parameters
inValueOrValues

The value or values. Can be of type NSString or NSData, or an NSArray with elements of both types.

inAttribute

The attribute.

outError

An error reference for error details. Can be nil.

Return Value

YES if the values are successfully set; otherwise, NO.

Availability
  • Available in OS X v10.6 and later.
Declared In
ODRecord.h

synchronizeAndReturnError:

Synchronizes the record from the directory to get current data and commit changes.

- (BOOL)synchronizeAndReturnError:(NSError **)outError
Parameters
outError

An error reference for error details. Can be nil.

Return Value

YES if the record successfully synchronizes; otherwise, NO.

Discussion

This method only fetches those attributes that have been fetched before.

Availability
  • Available in OS X v10.6 and later.
Declared In
ODRecord.h

valuesForAttribute:error:

Returns the values of an attribute of the record.

- (NSArray *)valuesForAttribute:(ODAttributeType)inAttribute error:(NSError **)outError
Parameters
inAttribute

The attribute.

outError

An error reference for error details. Can be nil.

Return Value

An array of attribute values. Elements are of type NSString or NSData.

Availability
  • Available in OS X v10.6 and later.
Declared In
ODRecord.h

verifyExtendedWithAuthenticationType:authenticationItems:continueItems:context:error:

Verifies the credentials for interaction with the record’s node using other types of authentication available to Open Directory.

- (BOOL)verifyExtendedWithAuthenticationType:(ODAuthenticationType)inType authenticationItems:(NSArray *)inItems continueItems:(NSArray **)outItems context:(id *)outContext error:(NSError **)outError
Parameters
inType

The authentication type.

inItems

An array of NSString or NSData objects to be used in the authentication process.

outItems

An array of NSData objects returned from the authentication process, if any are returned; nil otherwise.

outContext

The proper context if the authentication attempt requires a context; nil otherwise. If not nil, then more calls must be made with the Context to continue the authentication.

outError

An error reference for error details. Can be nil.

Return Value

YES if verification succeeds; otherwise, NO.

Availability
  • Available in OS X v10.6 and later.
Declared In
ODRecord.h

verifyPassword:error:

Verifies the password for interaction with the record.

- (BOOL)verifyPassword:(NSString *)inPassword error:(NSError **)outError
Parameters
inPassword

The password for authenticating with the record.

outError

An error reference for error details. Can be nil.

Return Value

YES if verification succeeds; otherwise, NO.

Availability
  • Available in OS X v10.6 and later.
Declared In
ODRecord.h

Did this document help you? Yes It's good, but... Not helpful...