views:

170

answers:

2

I'm looking at ways to secure the admin section of my (cakephp powered) Facebook application. To avoid duplicating functionality, I thought it'd be neat to allow access to people who have been flagged as developers in the app settings.

The question could then be: How do I determine whether a user of my Facebook application is a developer?

Alternatively: How do I obtain an array of developer user IDs for my Facebook app?

+2  A: 

I tried looking for your answer myself, and the only thing I found that you could possibly do is to make a group private and invite-only to developers and then use the fb:if-is-group-member tag. http://wiki.developers.facebook.com/index.php/Fb:if-is-group-member

Samuel
That is an option I suppose. But if it means an extra layer of complication it kind of defeats the point for me.
Tom Wright
+2  A: 

OK, so I found out how to do it by myself. Props to Samuel for giving me the idea.

Basically, the way to do it is to run an FQL query that establishes whether a user is an admin of the applications page (page_admin).

SELECT uid FROM page_admin WHERE uid = 286302657 AND page_id = 31290624157

In the PHP client, this returns an array for developers and an empty string for anyone else.

I decided to use the FQL rather than the API call because it is possible to preload the FQL to reduce calls to the Facebook servers.

Hope this is useful to somebody.

Tom Wright
Nice, we just keep a list of admin network Id's in a web.config file. This is much more elegant.
jfar

related questions