Open
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
spec-core | 34842e9 | Commit Preview URL Branch Preview URL |
Feb 18 2026, 02:58 PM |
There was a problem hiding this comment.
Pull request overview
管理者権限を単一の admin claim から役職別(account / infra)claim に分割し、認可チェックを OpenAPI スコープ中心へ移行するPRです。あわせて、管理者用グループ作成のための専用エンドポイント追加と、関連するSQL/シード/ドキュメント更新が含まれます。
Changes:
adminclaim 廃止 →account/infraへ刷新し、AdminClaimsを導入して参照箇所/SQLを更新POST /mail/POST /activity/checkout/{userId}/PUT /budget/{budgetId}/adminなどの認可を OpenAPI スコープへ移行(コード内チェック削除/変更)POST /group/adminを追加し、グループ作成フローと仕様書/シードデータを更新
Reviewed changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| schema/test/insert_test.sql | admin から infra/account グループへテストシードを更新 |
| pkg/user/users.go | isAdmin 判定SQLに AdminClaims を渡すよう更新 |
| pkg/mail/post_mail.go | 管理者チェック削除(OpenAPIスコープ側へ移行) |
| pkg/group/post_group_admin.go | 新規:POST /group/admin のユースケース実装 |
| pkg/group/post_group.go | isAdminGroup ロジック削除(通常グループ作成に寄せる) |
| pkg/group/group.go | adminグループ判定を AdminClaims ベースに変更 |
| pkg/group/get_user_user_id_group.go | グループ取得SQLへ AdminClaims を渡すよう更新 |
| pkg/group/get_group_group_id.go | グループ詳細取得SQLへ AdminClaims を渡すよう更新 |
| pkg/group/get_group.go | グループ一覧取得SQLへ AdminClaims を渡すよう更新 |
| pkg/db/sql/user/select_user_profile_from_user_id.sql | is_admin を IN /*adminClaims*/ で判定するよう変更 |
| pkg/db/sql/group/select_group_is_admin_group.sql | adminグループ判定を IN /*adminClaims*/ に変更 |
| pkg/db/sql/group/select_group_from_user_id.sql | adminグループ判定JOINを IN /*adminClaims*/ に変更 |
| pkg/db/sql/group/select_group_from_group_id.sql | adminグループ判定JOINを IN /*adminClaims*/ に変更 |
| pkg/db/sql/group/select_group.sql | adminグループ判定JOINを IN /*adminClaims*/ に変更 |
| pkg/db/sql/admin/select_user_is_admin.sql | 管理者判定を IN /*adminClaims*/ に変更 |
| pkg/db/sql/admin/select_user_has_claim.sql | 新規:特定claim保有チェック用SQLを追加 |
| pkg/api/spec.gen.go | OpenAPI生成物の更新 |
| pkg/api/server/post_group_admin.go | 新規:POST /group/admin ハンドラ追加 |
| pkg/api/server.gen.go | 新エンドポイント登録とスコープ(infra/account)更新 |
| pkg/api/models.gen.go | ReqPostGroupAdmin 追加、ReqPostGroup から isAdminGroup 削除(生成物) |
| pkg/admin/admin.go | AdminClaims 導入、CheckUserHasClaim 追加 |
| pkg/activity/put_activity_record_record_id.go | 他人編集の条件付き認可を infra claim に変更 |
| pkg/activity/post_activity_checkout_user_id.go | コード内管理者チェック削除(OpenAPIスコープへ移行) |
| document/schemas/req_post_group_admin.yml | 新規:POST /group/admin 用schema追加 |
| document/schemas/req_post_group.yml | isAdminGroup フィールド削除 |
| document/schemas.yml | ReqPostGroupAdmin をcomponentsへ追加 |
| document/paths/mail.yml | POST /mail のスコープを infra に変更 |
| document/paths/group_admin.yml | 新規:POST /group/admin パス定義追加 |
| document/paths/budget_budget_id_admin.yml | PUT /budget/{budgetId}/admin を account スコープへ変更 |
| document/paths/activity_checkout_user_id.yml | POST /activity/checkout/{userId} を infra スコープへ変更 |
| document/paths.yml | /group/admin パスを追加 |
| document/bundle.gen.yml | OpenAPIバンドル生成物の更新 |
| docs/admin_spec.md | 新規:権限/グループ管理仕様とローカルテスト手順の追加 |
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.
概要
管理者権限の仕組みを単一の
adminclaim から、役職別のaccount(会計)/infra(インフラ)claim に刷新します。また、コード内に散在していた権限チェックを OpenAPI スコープによる一元管理に移行しました。
主な変更点
権限モデルの変更
adminという汎用 claim を廃止し、account(会計)とinfra(インフラ)の役職 claim に分割AdminClaims = []string{"account", "infra"}としてpkg/admin/admin.goで一元定義isAdminフラグ(GET /user/me)はいずれかの役職 claim を持つユーザーでtrueになる認可チェックの整理
CheckUserIsAdmin)を削除し、OpenAPI スコープで一元管理POST /activity/checkout/{userId}:BearerAuth: [infra]に変更、コード内チェック削除POST /mail:BearerAuth: [infra]に変更(旧admin)、コード内チェック削除PUT /budget/{budgetId}/admin:BearerAuth: [account]に変更(旧admin)PUT /activity/record/{recordId}は条件付き認可のためCheckUserHasClaim(..., "infra")を使用(OpenAPI で表現不可のため残存)POST /group/admin新エンドポイント追加infraclaim を持つユーザーが任意の claim を持つグループを作成できる専用エンドポイントPOST /groupのisAdminGroupフィールドを廃止し、専用エンドポイントに分離テストデータ更新(
schema/test/insert_test.sql)adminグループ →infraグループ(山田次郎)に変更accountグループ(田中太郎)を追加仕様書追加
docs/admin_spec.md: 管理者権限・グループ管理の仕様書を新規追加テスト手順
docs/admin_spec.mdのセクション「ローカル環境でのテスト手順」を参照してください。🤖 Generated with Claude Code