作为共同管理员,如何移动另一个用户帐户中的文件夹?

As Co-Admin, how to move folder in another user's account?

我正在更新一个用户管理脚本,当有人离开我们公司时我们会执行该脚本。

该应用程序与共同管理员帐户保持一致,并启用了所有各种企业范围("Manage webhooks v2" 除外)。 "Read and write all files and folders stored in Box" 范围也被检查。

哦,我正在使用 Python SDK。

基本上,流程如下:

  1. 首先,我们将分隔用户“0”(顶级)文件夹移动到另一个帐户。这是一种自定义函数,我们通过 PUT 使用 JSON 参数 owned_by 调用 /users//folders/0:<new_user_id>

  2. 接下来我们要将该文件夹移动到 <new_user_id> 的子文件夹下。代码如下所示:

    client.folder(folder_id=folder_to_move_id).as_user(new_user_id_obj_from_step_1).move(client.folder(folder_id=new_parent_folder_id))
    

    但是,这会导致以下错误:

    boxsdk.exception.BoxAPIException:
    Message: None
    Status: 403
    Code: None
    Request id: None
    Headers: {'Content-Length': '0', 'Age': '0', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'Server': 'ATS', 'Connection': 'keep-alive', 'Date': 'Fri, 07 Apr 2017 22:52:43 GMT', 'WWW-Authenticate': 'Bearer realm="Service", error="insufficient_scope", error_description="The request requires higher privileges than provided by the access token."'}
    URL: https://api.box.com/2.0/folders/23596411401
    Method: PUT
    Context info: None
    

四处搜索这个 "insufficient_scope" 错误,让我觉得我的访问令牌需要请求一些不同的 scope,但是 (a) 我不清楚是哪个 scope,并且 (b) 我我不确定如何在脚本中更改范围。也许我应该以不同的方式处理这个问题?

感谢任何反馈。

Box forums 上得到了这个问题的答案。看起来我们需要请求为我们的应用程序启用 GCM 范围,这必须通过支持来完成。