Open
Conversation
06f2c1b to
1b777d0
Compare
1b777d0 to
8167609
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new permissions subsystem (storage, gRPC admin/plugin endpoints, and change events) including expiry-driven refresh behavior.
Changes:
- Introduces permissions/group persistence layer and Flyway migration (V2) for permissions tables.
- Adds gRPC admin + plugin services/handlers plus event publishing/subscription for permission changes.
- Adds scheduled expiry scanning and startup/subscription resume refresh emission, with unit tests.
Reviewed changes
Copilot reviewed 32 out of 33 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/resources/db/migration/V2__create_permissions.sql | Creates DB tables for permission groups, group permissions, player groups, and player permissions. |
| src/main/resources/application.properties | Enables new proto scan artifact and configures expiry scan interval (also changes log level). |
| build.gradle.kts | Adds scheduler dependency and permission proto contracts dependency. |
| devspace.yaml | Updates image repository/tag used for deployment/dev. |
| src/main/kotlin/gg/grounds/domain/permissions/ApplyOutcome.kt | Defines apply outcomes used across repositories/handlers. |
| src/main/kotlin/gg/grounds/domain/permissions/PermissionGroup.kt | Adds domain model for groups and permission grants. |
| src/main/kotlin/gg/grounds/domain/permissions/PlayerPermissionsData.kt | Adds domain model for player permissions/groups and effective permissions. |
| src/main/kotlin/gg/grounds/persistence/permissions/BatchUpdateHelper.kt | Adds helper to interpret JDBC batch update results. |
| src/main/kotlin/gg/grounds/persistence/permissions/PermissionsRepositoryException.kt | Adds repository exception for “hard” query failures in group repo. |
| src/main/kotlin/gg/grounds/persistence/permissions/GroupRepository.kt | Implements CRUD/list operations for permission groups and group permissions. |
| src/main/kotlin/gg/grounds/persistence/permissions/PlayerGroupRepository.kt | Implements add/remove/query operations for player group memberships and expirations. |
| src/main/kotlin/gg/grounds/persistence/permissions/PlayerPermissionRepository.kt | Implements add/remove/query operations for direct player permissions and expirations. |
| src/main/kotlin/gg/grounds/persistence/permissions/PermissionsQueryRepository.kt | Implements permission read model (get permissions + check permission). |
| src/main/kotlin/gg/grounds/persistence/PlayerSessionRepository.kt | Adds listActivePlayers() to support refresh-on-resume behavior. |
| src/main/kotlin/gg/grounds/api/permissions/ApplyResultMapper.kt | Maps internal ApplyOutcome to proto ApplyResult. |
| src/main/kotlin/gg/grounds/api/permissions/PermissionsRequestParser.kt | Centralizes parsing/sanitization for player IDs, grants, memberships, expiries. |
| src/main/kotlin/gg/grounds/api/permissions/PermissionsProtoMapper.kt | Maps domain permissions models to gRPC reply protos. |
| src/main/kotlin/gg/grounds/api/permissions/PermissionsPluginGrpcService.kt | Adds plugin-facing gRPC endpoints to fetch permissions and check permission. |
| src/main/kotlin/gg/grounds/api/permissions/PermissionsAdminGrpcService.kt | Adds admin-facing gRPC endpoints for groups/permissions/player assignments. |
| src/main/kotlin/gg/grounds/api/permissions/admin/GroupAdminHandler.kt | Implements admin group operations and emits deltas/refreshes when needed. |
| src/main/kotlin/gg/grounds/api/permissions/admin/PlayerGroupsAdminHandler.kt | Implements admin player-group operations and emits player deltas. |
| src/main/kotlin/gg/grounds/api/permissions/admin/PlayerPermissionsAdminHandler.kt | Implements admin player-permission operations and emits player deltas. |
| src/main/kotlin/gg/grounds/api/permissions/events/PermissionsEventsPublisher.kt | Adds event publisher backing the gRPC streaming endpoint. |
| src/main/kotlin/gg/grounds/api/permissions/events/PermissionsChangeEmitter.kt | Builds and publishes refresh/delta events for permission changes. |
| src/main/kotlin/gg/grounds/api/permissions/events/PermissionsChangeService.kt | Wraps mutations to emit deltas if permissions changed. |
| src/main/kotlin/gg/grounds/api/permissions/events/PermissionsEventsGrpcService.kt | Adds gRPC streaming endpoint for permission change events and resume refresh logic. |
| src/main/kotlin/gg/grounds/api/permissions/events/PermissionsExpiryScheduler.kt | Adds periodic expiry scanning + startup refresh behavior. |
| src/main/kotlin/gg/grounds/api/PlayerPresenceGrpcService.kt | Improves validation/logging for login/logout flows. |
| src/test/kotlin/gg/grounds/api/permissions/PermissionsPluginGrpcServiceTest.kt | Adds tests for plugin permissions endpoints and validation/errors. |
| src/test/kotlin/gg/grounds/api/permissions/admin/GroupAdminHandlerTest.kt | Adds tests for group admin handler behavior and validation. |
| src/test/kotlin/gg/grounds/api/permissions/admin/PlayerGroupsAdminHandlerTest.kt | Adds tests for player-group admin handler behavior and validation. |
| src/test/kotlin/gg/grounds/api/permissions/admin/PlayerPermissionsAdminHandlerTest.kt | Adds tests for player-permission admin handler behavior and validation. |
| src/test/kotlin/gg/grounds/api/permissions/events/PermissionsEventsGrpcServiceTest.kt | Adds tests for subscription resume refresh behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/main/kotlin/gg/grounds/api/permissions/events/PermissionsEventsGrpcService.kt
Show resolved
Hide resolved
src/main/kotlin/gg/grounds/api/permissions/admin/PlayerGroupsAdminHandler.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/gg/grounds/api/permissions/events/PermissionsChangeService.kt
Outdated
Show resolved
Hide resolved
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.
Pull Request
Description
Type of Change
Related Issues
None
Testing
Checklist