mirror of
https://github.com/immich-app/immich
synced 2026-08-15 13:03:57 +00:00
fix: search statistics locked folder permissions (#30063)
fix; search statistics locked folder permissions
This commit is contained in:
parent
4c754f2999
commit
77091b0107
2 changed files with 17 additions and 1 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue