個人アカウント向けの招待方式(pendingOwner)と一括承諾を追加する - #26
Draft
pollenjp wants to merge 1 commit into
Draft
Conversation
setOwner による直接譲渡は Workspace 同一ドメイン間でしか動かないため、 個人アカウント(gmail.com)向けに Drive API v3 の pendingOwner を使った 「招待 → 承諾」の 2 段階フローを追加する。 - 設定シートに B5「譲渡方式」(直接譲渡 / 招待方式)を追加 - 招待方式: ネイティブ形式のファイルのみ pendingOwner で招待し、 フォルダ・非ネイティブ形式(PDF/Office 等)は「対象外」として記録・スキップ - 受信側メニュー「所有権の譲渡を承諾する」を追加(accept.ts)。 台帳の「招待済み」行を読み role=owner + transferOwnership で一括承諾(再実行に安全) - 実行前ダイアログに招待方式の注意(ネイティブ限定・受信側の承諾が必要)を表示 - appsscript.json で Advanced Drive Service(Drive v3)を有効化 - 教科書(付録 B / 05 / 07 / 04 / README)を新機能に合わせて更新 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PG8YYqW1fQsT92uuEaY1M9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
既定の直接譲渡(
DriveApp.setOwner())は Google Workspace の同一ドメイン間でしか動きません。個人アカウント(gmail.com)宛て・別ドメイン宛ては「引数が無効です」「アクセスが拒否されました: DriveApp」で全件失敗します。そこで、個人アカウント向けに Drive API v3 の
pendingOwnerを使った 「招待 → 承諾」の 2 段階フロー(招待方式) を追加しました。変更内容
直接譲渡(Workspace 同一ドメイン向け)/招待方式(個人アカウント向け・ネイティブ形式のみ)の 2 択プルダウン(初期値は直接譲渡)。想定外の値は安全側(直接譲渡)に倒すtransfer.tsの譲渡処理を方式で分岐。招待方式ではDrive.Permissions.create({ role:'writer', type:'user', emailAddress, pendingOwner:true })で招待accept.tsを追加。台帳の「招待済み」かつ譲渡先 = 自分の行を読み、Drive.Permissions.update({ role:'owner' }, …, { transferOwnership:true })で一括承諾。既に承諾済みの ID は除外するため再実行に安全。6 分制限に達したら残数を返し「再実行してください」と案内appsscript.jsonのenabledAdvancedServicesで Advanced Drive Service(Drive v3)を有効化(スコープ.../auth/driveは既存)accept.ts追加)、README使い方(要約)
検証
tsc --noEmit(strict)/npm run build(dist に accept.js を含む 6 本 + manifest 出力)ともにエラーなし@types/google-apps-scriptの Drive v3(Drive.Permissions.create/list/update)で確認既知の制限
Permissions.createが競合しうる(その場合は台帳にエラーが記録される)🤖 Generated with Claude Code
Generated by Claude Code