Session.getActiveUser()。getEmail()解决方法,用于从电子表格中分发成绩 [英] Session.getActiveUser().getEmail() workaround for distributing grades from a spreadsheet

查看:128
本文介绍了Session.getActiveUser()。getEmail()解决方法,用于从电子表格中分发成绩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的学生都有一个谷歌帐户,但使用不同的电子邮件(如john@hotmail.com)。我试着写一个webapp,从我的成绩电子表格中获得一行,包含webapp用户的电子邮件地址,这样每个学生只会看到他或她的成绩。该webapp使用:Session.getActiveUser()。getEmail()

这仅适用于与脚本位于同一个域的用户,我必须将该脚本作为webapp运行用户(这没关系 - 我的学生相信我这么远!)。这是限制:


返回描述当前用户的用户对象。在
有限权限执行中(例如响应onOpen或
onEdit),如果
用户和脚本所有者都是相同的,我们只返回活动用户的身份域。这是
保护消费者用户的隐私,他们可能不希望他们的电子邮件
地址暴露。


我的脚本可以工作,但是我必须直接在脚本中放置分级表,并在每次更新电子表格时更新webapp。 Yeck!



我无法分享我的成绩电子表格,因为他们会看到彼此的成绩。所以现在我正在头脑风暴其他解决方法。



以下是一个例子:


  1. 分享第二张电子表格,从我的电子表格中复制成绩的更新功能。 Web应用程序从共享电子表格中吸取数据并进行解密。现在只需简单更新电子表格即可 - Web应用程序不需要重新发布。 (有一些简单的加密选项,比如base64encode,可能有点争执...?)
    找到一种自动更新webapp并重新发布的方法。 (不知道该怎么做。)


  2. ????


有什么建议吗?



PS:如果1似乎可行,那么对简单加密代码有一些建议?

解决方案

我不明白你为什么说我的脚本有效,但我必须将脚本直接放到脚本中,并在每次更新电子表格时更新webapp



创建一个web应用程序非常简单,该应用程序使用可伸缩表示电子表格的一部分。应用程序的每个实例都会自动提供与用户相关的内容,您只需更新主电子表格即可获得所需内容。我不知道你为什么要为此编码数据...我认为通过谷歌登录的用户身份应该够了,不是吗?
这是一个这样的web应用程序的例子,数字你看到的是从主电子表格中的特定列中获取的(对于此公开副本,我将应用程序设置为我来运行以避免授权过程,但是实际上每个用户都被识别并只能看到他的数据)。



电子表格本身和代码是此处可查看,如果您需要更多信息,请不要犹豫,马上回来。


My students all have a Google account, but use different emails (like john@hotmail.com).I tried to write a webapp that would get from my grade spreadsheet the row with the webapp's user's email address, so that each student would only see his or her grades. That webapp uses: Session.getActiveUser().getEmail()

This only works for users in the same domain as the script, I have to run the script as the webapp user (which is ok -- my students trust me that far!). Here is that restriction:

Returns a User object describing the current user. In limited-privilege executions (such as in response to onOpen or onEdit), we only return the identity of the active user if both the user and the script owner are part of the same domain. This is to protect the privacy of consumer users, who may not want their email address exposed.

My script works, but I have to put the table of grades directly in the script and update the webapp each time I update my spreadsheet. Yeck!

I can't share my grade spreadsheet because then they would see each other's grades. So now I am brainstorming other workarounds.

Here is one example:

  1. Share a second spreadsheet, copy the grades from my spreadsheet with an update function that encrypts the grades. The webapp sucks up the data from the shared spreadsheet and decrypts. Now a simple update of a spreadsheet is all that is needed -- the webapp doesn't need to be republished. (There are some simple encryption options, like base64encode with maybe a little scrambling...?)

  2. Find a way to automatically update the webapp and republish. (Don't know how to do that.)

  3. ????

Any suggestions?

PS: if 1 seems feasible, some suggestions for simple encryption code?

解决方案

I dont understand why you say "My script works, but I have to put the table of grades directly in the script and update the webapp each time I update my spreadsheet"

It is very easy to create a webapp that shows a part of a spreadsheet using a flextable for example. Each instance of the app will have a user related content automatically and you will only have to update your master spreadsheet to get what you want. I don't know why you want to encode data for this... I think the user identification through the google login should be enough, don't you ? Here is an example of such a webapp, the numbers you see are taken from a specific column in a master spreadsheet (for this public copy I set the app as running as "me" to avoid the authorization process but in real every user is identified and sees only his data).

The Spreadsheet itself and the code are viewable here, do not hesitate to come back if you need further information.

这篇关于Session.getActiveUser()。getEmail()解决方法,用于从电子表格中分发成绩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆