diff --git a/backend/src/entities/company-info/utils/build-found-company-info-ds.ts b/backend/src/entities/company-info/utils/build-found-company-info-ds.ts index d4a1450a5..a0d5da821 100644 --- a/backend/src/entities/company-info/utils/build-found-company-info-ds.ts +++ b/backend/src/entities/company-info/utils/build-found-company-info-ds.ts @@ -39,6 +39,7 @@ export function buildFoundCompanyFullInfoDs( id: group.id, isMain: group.isMain, title: group.title, + cedarPolicy: group.cedarPolicy, users: group.users.map((user) => buildSimpleUserInfoDs(user)).filter((user) => !!user), }; }), diff --git a/backend/src/entities/connection/application/dto/found-user-groups-in-connection.dto.ts b/backend/src/entities/connection/application/dto/found-user-groups-in-connection.dto.ts index c49277cbf..0f1968f4c 100644 --- a/backend/src/entities/connection/application/dto/found-user-groups-in-connection.dto.ts +++ b/backend/src/entities/connection/application/dto/found-user-groups-in-connection.dto.ts @@ -12,6 +12,9 @@ export class FoundGroupInConnectionDTO { @ApiProperty() isMain: boolean; + @ApiProperty() + cedarPolicy: string | null; + @ApiProperty({ required: false, isArray: true, type: SimpleFoundUserInfoDs }) users?: Array; } diff --git a/backend/src/entities/connection/utils/build-found-user-group-in-connection-dto.util.ts b/backend/src/entities/connection/utils/build-found-user-group-in-connection-dto.util.ts index ef2a8649b..b9fb49a22 100644 --- a/backend/src/entities/connection/utils/build-found-user-group-in-connection-dto.util.ts +++ b/backend/src/entities/connection/utils/build-found-user-group-in-connection-dto.util.ts @@ -12,6 +12,7 @@ export function buildFoundUserGroupInConnectionDto( id: group.id, title: group.title, isMain: group.isMain, + cedarPolicy: group.cedarPolicy, users: group.users?.length ? group.users.map((user) => buildSimpleUserInfoDs(user)) : undefined, }, accessLevel, diff --git a/backend/src/entities/group/application/data-sctructures/found-user-groups.ds.ts b/backend/src/entities/group/application/data-sctructures/found-user-groups.ds.ts index 7a17616bc..5e94370d7 100644 --- a/backend/src/entities/group/application/data-sctructures/found-user-groups.ds.ts +++ b/backend/src/entities/group/application/data-sctructures/found-user-groups.ds.ts @@ -11,6 +11,9 @@ export class FoundGroupDataInfoDs { @ApiProperty() isMain: boolean; + + @ApiProperty() + cedarPolicy: string | null; } export class FoundGroupDataWithUsersDs extends FoundGroupDataInfoDs { diff --git a/backend/src/entities/group/use-cases/find-all-user-groups.use.case.ts b/backend/src/entities/group/use-cases/find-all-user-groups.use.case.ts index d5a549521..e781ce86d 100644 --- a/backend/src/entities/group/use-cases/find-all-user-groups.use.case.ts +++ b/backend/src/entities/group/use-cases/find-all-user-groups.use.case.ts @@ -35,13 +35,14 @@ export class FindAllUserGroupsUseCase extends AbstractUseCase { const { accessLevel, - group: { id, isMain, title }, + group: { id, isMain, title, cedarPolicy }, } = g; return { group: { id: id, title: title, isMain: isMain, + cedarPolicy: cedarPolicy, }, accessLevel: accessLevel, }; diff --git a/backend/src/entities/group/use-cases/update-group-title.use.case.ts b/backend/src/entities/group/use-cases/update-group-title.use.case.ts index d36918baf..004d4f439 100644 --- a/backend/src/entities/group/use-cases/update-group-title.use.case.ts +++ b/backend/src/entities/group/use-cases/update-group-title.use.case.ts @@ -44,6 +44,7 @@ export class UpdateGroupTitleUseCase id: updatedGroup.id, title: updatedGroup.title, isMain: updatedGroup.isMain, + cedarPolicy: updatedGroup.cedarPolicy, }; } } diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-company-info-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-company-info-e2e.test.ts index 3137d173e..b3bbfc7e6 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-company-info-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-company-info-e2e.test.ts @@ -138,10 +138,11 @@ test.serial(`${currentTest} should return full found company info for company ad t.is(Object.hasOwn(foundCompanyInfoRO.connections[0], 'author'), true); t.is(Object.hasOwn(foundCompanyInfoRO.connections[0], 'groups'), true); t.is(foundCompanyInfoRO.connections[0].groups.length > 0, true); - t.is(Object.keys(foundCompanyInfoRO.connections[0].groups[0]).length, 4); + t.is(Object.keys(foundCompanyInfoRO.connections[0].groups[0]).length, 5); t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'id'), true); t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'title'), true); t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'isMain'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'cedarPolicy'), true); t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'users'), true); t.is(foundCompanyInfoRO.connections[0].groups[0].users.length > 0, true); t.is(Object.keys(foundCompanyInfoRO.connections[0].groups[0].users[0]).length, 9); diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-connection-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-connection-e2e.test.ts index 4dbfbe73a..638c3df30 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-connection-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-connection-e2e.test.ts @@ -1124,6 +1124,7 @@ test.serial(`${currentTest} should return connection without deleted group resul const _groupId = result[0].group.id; t.is(Object.hasOwn(result[0].group, 'title'), true); + t.is(Object.hasOwn(result[0].group, 'cedarPolicy'), true); t.is(result[0].accessLevel, AccessLevelEnum.edit); const index = result diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-group-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-group-e2e.test.ts index a04ee01cd..fe34ebff4 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-group-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-group-e2e.test.ts @@ -117,6 +117,7 @@ test.serial(`${currentTest} should return all user groups`, async (t) => { t.is(Object.hasOwn(result[1].group, 'users'), true); t.is(Object.hasOwn(result[0].group, 'title'), true); + t.is(Object.hasOwn(result[0].group, 'cedarPolicy'), true); t.is(Object.hasOwn(result[0].group, 'connection'), false); t.is(result[1].accessLevel, AccessLevelEnum.edit); } catch (e) { @@ -636,6 +637,7 @@ test.serial(`${currentTest} should return an delete result`, async (t) => { t.is(result.length, 1); t.is(result[0].group.title, 'Admin'); + t.is(Object.hasOwn(result[0].group, 'cedarPolicy'), true); t.is(result[0].accessLevel, AccessLevelEnum.edit); const index = result diff --git a/backend/test/ava-tests/saas-tests/company-info-e2e.test.ts b/backend/test/ava-tests/saas-tests/company-info-e2e.test.ts index 83517c0de..764e3d96f 100644 --- a/backend/test/ava-tests/saas-tests/company-info-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/company-info-e2e.test.ts @@ -139,10 +139,11 @@ test.serial(`${currentTest} should return full found company info for company ad t.is(Object.hasOwn(foundCompanyInfoRO.connections[0], 'author'), true); t.is(Object.hasOwn(foundCompanyInfoRO.connections[0], 'groups'), true); t.is(foundCompanyInfoRO.connections[0].groups.length > 0, true); - t.is(Object.keys(foundCompanyInfoRO.connections[0].groups[0]).length, 4); + t.is(Object.keys(foundCompanyInfoRO.connections[0].groups[0]).length, 5); t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'id'), true); t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'title'), true); t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'isMain'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'cedarPolicy'), true); t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'users'), true); t.is(foundCompanyInfoRO.connections[0].groups[0].users.length > 0, true); t.is(Object.keys(foundCompanyInfoRO.connections[0].groups[0].users[0]).length, 9); diff --git a/backend/test/ava-tests/saas-tests/connection-e2e.test.ts b/backend/test/ava-tests/saas-tests/connection-e2e.test.ts index 753b96179..2c30a74b1 100644 --- a/backend/test/ava-tests/saas-tests/connection-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/connection-e2e.test.ts @@ -1184,6 +1184,7 @@ test.serial(`${currentTest} should return connection without deleted group resul const _groupId = result[0].group.id; t.is(Object.hasOwn(result[0].group, 'title'), true); + t.is(Object.hasOwn(result[0].group, 'cedarPolicy'), true); t.is(result[0].accessLevel, AccessLevelEnum.edit); const index = result diff --git a/backend/test/ava-tests/saas-tests/group-e2e.test.ts b/backend/test/ava-tests/saas-tests/group-e2e.test.ts index c57b042d7..2a8c918f5 100644 --- a/backend/test/ava-tests/saas-tests/group-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/group-e2e.test.ts @@ -105,6 +105,7 @@ test.serial(`${currentTest} should return all user groups`, async (t) => { t.is(Object.hasOwn(result[1].group, 'users'), true); t.is(Object.hasOwn(result[1].group.users[0], 'password'), false); t.is(Object.hasOwn(result[0].group, 'title'), true); + t.is(Object.hasOwn(result[0].group, 'cedarPolicy'), true); t.is(Object.hasOwn(result[0].group, 'connection'), false); t.is(result[1].accessLevel, AccessLevelEnum.edit); } catch (e) { @@ -624,6 +625,7 @@ test.serial(`${currentTest} should return an delete result`, async (t) => { t.is(result.length, 1); t.is(result[0].group.title, 'Admin'); + t.is(Object.hasOwn(result[0].group, 'cedarPolicy'), true); t.is(result[0].accessLevel, AccessLevelEnum.edit); const index = result