You can use the NSUserName() function which returns an NSString. That would allow you to check if they're "guest", but wouldn't necessarily tell you if they have admin privileges. You could also maybe do something like call the UNIX 'id' function from an NSTask, which would show if the user is a member of group 80 (admin). There might be an easier or better way, I'm not sure, but those are a couple options.
You can use the NSUserName() function which returns an NSString. That would allow you to check if they're "guest", but wouldn't necessarily tell you if they have admin privileges. You could also maybe do something like call the UNIX 'id' function from an NSTask, which would show if the user is a member of group 80 (admin). There might be an easier or better way, I'm not sure, but those are a couple options.
EDIT: On further investigation, it appears there is an Objective-C SFAuthorization class that might do what you want. Check out the obtainWithRight:flags:error: method, which mentions "pre-authorizting", which sounds like it checks if the user has certain privileges.
'id' is a command, not a function. A function would be a C function, like getgroups(), which can be called directly rather than being executed through NSTask.
In any case, the OP's basic premise is flawed. Just because the current user ID doesn't have admin privileges doesn't mean the person using the computer doesn't know the admin password. I usually run as a non-admin user, and only authenticate as needed. The program as described would incorrectly warn me that I'm not an admin user. The OP needs to read "Authorization Services Programming Guide":
http://developer.apple.com/library/...roduction.html#//apple_ref/doc/uid/TP30000995