简体   繁体   English

找出fb用户在Spring Social / Java中是否是应用程序管理员

[英]Find out if a fb user is app admin in spring social/java

Im developing a Facebook app with java and spring social. 我用Java和Spring Social开发了一个Facebook应用。 Is it possible to find out if a logged in user is admin of the current app? 是否可以找出登录用户是否是当前应用程序的管理员? I have been looking through the api but cannot find anything. 我一直在通过api查找,但找不到任何东西。 Or is there any other good way to do this with java. 还是有其他好的方法可以使用Java做到这一点。

Update: I did not find an specific api call in spring social to do this but it is possible to do the following which returns a json string with all the roles for the app. 更新:我没有在spring social中找到特定的api调用来执行此操作,但是可以执行以下操作,该操作返回具有应用程序所有角色的json字符串。

facebook.restOperations().getForObject("https://graph.facebook.com/APP_ID/roles?access_token=your app token", String.class);

Call the Graph API with an HTTP GET to /me/accounts with that user's access token with manage_pages permission. 使用具有该用户访问令牌且具有manage_pages许可权的HTTP GET调用Graph API到/me/accounts If you see the app listed there, then they're an admin or a developer. 如果您在此处看到该应用程序,则他们是管理员或开发人员。

Or you can use an FQL call. 或者,您可以使用FQL调用。 See: http://developers.facebook.com/docs/reference/fql/page_admin/ 请参阅: http : //developers.facebook.com/docs/reference/fql/page_admin/

SELECT page_id, type from page_admin WHERE uid=me() and see if the user is on that list. SELECT page_id, type from page_admin WHERE uid=me()然后查看用户是否在该列表中。

EDIT 编辑

I just found a third way to check if a specific user is an admin of the Page, issue an HTTP GET request with the appropriate PAGE_ID, Page Access Token, and USER_ID to https://graph.facebook.com/PAGE_ID/admins/USER_ID 我只是找到了第三条道路,以检查是否特定用户是页的管理员,发出带有适当PAGE_ID,页面访问令牌的HTTP GET请求,并USER_ID到https://graph.facebook.com/PAGE_ID/admins/USER_ID

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM