google-apps脚本用户必须授予OWN驱动器在app-server驱动器中打开电子表格的权限? [英] google-apps script user must give permission on OWN drive to open spreadsheet in app-server's drive?

查看:134
本文介绍了google-apps脚本用户必须授予OWN驱动器在app-server驱动器中打开电子表格的权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好google电子表格脚本, b
$ b

脚本发布商在发布商的驱动器中有电子表格。该脚本确实openByURL。



问题:Google允许用户授予脚本授权,以更新用户驱动器中的所有电子表格。



那不是脚本的地方!为什么用户想让发布者访问用户驱动器中的所有电子表格?



我的要求是:用户和脚本发布者是陌生人。脚本用户拒绝将用户的云端硬盘暴露给脚本发布者。

发布者希望保留专有逻辑未暴露的地方,隐藏在脚本函数中(scriptnames_)

  //脚本作为应用程序模板。 
函数doGet(){
var app = UiApp.createApplication();

url =https://docs.google.com/spreadsheet/ccc?key=xxx_X'd_out_xxxxxxxxxxx&usp=sharing;
var doc = SpreadsheetApp.openByUrl(url);
var spreadsheet_link = app.createAnchor('< br>< br>电子表格打开',doc.getUrl()).setId(< br>< br>电子表格链接);
app.add(spreadsheet_link);

返回应用;

$ / code>

(是的,我知道我可以通过电子表格向发布者发送电子邮件给用户,但我仍然坚持要求授权给发布者脚本的用户,这仍然会导致Google请求对脚本的授权,以修改用户驱动器上的所有电子表格。)



<如果这是旧讨论的重演,道歉。我搜查过,并没有看到它的措辞。谢谢!

解决方案

正如Serge所说



ANSWER


授予驱动器中的电子表格访问权限并不意味着允许访问所有电子表格,只有用户共享的
与脚本发布者(或公开或与任何有链接的人)


我尝试访问用户的GoogleDrive中的私人电子表格并且该脚本确实在执行时出错:

 无法打开ID为0Ak2222Ho-SXL222222222222222222的文档:
您无权访问请求的文档。

我不知道如何将问题标记为Serge在评论中所说的回答,我会在这里回答问题,希望问题得到解答。谢谢

Hi google spreadsheet scripters,

script publisher has spreadsheet in publisher's drive. The script does openByURL.

Problem: Google makes user grant authorization for script to update all spreadsheets in user's drive.

That's not where the script is! Why would user want to give publisher access to all spreadsheets in user's drive?

My requirements are: user and script publisher are strangers. Script user refuses to expose user's Drive to script publisher.

Publisher wants to keep proprietary logic unexposed, in hidden script functions (scriptnames_)

// Script-as-app template.
function doGet() {
  var app = UiApp.createApplication();

  url = "https://docs.google.com/spreadsheet/ccc?key=xxx_X'd_out_xxxxxxxxxxx&usp=sharing";
  var doc = SpreadsheetApp.openByUrl(url);
  var spreadsheet_link = app.createAnchor('<br><br> spreadsheet open ', doc.getUrl()).setId("<br>    <br>spreadsheet link");
  app.add(spreadsheet_link);  

  return app;
}

(Yes, I know I could have publisher email a spreadsheet to the user, but I'd still be stuck with the user needing to grant authorizations to publisher's script, which would still cause Google to request authorization for script to modify all spreadsheets on user's drive.)

Apologies if this is rehash of old discussion. I searched and don't see it worded like this. Thanks!

解决方案

As Serge said

ANSWER

granting access to spreadsheets in drive does not mean giving access to all spreadsheets, only the ones that user shares with script publisher (or publicly or "to anyone with the link")

I tested by trying to access a private spreadsheet in user's GoogleDrive and the script did indeed get an error on execution:

Couldn't open document with id 0Ak2222Ho-SXL222222222222222222: 
You do not have permissions to access the requested document.

I don't know how to mark the question as answered from what Serge said in his comment, so I'll put the answer here so hopefully the question gets marked as answered. Thanks

这篇关于google-apps脚本用户必须授予OWN驱动器在app-server驱动器中打开电子表格的权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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