fix: search statistics locked folder permissions (#30063)

fix; search statistics locked folder permissions
This commit is contained in:
Daniel Dietzler 2026-07-21 02:08:42 +02:00 committed by GitHub
parent 4c754f2999
commit 77091b0107
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 1 deletions

View file

@ -100,7 +100,7 @@ export class SearchService extends BaseService {
}
async searchStatistics(auth: AuthDto, dto: StatisticsSearchDto): Promise<SearchStatisticsResponseDto> {
const userIds = await this.getUserIdsToSearch(auth);
const userIds = await this.getUserIdsToSearch(auth, dto.visibility);
if (dto.visibility === AssetVisibility.Locked) {
requireElevatedPermission(auth);
}

View file

@ -89,6 +89,22 @@ describe(SearchService.name, () => {
expect(result).toEqual({ total: 0 });
});
it('should not return locked assets of partner in elevated session', async () => {
const { sut, ctx } = setup();
const { user } = await ctx.newUser();
const { user: partner } = await ctx.newUser();
await ctx.newPartner({ sharedById: partner.id, sharedWithId: user.id });
await ctx.newAsset({ ownerId: partner.id, visibility: AssetVisibility.Locked });
const auth = factory.auth({ user: { id: user.id }, session: { hasElevatedPermission: true } });
const result = await sut.searchStatistics(auth, { visibility: AssetVisibility.Locked });
expect(result).toEqual({ total: 0 });
});
});
describe('withStacked option', () => {