Skip to content

feat: 権限システムの実装 - #16

Merged
nomanoma121 merged 21 commits into
mainfrom
feat/access-control
Oct 6, 2026
Merged

nomanoma121 merged 21 commits into
mainfrom
feat/access-control

Conversation

@nomanoma121

Copy link
Copy Markdown
Collaborator

No description provided.

nomanoma121 and others added 15 commits June 10, 2026 09:13
XOR 単一テーブル設計をやめ、ユーザー付与(project_members)と
OIDC グループ付与(project_group_roles)を独立したテーブルに分割。
GetProjectMember・ListProjectGroupRolesByGroups クエリを追加し sqlc 再生成。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ProjectMember をユーザー専用に整理し、OIDCRole フィールドを削除。
ProjectGroupRole 型と ProjectGroupRoleRepository を追加。
ForbiddenError を domain に追加。
policy 判定(グローバル admin / owner / role→permission)を
Principal.Can として domain に集約。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
member.go を user-only に作り直し GetByUser を追加。
group_role.go を新規作成し ProjectGroupRoleRepository を実装。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
IssueSessionToken のシグネチャに roles []string を追加し JWT クレームに格納。
ParseSessionToken も roles を返すよう変更。
context.go に WithRoles / Roles を追加し、
interceptor でトークンパース時に ctx へセット。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
userRepo を廃止し auth.Roles(ctx) で OIDC ロールを取得。
GetByUser と ListByGroups を errgroup で並列実行し granted roles を収集。
policy 判定は Principal.Can に委譲。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ApplicationService と ProjectService に Authorizer を注入し
Write / Delete 操作に認可チェックを追加。
handler に connectError ヘルパーを追加し ForbiddenError を
PermissionDenied に変換。gateway.go で groupRoleRepo を追加し
authz.New の引数を更新。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nomanoma121
nomanoma121 marked this pull request as ready for review October 5, 2026 17:32
@nomanoma121
nomanoma121 merged commit ac675e6 into main Oct 6, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant