Group Identity Programming
Group Identity Programming
- Subject: Group Identity Programming
- From: Jessica Billings <email@hidden>
- Date: Tue, 28 Apr 2009 10:58:22 -0400
Hi all,
First of all, I apologize because I have only been developing Cocoa for a
few months and I'm learning as I go. Hopefully I'm not making some newbie
mistake.
I am trying to write a program that, among other things, generates a list of
user and group identities using the identity picker and then checks to see
if the logged-on user matches any user identity or is a member of any group.
I can do the first task, but I am having trouble with the group identity
part.
My main issue, I believe, is that I cannot get to the group-specific
attributes ("gid" and "members"). I have tried the function
"identityWithName:authority:" two different ways:
CBGroupIdentity *groupID = [CBGroupIdentity identityWithName:[tmpArray
objectAtIndex:i] authority:[CBIdentityAuthority defaultIdentityAuthority]];
CBGroupIdentity *groupID = [CBIdentity identityWithName:[tmpArray
objectAtIndex:i] authority:[CBIdentityAuthority defaultIdentityAuthority]];
The "tmpArray objectAtIndex:i" is an NSString representation of the group's
name, but I have also tried it with the UUID.
This gives me the warning "initilization from distinct Objective-C type".
When I try to call "members" or "posixGID" on either of these, the program
hangs.
Also, I have tried to just circumvent creating a group identity and get to
the heart of the matter by doing the following, using a test group I
generated myself on the local machine (the other groups were made by someone
else and are not local groups):
NSString *user = NSUserName();
CBIdentity *localIdentity = [CBIdentity identityWithName:user
authority:[CBIdentityAuthority defaultIdentityAuthority]];
[localIdentity isMemberOfGroup:[CBGroupIdentity identityWithName:@"test_group"
authority:[CBIdentityAuthority localIdentityAuthority]]];
This hangs the program.
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).
I have both the Collaboration and Foundation frameworks imported.
If anyone can help me with this, I'd really appreciate it. This is driving
me insane.
Thanks,
Jessica
_______________________________________________
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