Add cedarPolicy field to group creation and update APIs#1668
Open
Add cedarPolicy field to group creation and update APIs#1668
Conversation
Expose cedarPolicy through backend DTOs, responses, and use cases for creating and updating user groups. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Expose cedarPolicy through group-related DTOs/responses and allow clients to provide/update it during group creation and group title update flows.
Changes:
- Add
cedarPolicyto group response/data structures (FoundGroupResponseDto,FoundGroupDataInfoDs, connection/group DTO builders). - Allow
cedarPolicyto be provided on group creation (CreateGroupInConnectionDTO/DS + use case). - Allow
cedarPolicyto be provided on group title update (UpdateGroupTitleDto+ use case) and invalidate Cedar policy cache.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| backend/src/entities/group/utils/biuld-found-group-response.dto.ts | Include cedarPolicy in found-group response builder. |
| backend/src/entities/group/use-cases/update-group-title.use.case.ts | Accept/update cedarPolicy, adjust uniqueness check, invalidate Cedar cache, return cedarPolicy. |
| backend/src/entities/group/dto/update-group-title.dto.ts | Add optional/nullable cedarPolicy to update-title DTO. |
| backend/src/entities/group/dto/found-group-response.dto.ts | Add optional/nullable cedarPolicy to group response DTO. |
| backend/src/entities/group/application/data-sctructures/found-user-groups.ds.ts | Add optional/nullable cedarPolicy to group data structure. |
| backend/src/entities/connection/utils/build-found-user-group-in-connection-dto.util.ts | Include cedarPolicy in group-in-connection DTO builder. |
| backend/src/entities/connection/use-cases/create-group-in-connection.use.case.ts | Accept optional cedarPolicy and default-generate when missing; invalidate Cedar cache. |
| backend/src/entities/connection/connection.controller.ts | Pass cedarPolicy from request body into group creation input. |
| backend/src/entities/connection/application/dto/found-user-groups-in-connection.dto.ts | Add optional/nullable cedarPolicy to connection groups DTO. |
| backend/src/entities/connection/application/dto/create-group-in-connection.dto.ts | Add optional/nullable cedarPolicy to create-group DTO. |
| backend/src/entities/connection/application/data-structures/create-group-in-connection.ds.ts | Add optional/nullable cedarPolicy to create-group DS. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+16
to
+19
| @IsOptional() | ||
| @IsString() | ||
| @ApiProperty({ required: false, nullable: true }) | ||
| cedarPolicy?: string | null; |
Comment on lines
+39
to
+45
| savedGroup.cedarPolicy = | ||
| cedarPolicy ?? | ||
| generateCedarPolicyForGroup(connectionId, false, { | ||
| connection: { connectionId, accessLevel: AccessLevelEnum.none }, | ||
| group: { groupId: savedGroup.id, accessLevel: AccessLevelEnum.none }, | ||
| tables: [], | ||
| }, | ||
| ); | ||
| }); |
Comment on lines
+39
to
+45
| savedGroup.cedarPolicy = | ||
| cedarPolicy ?? | ||
| generateCedarPolicyForGroup(connectionId, false, { | ||
| connection: { connectionId, accessLevel: AccessLevelEnum.none }, | ||
| group: { groupId: savedGroup.id, accessLevel: AccessLevelEnum.none }, | ||
| tables: [], | ||
| }, | ||
| ); | ||
| }); |
Comment on lines
+9
to
+13
|
|
||
| @IsOptional() | ||
| @IsString() | ||
| @ApiProperty({ required: false, nullable: true }) | ||
| cedarPolicy?: string | null; |
Comment on lines
42
to
+46
| groupToUpdate.title = title; | ||
| if (cedarPolicy !== undefined) { | ||
| groupToUpdate.cedarPolicy = cedarPolicy; | ||
| Cacher.invalidateCedarPolicyCache(groupToUpdate.connection.id); | ||
| } |
Comment on lines
42
to
47
| groupToUpdate.title = title; | ||
| if (cedarPolicy !== undefined) { | ||
| groupToUpdate.cedarPolicy = cedarPolicy; | ||
| Cacher.invalidateCedarPolicyCache(groupToUpdate.connection.id); | ||
| } | ||
| const updatedGroup = await this._dbContext.groupRepository.saveNewOrUpdatedGroup(groupToUpdate); |
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.
Expose cedarPolicy through backend DTOs, responses, and use cases for creating and updating user groups.