【问题标题】:How to give a permission to restrict download a file from google drive?如何授予限制从谷歌驱动器下载文件的权限?
【发布时间】:2018-07-25 07:25:31
【问题描述】:

我正在使用 Google 云端硬盘来共享我的文件,例如 pdf 或 word。我想授予共享者仅查看该文件而不是下载的权限。从谷歌驱动器界面我可以设置该权限,但如何以编程方式设置它。我正在使用 PHP 进行开发。

【问题讨论】:

    标签: php google-drive-realtime-api google-drive-shared-drive


    【解决方案1】:

    使用permissions.create 向用户、组或域授予额外权限。

    虽然不完全相关,但SO post 演示了如何使用 PHP 为文件创建权限:

    //Give everyone permission to read and write the file
    $permission = new Google_Permission();
    $permission->setRole( 'writer' );
    $permission->setType( 'anyone' );
    $permission->setValue( 'me' );
    $service->permissions->insert( $file->getId(), $permission );
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多