Created
April 7, 2010 06:28
-
-
Save russm/358599 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/macruby | |
framework 'OpenDirectory' | |
# returns false, this means it's already been loaded when OpenDirectory.framework was loaded? | |
framework 'OpenDirectory.framework/Frameworks/CFOpenDirectory' | |
session = ODSession.defaultSession | |
# returns ["/BSD/local", "/Local/Default"] - looks like a good session | |
session.nodeNamesAndReturnError nil | |
node = ODNode.nodeWithSession session, name:"/Local/Default", error:nil | |
# throws "NameError: uninitialized constant KODRecordTypeUsers" | |
query = ODQuery.queryWithNode node, forRecordTypes:KODRecordTypeUsers, attribute:KODAttributeTypeRecordName, matchType:KODMatchContains, queryValues:"rus", returnAttributes:KODAttributeTypeStandardOnly, maximumResults:0, error:nil | |
# throws "NameError: undefined local variable or method `kODRecordTypeUsers' for main:TopLevel" | |
query = ODQuery.queryWithNode node, forRecordTypes:kODRecordTypeUsers, attribute:kODAttributeTypeRecordName, matchType:kODMatchContains, queryValues:"rus", returnAttributes:kODAttributeTypeStandardOnly, maximumResults:0, error:nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment