|
@@ -367,21 +367,23 @@ class PageGrantService {
|
|
|
grantedGroups: 1,
|
|
grantedGroups: 1,
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
- { // remove duplicates from pipeline
|
|
|
|
|
- $group: {
|
|
|
|
|
- _id: '$grant',
|
|
|
|
|
- grantedGroupsSet: { $addToSet: '$grantedGroups' },
|
|
|
|
|
- grantedUsersSet: { $addToSet: '$grantedUsers' },
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ $unwind: { // preprocess for creating groups set
|
|
|
|
|
+ path: '$grantedGroups',
|
|
|
|
|
+ preserveNullAndEmptyArrays: true,
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
- { // flatten granted user set
|
|
|
|
|
- $unwind: {
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ $unwind: { // preprocess for creating users set
|
|
|
path: '$grantedUsersSet',
|
|
path: '$grantedUsersSet',
|
|
|
|
|
+ preserveNullAndEmptyArrays: true,
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
- { // flatten granted group set
|
|
|
|
|
- $unwind: {
|
|
|
|
|
- path: '$grantedGroupsSet',
|
|
|
|
|
|
|
+ { // remove duplicates from pipeline
|
|
|
|
|
+ $group: {
|
|
|
|
|
+ _id: '$grant',
|
|
|
|
|
+ grantedGroupsSet: { $addToSet: '$grantedGroups' },
|
|
|
|
|
+ grantedUsersSet: { $addToSet: '$grantedUsers' },
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
]);
|
|
]);
|
|
@@ -651,7 +653,6 @@ class PageGrantService {
|
|
|
const isNonApplicableGroupExist = excludeTestIdsFromTargetIds(
|
|
const isNonApplicableGroupExist = excludeTestIdsFromTargetIds(
|
|
|
[...descendantPagesGrantInfo.grantedUserGroupIds], [...operatorGrantInfo.userGroupIds],
|
|
[...descendantPagesGrantInfo.grantedUserGroupIds], [...operatorGrantInfo.userGroupIds],
|
|
|
).length > 0;
|
|
).length > 0;
|
|
|
-
|
|
|
|
|
if (isNonApplicableGroupExist) {
|
|
if (isNonApplicableGroupExist) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
@@ -689,7 +690,6 @@ class PageGrantService {
|
|
|
const isUpdateGroupUsersIncludeAllDescendantsOwners = excludeTestIdsFromTargetIds(
|
|
const isUpdateGroupUsersIncludeAllDescendantsOwners = excludeTestIdsFromTargetIds(
|
|
|
[...descendantPagesGrantInfo.grantedUserIds], [...updateGrantInfo.grantedUserGroupInfo.userIds],
|
|
[...descendantPagesGrantInfo.grantedUserIds], [...updateGrantInfo.grantedUserGroupInfo.userIds],
|
|
|
).length === 0; // b.
|
|
).length === 0; // b.
|
|
|
-
|
|
|
|
|
return isAllDescendantGroupsChildrenOrItselfOfUpdateGroup && isUpdateGroupUsersIncludeAllDescendantsOwners;
|
|
return isAllDescendantGroupsChildrenOrItselfOfUpdateGroup && isUpdateGroupUsersIncludeAllDescendantsOwners;
|
|
|
}
|
|
}
|
|
|
|
|
|