Re: Group Identity Programming
Re: Group Identity Programming
- Subject: Re: Group Identity Programming
- From: Jessica Billings <email@hidden>
- Date: Wed, 29 Apr 2009 09:36:03 -0400
>> The third thing I tried is getting the gid using:
>> gid_t curGroupID = getgid(); OR
>> int curGroupID = getgid();
>> CBGroupIdentity *groupIdentity = [CBGroupIdentity
>> groupIdentityWithPosixGID:curGroupID authority:[CBIdentityAuthority
> defaultIdentityAuthority]];
>>
> When I try to show the gid using NSLog, it hangs the program. When I
>> show
>> the groupIdentity object, it returns (null).
>The above is better. What does the debugger show for curGroupID? There
>is no reason to hang on NSLog if for curGroupID, as it is really juts
>an unsigned int. What is the NSLog code you are using?
Thank you for your help!
The reason NSLog was hanging is that I was using the wrong formatting token.
When I use:
NSLog(@"current group id: %i", curGroupID);
I get "current group id: 1612776775", which I'm assuming is right. However,
I am still getting "Current group info: (null)" when I do:
CBGroupIdentity *groupIdentity = [CBGroupIdentity
groupIdentityWithPosixGID:curGroupID authority:[CBIdentityAuthority
defaultIdentityAuthority]];
NSLog(@"Current group info: %@", groupIdenditity);
Unfortunately, I don't know if solving this problem will solve my ultimate
problem (although I'm sure it will help!). My ultimate problem is that I
have a number of group identities chosen by the identity picker. I need to
look at their member lists and see if the logged-in user is in any of those
lists. What I can't figure out is how to get access to the member lists of
the groups that I get using the identity picker. I think this has to do with
the fact that the identity picker returns CBIdentity objects, but how would
one make a CBGroupIdentity object using the information from the CBIdentity
object for a particular group identity? The only way I can see to make a
CBGroupIdentity object is using the above code, but as the documentation
says:
"The getgid() function returns the real group ID of the calling process ...
The real group ID is specified at login time.
The real group ID is the group of the user who invoked the program."
What group is this referring to? If I made a local "test_group" and put the
user in that, would it be the gid of "test_group"? What if the user is an
many groups, both local and managed? This is the heart of my problem.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden