Skip to content

Commit 37157c2

Browse files
authored
Merge pull request #1671 from rocket-admin/backend_group_ceadr_permissions_responce
feat: add cedarPolicy to group and connection data structures and update related tests
2 parents 3df5d5c + 2493ea0 commit 37157c2

12 files changed

Lines changed: 21 additions & 3 deletions

backend/src/entities/company-info/utils/build-found-company-info-ds.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export function buildFoundCompanyFullInfoDs(
3939
id: group.id,
4040
isMain: group.isMain,
4141
title: group.title,
42+
cedarPolicy: group.cedarPolicy,
4243
users: group.users.map((user) => buildSimpleUserInfoDs(user)).filter((user) => !!user),
4344
};
4445
}),

backend/src/entities/connection/application/dto/found-user-groups-in-connection.dto.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ export class FoundGroupInConnectionDTO {
1212
@ApiProperty()
1313
isMain: boolean;
1414

15+
@ApiProperty()
16+
cedarPolicy: string | null;
17+
1518
@ApiProperty({ required: false, isArray: true, type: SimpleFoundUserInfoDs })
1619
users?: Array<SimpleFoundUserInfoDs>;
1720
}

backend/src/entities/connection/utils/build-found-user-group-in-connection-dto.util.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export function buildFoundUserGroupInConnectionDto(
1212
id: group.id,
1313
title: group.title,
1414
isMain: group.isMain,
15+
cedarPolicy: group.cedarPolicy,
1516
users: group.users?.length ? group.users.map((user) => buildSimpleUserInfoDs(user)) : undefined,
1617
},
1718
accessLevel,

backend/src/entities/group/application/data-sctructures/found-user-groups.ds.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ export class FoundGroupDataInfoDs {
1111

1212
@ApiProperty()
1313
isMain: boolean;
14+
15+
@ApiProperty()
16+
cedarPolicy: string | null;
1417
}
1518

1619
export class FoundGroupDataWithUsersDs extends FoundGroupDataInfoDs {

backend/src/entities/group/use-cases/find-all-user-groups.use.case.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,14 @@ export class FindAllUserGroupsUseCase extends AbstractUseCase<string, FoundUserG
3535
groups: groupsWithAccessLevels.map((g) => {
3636
const {
3737
accessLevel,
38-
group: { id, isMain, title },
38+
group: { id, isMain, title, cedarPolicy },
3939
} = g;
4040
return {
4141
group: {
4242
id: id,
4343
title: title,
4444
isMain: isMain,
45+
cedarPolicy: cedarPolicy,
4546
},
4647
accessLevel: accessLevel,
4748
};

backend/src/entities/group/use-cases/update-group-title.use.case.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export class UpdateGroupTitleUseCase
4444
id: updatedGroup.id,
4545
title: updatedGroup.title,
4646
isMain: updatedGroup.isMain,
47+
cedarPolicy: updatedGroup.cedarPolicy,
4748
};
4849
}
4950
}

backend/test/ava-tests/non-saas-tests/non-saas-company-info-e2e.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,11 @@ test.serial(`${currentTest} should return full found company info for company ad
138138
t.is(Object.hasOwn(foundCompanyInfoRO.connections[0], 'author'), true);
139139
t.is(Object.hasOwn(foundCompanyInfoRO.connections[0], 'groups'), true);
140140
t.is(foundCompanyInfoRO.connections[0].groups.length > 0, true);
141-
t.is(Object.keys(foundCompanyInfoRO.connections[0].groups[0]).length, 4);
141+
t.is(Object.keys(foundCompanyInfoRO.connections[0].groups[0]).length, 5);
142142
t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'id'), true);
143143
t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'title'), true);
144144
t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'isMain'), true);
145+
t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'cedarPolicy'), true);
145146
t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'users'), true);
146147
t.is(foundCompanyInfoRO.connections[0].groups[0].users.length > 0, true);
147148
t.is(Object.keys(foundCompanyInfoRO.connections[0].groups[0].users[0]).length, 9);

backend/test/ava-tests/non-saas-tests/non-saas-connection-e2e.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,6 +1124,7 @@ test.serial(`${currentTest} should return connection without deleted group resul
11241124
const _groupId = result[0].group.id;
11251125

11261126
t.is(Object.hasOwn(result[0].group, 'title'), true);
1127+
t.is(Object.hasOwn(result[0].group, 'cedarPolicy'), true);
11271128
t.is(result[0].accessLevel, AccessLevelEnum.edit);
11281129

11291130
const index = result

backend/test/ava-tests/non-saas-tests/non-saas-group-e2e.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ test.serial(`${currentTest} should return all user groups`, async (t) => {
117117

118118
t.is(Object.hasOwn(result[1].group, 'users'), true);
119119
t.is(Object.hasOwn(result[0].group, 'title'), true);
120+
t.is(Object.hasOwn(result[0].group, 'cedarPolicy'), true);
120121
t.is(Object.hasOwn(result[0].group, 'connection'), false);
121122
t.is(result[1].accessLevel, AccessLevelEnum.edit);
122123
} catch (e) {
@@ -636,6 +637,7 @@ test.serial(`${currentTest} should return an delete result`, async (t) => {
636637
t.is(result.length, 1);
637638

638639
t.is(result[0].group.title, 'Admin');
640+
t.is(Object.hasOwn(result[0].group, 'cedarPolicy'), true);
639641
t.is(result[0].accessLevel, AccessLevelEnum.edit);
640642

641643
const index = result

backend/test/ava-tests/saas-tests/company-info-e2e.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,11 @@ test.serial(`${currentTest} should return full found company info for company ad
139139
t.is(Object.hasOwn(foundCompanyInfoRO.connections[0], 'author'), true);
140140
t.is(Object.hasOwn(foundCompanyInfoRO.connections[0], 'groups'), true);
141141
t.is(foundCompanyInfoRO.connections[0].groups.length > 0, true);
142-
t.is(Object.keys(foundCompanyInfoRO.connections[0].groups[0]).length, 4);
142+
t.is(Object.keys(foundCompanyInfoRO.connections[0].groups[0]).length, 5);
143143
t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'id'), true);
144144
t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'title'), true);
145145
t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'isMain'), true);
146+
t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'cedarPolicy'), true);
146147
t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'users'), true);
147148
t.is(foundCompanyInfoRO.connections[0].groups[0].users.length > 0, true);
148149
t.is(Object.keys(foundCompanyInfoRO.connections[0].groups[0].users[0]).length, 9);

0 commit comments

Comments
 (0)