谷歌应用程序引擎授权

发布于 2024-09-26 03:16:47 字数 239 浏览 14 评论 0原文

请帮忙。如何验证用户的组成员身份?只有少数 Google 群组的用户可以访问 appengine (python) 网站上的某些页面。
验证群组成员资格对我的问题给出了否定答案,但它已经是一年前的事了,也许有些事情已经改变了。

Please, help. How can I validate user's group membership? Only users of a few google groups can access some pages on the site on appengine (python).
validating group membership gives a negative answer to my question, but it was a year ago, maybe something has changed..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

拥抱没勇气 2024-10-03 03:16:47

目前没有 Google 网上论坛 API,因此无法确定用户是否是 Google 网上论坛的成员。

There's currently no Google Groups API, and thus no way to determine if a user is a member of a Google Group.

止于盛夏 2024-10-03 03:16:47

可能会迟到,但对于发现此问题的其他人来说,这是我的解决方案:

在驱动器中创建一个新的 AppScript,然后将其发布为 Web 服务,您可以使用类似以下代码的内容来检查用户是否在组中:

// General context variables
var group = GroupsApp.getGroupByEmail("[email protected]");

function doGet(request) {
var result = {
authorized: group.hasUser(request.parameter.mail)
};
return ContentService.createTextOutput(JSON.stringify(result)).setMimeType(ContentService.MimeType.JSON);
}

之后发布它,您将获得一个可以访问的网址,只需附加 [email protected]< /a> 查询特定电子邮件地址的组成员资格。

May be late but just for others who find this, here's my solution to this:

Create a new AppScript in drive which you then publish as webservice, you can use something like following code to check if a user is in the group or not:

// General context variables
var group = GroupsApp.getGroupByEmail("[email protected]");

function doGet(request) {
var result = {
authorized: group.hasUser(request.parameter.mail)
};
return ContentService.createTextOutput(JSON.stringify(result)).setMimeType(ContentService.MimeType.JSON);
}

After publishing it, you will get a url which you can access, just append [email protected] to query group membership for the specific email address.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文