• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Group Identity Programming
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Group Identity Programming


  • Subject: Re: Group Identity Programming
  • From: Greg Guerin <email@hidden>
  • Date: Wed, 29 Apr 2009 11:33:39 -0700

Jessica Billings wrote:

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?


CBGroupIdentity is a subclass of CBIdentity. So in the NSArray of CBIdentity items returned from the identity picker, you test whether each item is a CBGroupIdentity or not using the normal Objective-C mechanism:

 [someItem isKindOfClass:CBGroupIdentity]

Once you've identified a CBGroupIdentity, then type-cast it to (CBGroupIdentity*). Then test whether the CBIdentity of the current user is a member of that group using the -members method and searching the resulting NSArray. The search should be recursive, since I saw nothing prohibiting nested membership, only a prohibition against circular membership.

Of course, if the array of CBIdentity's from the identity picker doesn't contain any groups, then the user isn't going to be a member of any of them, and you search the identity picker's NSArray for CBIdentity presence. If that sounds like a recursive search of a group's -members NSArray, it is.

To me, the problem doesn't seem to have anything to do with group identity per se. It seems to hinge entirely on the subclass/ superclass relationship, and identifying specific subclass types.

It's possible I've made an error in the above. I only spent a few minutes reading the class docs and Identity Services Programming Guide, and without looking any further, this seems like the simplest thing that might work.

  -- GG

_______________________________________________

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


  • Prev by Date: Re: Group Identity Programming
  • Next by Date: Re: CA -animator animation only works the first time
  • Previous by thread: Re: Group Identity Programming
  • Next by thread: NSArrayController: Objects with empty strings
  • Index(es):
    • Date
    • Thread