Discussion:
How to find out an account is a user or group
sting1999
2009-04-11 08:38:26 UTC
Permalink
Hi All,

Does anyone know a clean way to find out whether an account is a
Google Apps user or group?

Here is a messy solution because there may be potentially 3 calls to
get the answer:
1. query the UserService.query() for the userEntry
-return a user or throw an exception
2. if the #1 throw an exception, query GroupService.retrieveGroup()
-return a group or throw an excepton
3. if #2 throw an exception, there is no such account.

Is there an API that will the account type or exception in just one
call to the server?

Thanks,
Sting
Anirudh (Google)
2009-04-13 04:58:55 UTC
Permalink
Hi Sting,

There is no single call to the server that can determine the account
type. The steps you have listed are the best way of determining the
account type.
If you can explain your use case , may be we can optimize the process
and reduce the number of calls in your algorithm.

-Anirudh
Post by sting1999
Hi All,
Does anyone know a clean way to find out whether an account is a
Google Apps user or group?
Here is a messy solution because there may be potentially 3 calls to
1. query the UserService.query() for the userEntry
-return a user or throw an exception
2. if the #1 throw an exception, query GroupService.retrieveGroup()
-return a group or throw an excepton
3. if #2 throw an exception, there is no such account.
Is there an API that will the account type or exception in just one
call to the server?
Thanks,
Sting
Loading...