Return to Snippet

Revision: 21126
at December 3, 2009 21:28 by iloveitaly


Initial Code
- (BOOL) isActiveUser {
	NSDictionary *sessionInfo = (NSDictionary *) CGSessionCopyCurrentDictionary();
	
	NSString *shortUserName = [sessionInfo valueForKey:kCGSessionUserNameKey];
	NSString *userUID = [sessionInfo valueForKey:kCGSessionUserIDKey];
	BOOL userIsActive = [[sessionInfo valueForKey:kCGSessionOnConsoleKey] boolValue];
	NSString *loginCompleted = [sessionInfo valueForKey:kCGSessionLoginDoneKey];
	
	NSLog(@"Session information: %@", sessionInfo);
	
	return userIsActive;
}

Initial URL
http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPMultipleUsers/Concepts/FastUserSwitching.html

Initial Description

                                

Initial Title
Check If Active Console / GUI User

Initial Tags
window, mac, server, user

Initial Language
C