fix(server): tighten asset visibility (#18699)

* tighten visibility

* update sql

* elevated access util function

* fix potential sync issue

* include in user stats

* include hidden assets in size usage

* filter visibility in search duplicates query

* stack visibility
This commit is contained in:
Mert
2025-06-02 10:33:08 -04:00
committed by GitHub
parent b5c3a675b2
commit fa22e865a4
21 changed files with 132 additions and 107 deletions

View File

@@ -210,9 +210,9 @@ export class UserRepository {
getUserStats() {
return this.db
.selectFrom('users')
.leftJoin('assets', 'assets.ownerId', 'users.id')
.leftJoin('assets', (join) => join.onRef('assets.ownerId', '=', 'users.id').on('assets.deletedAt', 'is', null))
.leftJoin('exif', 'exif.assetId', 'assets.id')
.select(['users.id as userId', 'users.name as userName', 'users.quotaSizeInBytes as quotaSizeInBytes'])
.select(['users.id as userId', 'users.name as userName', 'users.quotaSizeInBytes'])
.select((eb) => [
eb.fn
.countAll<number>()
@@ -256,7 +256,6 @@ export class UserRepository {
)
.as('usageVideos'),
])
.where('assets.deletedAt', 'is', null)
.groupBy('users.id')
.orderBy('users.createdAt', 'asc')
.execute();