Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.
TypeScript cloud-alternativecollaborationcollaborative-editingdropboxfile-serverfile-sharingfile-storagefile-syncfull-text-searchhomelabnextcloudon-premiseopen-sourceprivacy-firstprivate-cloudrealtimesecureself-hostedstorage-serverwebdav
feat(files): add unlock request feature and enable force unlock for file owners
johaven7441337dd003
diff --git a/backend/src/applications/files/constants/operations.ts b/backend/src/applications/files/constants/operations.tsindex eef5eaf6..a79e69a2 100644--- a/backend/src/applications/files/constants/operations.ts+++ b/backend/src/applications/files/constants/operations.ts@@ -16,7 +16,8 @@ export enum FILE_OPERATION {TOUCH = 'touch',THUMBNAIL = 'thumbnail',LOCK = 'lock',- UNLOCK = 'unlock'+ UNLOCK = 'unlock',+ UNLOCK_REQUEST = 'unlock-request'}export enum FILE_MODE {diff --git a/backend/src/applications/files/files.controller.spec.ts b/backend/src/applications/files/files.controller.spec.tsindex 6db09b3a..cf819d94 100644--- a/backend/src/applications/files/files.controller.spec.ts+++ b/backend/src/applications/files/files.controller.spec.ts@@ -5,6 +5,8 @@*/import { Test, TestingModule } from '@nestjs/testing'+import { ContextInterceptor } from '../../infrastructure/context/interceptors/context.interceptor'+import { ContextManager } from '../../infrastructure/context/services/context-manager.service'import { SpaceGuard } from '../spaces/guards/space.guard'import { FILE_OPERATION } from './constants/operations'import { FilesController } from './files.controller'@@ -55,7 +57,9 @@ describe(FilesController.name, () => {{ provide: FilesMethods, useValue: filesMethodsMock },{ provide: FilesTasksManager, useValue: filesTasksManagerMock },{ provide: FilesRecents, useValue: filesRecentsMock },- { provide: FilesSearchManager, useValue: filesSearchMock }+ { provide: FilesSearchManager, useValue: filesSearchMock },+ { provide: ContextManager, useValue: filesSearchMock },+ ContextInterceptor]})// IMPORTANT: override the guard referenced by @UseGuards to avoid resolving its dependenciesdiff --git a/backend/src/applications/files/files.controller.ts b/backend/src/applications/files/files.controller.tsindex 79a66271..acbfbfc3 100644--- a/backend/src/applications/files/files.controller.ts+++ b/backend/src/applications/files/files.controller.ts@@ -14,6 +14,7 @@ import {Lock,Logger,Move,+ ParseBoolPipe,ParseIntPipe,Patch,Post,@@ -24,10 +25,12 @@ import {Search,StreamableFile,Unlock,- UseGuards+ UseGuards,+ UseInterceptors} from '@nestjs/common'import { FastifyReply } from 'fastify'import { webpMimeType } from '../../common/image'+import { ContextInterceptor } from '../../infrastructure/context/interceptors/context.interceptor'import { SkipSpaceGuard } from '../spaces/decorators/space-skip-guard.decorator'import { SkipSpacePermissionsCheck } from '../spaces/decorators/space-skip-permissions.decorator'import { GetSpace } from '../spaces/decorators/space.decorator'@@ -139,8 +142,18 @@ export class FilesController {}@Unlock(`${FILES_ROUTE.OPERATION}/*`)- async unlock(@GetUser() user: UserModel, @GetSpace() space: SpaceEnv): Promise<void> {- return this.filesMethods.unlock(user, space)+ async unlock(+ @GetUser() user: UserModel,+ @GetSpace() space: SpaceEnv,+ @Query('forceAsOwner', new ParseBoolPipe({ optional: true })) forceAsOwner?: boolean+ ): Promise<void> {+ return this.filesMethods.unlock(user, space, forceAsOwner)+ }++ @Unlock(`${FILES_ROUTE.OPERATION}/${FILE_OPERATION.UNLOCK_REQUEST}/*`)+ @UseInterceptors(ContextInterceptor)+ async unlockRequest(@GetUser() user: UserModel, @GetSpace() space: SpaceEnv): Promise<void> {+ return this.filesMethods.unlockRequest(user, space)}// TASKS OPERATIONSdiff --git a/backend/src/applications/files/services/files-manager.service.spec.ts b/backend/src/applications/files/services/files-manager.service.spec.tsindex a06c6a8b..7a86f5c4 100644--- a/backend/src/applications/files/services/files-manager.service.spec.ts+++ b/backend/src/applications/files/services/files-manager.service.spec.ts@@ -6,7 +6,9 @@import { HttpService } from '@nestjs/axios'import { Test, TestingModule } from '@nestjs/testing'+import { ContextManager } from '../../../infrastructure/context/services/context-manager.service'import { DB_TOKEN_PROVIDER } from '../../../infrastructure/database/constants'+import { NotificationsManager } from '../../notifications/services/notifications-manager.service'import { SpacesManager } from '../../spaces/services/spaces-manager.service'import { FilesLockManager } from './files-lock-manager.service'import { FilesManager } from './files-manager.service'@@ -21,6 +23,8 @@ describe(FilesManager.name, () => {{ provide: DB_TOKEN_PROVIDER, useValue: {} },{ provide: FilesLockManager, useValue: {} },{ provide: SpacesManager, useValue: {} },+ { provide: ContextManager, useValue: {} },+ { provide: NotificationsManager, useValue: {} },{provide: HttpService,useValue: {}diff --git a/backend/src/applications/files/services/files-manager.service.ts b/backend/src/applications/files/services/files-manager.service.tsindex f2615b3e..43391432 100644--- a/backend/src/applications/files/services/files-manager.service.ts+++ b/backend/src/applications/files/services/files-manager.service.ts@@ -14,7 +14,11 @@ import { Readable } from 'node:stream'import { extract as extractTar } from 'tar'import { FastifyAuthenticatedRequest } from '../../../authentication/interfaces/auth-request.interface'import { generateThumbnail } from '../../../common/image'+import { ContextManager } from '../../../infrastructure/context/services/context-manager.service'import { HTTP_METHOD } from '../../applications.constants'+import { NOTIFICATION_APP, NOTIFICATION_APP_EVENT } from '../../notifications/constants/notifications'+import { NotificationContent } from '../../notifications/interfaces/notification-properties.interface'+import { NotificationsManager } from '../../notifications/services/notifications-manager.service'import { SPACE_OPERATION } from '../../spaces/constants/spaces'import { FastifySpaceRequest } from '../../spaces/interfaces/space-request.interface'import { SpaceEnv } from '../../spaces/models/space-env.model'@@ -70,8 +74,10 @@ export class FilesManager {constructor(private readonly http: HttpService,private readonly filesQueries: FilesQueries,- private readonly filesLockManager: FilesLockManager,- private readonly spacesManager: SpacesManager+ private readonly spacesManager: SpacesManager,+ private readonly contextManager: ContextManager,+ private readonly notificationsManager: NotificationsManager,+ public readonly filesLockManager: FilesLockManager) {}sendFileFromSpace(space: SpaceEnv, asAttachment = false, downloadName = ''): SendFile {@@ -181,9 +187,11 @@ export class FilesManager {async saveMultipart(user: UserModel, space: SpaceEnv, req: FastifySpaceRequest) {/* Accepted methods:- POST: creates new resource- PUT: creates or fully replaces a resource at the given URI (even if intermediate paths do not exist)- PATCH: updates the content of a single existing resource without creating it+ POST: Creates new resource+ PUT: Creates or fully replaces a resource at the given URI (even if intermediate paths do not exist)+ PATCH: Updates the content of an existing resource without creating a new one.+ In this text-editing scenario, locking and refreshing occur automatically, but unlocking must be handled explicitly via+ the `unlock` method.*/const overwrite = req.method === HTTP_METHOD.PUTconst patch = req.method === HTTP_METHOD.PATCH@@ -236,12 +244,15 @@ export class FilesManager {}// Create or refresh lockconst dbFile = { ...space.dbFile, path: path.join(dirName(space.dbFile.path), partFileName) }- const [created, fileLock] = await this.filesLockManager.createOrRefresh(user, dbFile, DEPTH.RESOURCE, CACHE_LOCK_FILE_TTL)+ // Use a short TTL for the PATCH method (which is also used for refreshing)+ const ttl = patch ? CACHE_LOCK_FILE_TTL : undefined+ const [created, fileLock] = await this.filesLockManager.createOrRefresh(user, dbFile, DEPTH.RESOURCE, ttl)// Dotry {await writeFromStream(dstFile, part.file)} finally {- if (created) {+ if (!patch && created) {+ // Remove the file lock only if it has not been refreshedawait this.filesLockManager.removeLock(fileLock.key)}}@@ -628,7 +639,7 @@ export class FilesManager {return this.filesLockManager.convertLockToFileLockProps(lock)}- async unlock(user: UserModel, space: SpaceEnv): Promise<void> {+ async unlock(user: UserModel, space: SpaceEnv, forceAsOwner = false): Promise<void> {if (!(await isPathExists(space.realPath))) {this.logger.warn(`Unable to unlock: ${space.url} - resource does not exist`)throw new FileError(HttpStatus.BAD_REQUEST, 'Unlock must specify an existing resource')@@ -639,7 +650,7 @@ export class FilesManager {return}for (const lock of fileLocks) {- if (lock.owner.id === user.id) {+ if ((forceAsOwner && space.dbFile?.ownerId === user.id) || lock.owner.id === user.id) {// Refresh if more than half of the TTL has passedawait this.filesLockManager.removeLock(lock.key)} else {@@ -647,4 +658,28 @@ export class FilesManager {}}}++ async unlockRequest(user: UserModel, space: SpaceEnv): Promise<void> {+ const fileLocks = await this.filesLockManager.getLocksByPath(space.dbFile)+ if (fileLocks.length === 0) {+ this.logger.warn(`Unable to find lock: ${space.url} - resource does not exist`)+ throw new FileError(HttpStatus.NOT_FOUND, 'Lock not found')+ }+ for (const lock of fileLocks) {+ if (lock.owner.id !== user.id) {+ const notification: NotificationContent = {+ app: NOTIFICATION_APP.UNLOCK_REQUEST,+ event: NOTIFICATION_APP_EVENT.UNLOCK_REQUEST,+ element: fileName(space.url),+ url: dirName(space.url)+ }+ this.notificationsManager+ .create([lock.owner.id], notification, {+ author: user,+ currentUrl: this.contextManager.headerOriginUrl()+ })+ .catch((e: Error) => this.logger.error(`${this.unlockRequest.name} - ${e}`))+ }+ }+ }}diff --git a/backend/src/applications/files/services/files-methods.service.ts b/backend/src/applications/files/services/files-methods.service.tsindex 36849b0c..43d38d58 100644--- a/backend/src/applications/files/services/files-methods.service.ts+++ b/backend/src/applications/files/services/files-methods.service.ts@@ -153,18 +153,30 @@ export class FilesMethods {try {return await this.filesManager.lock(user, space)} catch (e) {+ if (e instanceof LockConflict) {+ const fileLockProps = this.filesManager.filesLockManager.convertLockToFileLockProps(e.lock)+ throw new HttpException(fileLockProps, HttpStatus.LOCKED)+ }this.handleError(space, FILE_OPERATION.LOCK, e)}}- async unlock(user: UserModel, space: SpaceEnv): Promise<void> {+ async unlock(user: UserModel, space: SpaceEnv, forceAsOwner = false): Promise<void> {try {- return await this.filesManager.unlock(user, space)+ return await this.filesManager.unlock(user, space, forceAsOwner)} catch (e) {this.handleError(space, FILE_OPERATION.UNLOCK, e)}}+ async unlockRequest(user: UserModel, space: SpaceEnv): Promise<void> {+ try {+ return await this.filesManager.unlockRequest(user, space)+ } catch (e) {+ this.handleError(space, FILE_OPERATION.UNLOCK_REQUEST, e)+ }+ }+private async copyMove(user: UserModel,space: SpaceEnv,diff --git a/backend/src/applications/notifications/constants/notifications.ts b/backend/src/applications/notifications/constants/notifications.tsindex cc0bbb40..eb4a6cfe 100644--- a/backend/src/applications/notifications/constants/notifications.ts+++ b/backend/src/applications/notifications/constants/notifications.ts@@ -14,7 +14,8 @@ export enum NOTIFICATION_APP {LINKS = 'links',SYNC = 'sync',AUTH_LOCKED = 'auth_locked',- AUTH_2FA = 'auth_2fa'+ AUTH_2FA = 'auth_2fa',+ UNLOCK_REQUEST = 'unlock_request'}export const NOTIFICATION_APP_EVENT = {@@ -50,5 +51,6 @@ export const NOTIFICATION_APP_EVENT = {},AUTH_LOCKED: {[ACTION.DELETE]: 'Your account has been locked after several unsuccessful authentication attempts'- }+ },+ UNLOCK_REQUEST: 'sends you a request to unlock the file'}diff --git a/backend/src/applications/notifications/i18n/de.ts b/backend/src/applications/notifications/i18n/de.tsindex 2b81d931..58fc849d 100644--- a/backend/src/applications/notifications/i18n/de.ts+++ b/backend/src/applications/notifications/i18n/de.ts@@ -10,8 +10,8 @@*/export const de = {- 'If you no longer wish to receive notifications, change your preferences directly from your user space':- 'Wenn Sie keine Benachrichtigungen mehr erhalten möchten, ändern Sie Ihre Einstellungen direkt in Ihrem Benutzerbereich',+ 'If you no longer wish to receive notifications, change your preferences directly from your user space.':+ 'Wenn Sie keine Benachrichtigungen mehr erhalten möchten, ändern Sie Ihre Einstellungen direkt in Ihrem Benutzerbereich.','Access it from': 'Öffnen Sie es über',Comment: 'Kommentar',commented: 'hat kommentiert',@@ -39,6 +39,10 @@ export const de = {Sync: 'Synchronisierung','Access your syncs from': 'Öffnen Sie Ihre Synchronisierungen über','You are no longer synchronizing': 'Sie synchronisieren nicht mehr',+ 'Unlock Request': 'Entsperranfrage',+ 'You receive this notification because you have a lock on this file.':+ 'Sie erhalten diese Benachrichtigung, weil Sie eine Sperre auf dieser Datei haben.',+ 'sends you a request to unlock the file': 'sendet Ihnen eine Anfrage zum Entsperren der Datei','Security notification': 'Sicherheitsbenachrichtigung','Your account has been locked after several unsuccessful authentication attempts':'Ihr Konto wurde nach mehreren fehlgeschlagenen Anmeldeversuchen gesperrt',diff --git a/backend/src/applications/notifications/i18n/es.ts b/backend/src/applications/notifications/i18n/es.tsindex 807f0040..f53f741d 100644--- a/backend/src/applications/notifications/i18n/es.ts+++ b/backend/src/applications/notifications/i18n/es.ts@@ -5,8 +5,8 @@*/export const es = {- 'If you no longer wish to receive notifications, change your preferences directly from your user space':- 'Si ya no desea recibir notificaciones, cambie sus preferencias directamente desde su espacio de usuario',+ 'If you no longer wish to receive notifications, change your preferences directly from your user space.':+ 'Si ya no desea recibir notificaciones, cambie sus preferencias directamente desde su espacio de usuario.','Access it from': 'Acceda a él desde',Comment: 'Comentario',commented: 'comentó',@@ -34,6 +34,9 @@ export const es = {Sync: 'Sincronización','Access your syncs from': 'Acceda a sus sincronizaciones desde','You are no longer synchronizing': 'Ya no está sincronizando',+ 'Unlock Request': 'Solicitud de desbloqueo',+ 'You receive this notification because you have a lock on this file.': 'Recibe esta notificación porque tiene un bloqueo en este archivo.',+ 'sends you a request to unlock the file': 'le envía una solicitud para desbloquear el archivo','Security notification': 'Notificación de seguridad','Your account has been locked after several unsuccessful authentication attempts':'Su cuenta ha sido bloqueada tras varios intentos de autenticación fallidos',diff --git a/backend/src/applications/notifications/i18n/fr.ts b/backend/src/applications/notifications/i18n/fr.tsindex 5434a98a..fe7d7c26 100644--- a/backend/src/applications/notifications/i18n/fr.ts+++ b/backend/src/applications/notifications/i18n/fr.ts@@ -5,8 +5,8 @@*/export const fr = {- 'If you no longer wish to receive notifications, change your preferences directly from your user space':- 'Si vous ne souhaitez plus recevoir de notifications, modifiez vos préferences directement depuis votre espace utilisateur',+ 'If you no longer wish to receive notifications, change your preferences directly from your user space.':+ 'Si vous ne souhaitez plus recevoir de notifications, modifiez vos préferences directement depuis votre espace utilisateur.','Access it from': 'Accédez y depuis',Comment: 'Commentaire',commented: 'a commenté',@@ -33,6 +33,9 @@ export const fr = {Sync: 'Synchronisation','Access your syncs from': 'Accédez à vos synchronisations depuis','You are no longer synchronizing': 'Vous ne synchronisez plus',+ 'Unlock Request': 'Demande de déverrouillage',+ 'You receive this notification because you have a lock on this file.': 'Vous recevez cette notification car vous avez un verrou sur ce fichier.',+ 'sends you a request to unlock the file': 'vous envoie une demande de déverrouillage du fichier','Security notification': 'Notification de sécurité','Your account has been locked after several unsuccessful authentication attempts':'Votre compte a été verrouillé après plusieurs tentatives d’authentification infructueuses',diff --git a/backend/src/applications/notifications/i18n/hi.ts b/backend/src/applications/notifications/i18n/hi.tsindex 2c8348a5..9134b824 100644--- a/backend/src/applications/notifications/i18n/hi.ts+++ b/backend/src/applications/notifications/i18n/hi.ts@@ -5,8 +5,8 @@*/export const hi = {- 'If you no longer wish to receive notifications, change your preferences directly from your user space':- 'यदि आप अब सूचनाएँ प्राप्त नहीं करना चाहते हैं, तो अपने उपयोगकर्ता क्षेत्र से सीधे अपनी प्राथमिकताएँ बदलें',+ 'If you no longer wish to receive notifications, change your preferences directly from your user space.':+ 'यदि आप अब सूचनाएँ प्राप्त नहीं करना चाहते हैं, तो अपने उपयोगकर्ता क्षेत्र से सीधे अपनी प्राथमिकताएँ बदलें।','Access it from': 'इसे यहाँ से एक्सेस करें',Comment: 'टिप्पणी',commented: 'ने टिप्पणी की',@@ -34,6 +34,9 @@ export const hi = {Sync: 'समन्वयन','Access your syncs from': 'अपने समन्वयन यहाँ से एक्सेस करें','You are no longer synchronizing': 'आप अब समन्वयन नहीं कर रहे हैं',+ 'Unlock Request': 'अनलॉक अनुरोध',+ 'You receive this notification because you have a lock on this file.': 'यह सूचना आपको इसलिए प्राप्त हुई है क्योंकि इस फ़ाइल पर आपका लॉक है।',+ 'sends you a request to unlock the file': 'आपको फ़ाइल अनलॉक करने का अनुरोध भेजता है','Security notification': 'सुरक्षा सूचना','Your account has been locked after several unsuccessful authentication attempts':'कई असफल प्रमाणीकरण प्रयासों के बाद आपका खाता लॉक कर दिया गया है',diff --git a/backend/src/applications/notifications/i18n/it.ts b/backend/src/applications/notifications/i18n/it.tsindex 24619f43..91859a03 100644--- a/backend/src/applications/notifications/i18n/it.ts+++ b/backend/src/applications/notifications/i18n/it.ts@@ -5,8 +5,8 @@*/export const it = {- 'If you no longer wish to receive notifications, change your preferences directly from your user space':- 'Se non desideri più ricevere notifiche, modifica le tue preferenze direttamente dalla tua area utente',+ 'If you no longer wish to receive notifications, change your preferences directly from your user space.':+ 'Se non desideri più ricevere notifiche, modifica le tue preferenze direttamente dalla tua area utente.','Access it from': 'Accedi da',Comment: 'Commento',commented: 'ha commentato',@@ -34,6 +34,9 @@ export const it = {Sync: 'Sincronizzazione','Access your syncs from': 'Accedi alle tue sincronizzazioni da','You are no longer synchronizing': 'Non stai più sincronizzando',+ 'Unlock Request': 'Richiesta di sblocco',+ 'You receive this notification because you have a lock on this file.': 'Ricevi questa notifica perché hai un blocco su questo file.',+ 'sends you a request to unlock the file': 'ti invia una richiesta per sbloccare il file','Security notification': 'Notifica di sicurezza','Your account has been locked after several unsuccessful authentication attempts':'Il tuo account è stato bloccato dopo diversi tentativi di autenticazione non riusciti',diff --git a/backend/src/applications/notifications/i18n/ja.ts b/backend/src/applications/notifications/i18n/ja.tsindex 7d65cdc4..3dde48ef 100644--- a/backend/src/applications/notifications/i18n/ja.ts+++ b/backend/src/applications/notifications/i18n/ja.ts@@ -5,7 +5,7 @@*/export const ja = {- 'If you no longer wish to receive notifications, change your preferences directly from your user space':+ 'If you no longer wish to receive notifications, change your preferences directly from your user space.':'通知の受信を希望しない場合は、ユーザー用スペースから直接設定を変更してください。','Access it from': 'こちらからアクセス',Comment: 'コメント',@@ -34,6 +34,9 @@ export const ja = {Sync: '同期','Access your syncs from': '次の場所からあなたの同期にアクセス','You are no longer synchronizing': '同期を停止しました',+ 'Unlock Request': 'ロック解除リクエスト',+ 'You receive this notification because you have a lock on this file.': 'このファイルにロックが設定されているため、この通知を受け取っています。',+ 'sends you a request to unlock the file': 'あなたにファイルのロック解除をリクエストしました','Security notification': 'セキュリティ通知','Your account has been locked after several unsuccessful authentication attempts': '複数回の認証失敗により、あなたのアカウントはロックされました','This security notification concerns your Sync-in account. Please contact an administrator to perform the analysis and unlock your account.':diff --git a/backend/src/applications/notifications/i18n/ko.ts b/backend/src/applications/notifications/i18n/ko.tsindex 40f91879..0f73c038 100644--- a/backend/src/applications/notifications/i18n/ko.ts+++ b/backend/src/applications/notifications/i18n/ko.ts@@ -5,7 +5,7 @@*/export const ko = {- 'If you no longer wish to receive notifications, change your preferences directly from your user space':+ 'If you no longer wish to receive notifications, change your preferences directly from your user space.':'더 이상 알림을 받고 싶지 않다면, 사용자 공간에서 바로 환경설정을 변경하세요.','Access it from': '여기에서 액세스',Comment: '댓글',@@ -34,6 +34,9 @@ export const ko = {Sync: '동기화','Access your syncs from': '다음에서 내 동기화에 액세스','You are no longer synchronizing': '더 이상 동기화하지 않습니다',+ 'Unlock Request': '잠금 해제 요청',+ 'You receive this notification because you have a lock on this file.': '이 파일에 잠금이 설정되어 있어 이 알림을 받았습니다.',+ 'sends you a request to unlock the file': '파일 잠금 해제 요청을 보냈습니다','Security notification': '보안 알림','Your account has been locked after several unsuccessful authentication attempts': '여러 번 인증에 실패하여 계정이 잠겼습니다','This security notification concerns your Sync-in account. Please contact an administrator to perform the analysis and unlock your account.':diff --git a/backend/src/applications/notifications/i18n/pl.ts b/backend/src/applications/notifications/i18n/pl.tsindex b2795a04..8c92399e 100644--- a/backend/src/applications/notifications/i18n/pl.ts+++ b/backend/src/applications/notifications/i18n/pl.ts@@ -5,7 +5,7 @@*/export const pl = {- 'If you no longer wish to receive notifications, change your preferences directly from your user space':+ 'If you no longer wish to receive notifications, change your preferences directly from your user space.':'Jeśli nie chcesz już otrzymywać powiadomień, zmień swoje preferencje bezpośrednio w przestrzeni użytkownika.','Access it from': 'Uzyskaj dostęp z',Comment: 'Komentarz',@@ -34,6 +34,9 @@ export const pl = {Sync: 'Synchronizacja','Access your syncs from': 'Uzyskaj dostęp do swoich synchronizacji z','You are no longer synchronizing': 'Już nie synchronizujesz',+ 'Unlock Request': 'Prośba o odblokowanie',+ 'You receive this notification because you have a lock on this file.': 'Otrzymujesz to powiadomienie, ponieważ masz blokadę na tym pliku.',+ 'sends you a request to unlock the file': 'wysyła ci prośbę o odblokowanie pliku','Security notification': 'Powiadomienie bezpieczeństwa','Your account has been locked after several unsuccessful authentication attempts':'Twoje konto zostało zablokowane po kilku nieudanych próbach uwierzytelnienia',diff --git a/backend/src/applications/notifications/i18n/pt.ts b/backend/src/applications/notifications/i18n/pt.tsindex 49f48636..3abc0f98 100644--- a/backend/src/applications/notifications/i18n/pt.ts+++ b/backend/src/applications/notifications/i18n/pt.ts@@ -5,8 +5,8 @@*/export const pt = {- 'If you no longer wish to receive notifications, change your preferences directly from your user space':- 'Se já não deseja receber notificações, altere as suas preferências diretamente no seu espaço de utilizador',+ 'If you no longer wish to receive notifications, change your preferences directly from your user space.':+ 'Se já não deseja receber notificações, altere as suas preferências diretamente no seu espaço de utilizador.','Access it from': 'Aceda a partir de',Comment: 'Comentário',commented: 'comentou',@@ -34,6 +34,9 @@ export const pt = {Sync: 'Sincronização','Access your syncs from': 'Aceda às suas sincronizações a partir de','You are no longer synchronizing': 'Deixou de sincronizar',+ 'Unlock Request': 'Pedido de desbloqueio',+ 'You receive this notification because you have a lock on this file.': 'Recebe esta notificação porque tem um bloqueio neste ficheiro.',+ 'sends you a request to unlock the file': 'envia-lhe um pedido para desbloquear o ficheiro','Security notification': 'Notificação de segurança','Your account has been locked after several unsuccessful authentication attempts':'A sua conta foi bloqueada após várias tentativas de autenticação sem sucesso',diff --git a/backend/src/applications/notifications/i18n/pt_br.ts b/backend/src/applications/notifications/i18n/pt_br.tsindex 02262586..ad227d87 100644--- a/backend/src/applications/notifications/i18n/pt_br.ts+++ b/backend/src/applications/notifications/i18n/pt_br.ts@@ -5,7 +5,7 @@*/export const pt_BR = {- 'If you no longer wish to receive notifications, change your preferences directly from your user space':+ 'If you no longer wish to receive notifications, change your preferences directly from your user space.':'Se você não deseja mais receber notificações, altere suas preferências diretamente no seu espaço do usuário.','Access it from': 'Acesse a partir de',Comment: 'Comentário',@@ -34,6 +34,9 @@ export const pt_BR = {Sync: 'Sincronização','Access your syncs from': 'Acesse suas sincronizações a partir de','You are no longer synchronizing': 'Você não está mais sincronizando',+ 'Unlock Request': 'Solicitação de desbloqueio',+ 'You receive this notification because you have a lock on this file.': 'Você recebe esta notificação porque você tem um bloqueio neste arquivo.',+ 'sends you a request to unlock the file': 'lhe envia uma solicitação para desbloquear o arquivo','Security notification': 'Notificação de segurança','Your account has been locked after several unsuccessful authentication attempts':'Sua conta foi bloqueada após várias tentativas de autenticação sem sucesso',diff --git a/backend/src/applications/notifications/i18n/ru.ts b/backend/src/applications/notifications/i18n/ru.tsindex 7b5e8a93..3016bf2e 100644--- a/backend/src/applications/notifications/i18n/ru.ts+++ b/backend/src/applications/notifications/i18n/ru.ts@@ -4,8 +4,8 @@* See the LICENSE file for licensing details*/export const ru = {- 'If you no longer wish to receive notifications, change your preferences directly from your user space':- 'Если вы больше не хотите получать уведомления, измените настройки прямо в вашем пользовательском пространстве',+ 'If you no longer wish to receive notifications, change your preferences directly from your user space.':+ 'Если вы больше не хотите получать уведомления, измените настройки прямо в вашем пользовательском пространстве.','Access it from': 'Доступно отсюда',Comment: 'Комментарий',commented: 'прокомментировал(а)',@@ -33,6 +33,10 @@ export const ru = {Sync: 'Синхронизация','Access your syncs from': 'Доступ к вашим синхронизациям','You are no longer synchronizing': 'Вы больше не синхронизируете',+ 'Unlock Request': 'Запрос на разблокировку',+ 'You receive this notification because you have a lock on this file.':+ 'Вы получили это уведомление, потому что у вас есть блокировка на этом файле.',+ 'sends you a request to unlock the file': 'отправляет вам запрос на разблокировку файла','Security notification': 'Уведомление безопасности','Your account has been locked after several unsuccessful authentication attempts':'Ваш аккаунт был заблокирован после нескольких неудачных попыток входа',diff --git a/backend/src/applications/notifications/i18n/tr.ts b/backend/src/applications/notifications/i18n/tr.tsindex ee81607f..733d4cfc 100644--- a/backend/src/applications/notifications/i18n/tr.ts+++ b/backend/src/applications/notifications/i18n/tr.ts@@ -5,7 +5,7 @@*/export const tr = {- 'If you no longer wish to receive notifications, change your preferences directly from your user space':+ 'If you no longer wish to receive notifications, change your preferences directly from your user space.':'Artık bildirim almak istemiyorsanız, kullanıcı alanınızdan doğrudan tercihlerinizi değiştirin.','Access it from': 'Buradan erişin',Comment: 'Yorum',@@ -34,6 +34,9 @@ export const tr = {Sync: 'Eşitleme','Access your syncs from': 'Eşitlemelerinize buradan erişin','You are no longer synchronizing': 'Artık eşitleme yapmıyorsunuz',+ 'Unlock Request': 'Kilidi açma talebi',+ 'You receive this notification because you have a lock on this file.': 'Bu dosya üzerinde bir kilidiniz olduğu için bu bildirimi alıyorsunuz.',+ 'sends you a request to unlock the file': 'size dosyanın kilidini açma talebi gönderiyor','Security notification': 'Güvenlik bildirimi','Your account has been locked after several unsuccessful authentication attempts':'Birkaç başarısız kimlik doğrulama girişiminden sonra hesabınız kilitlendi',diff --git a/backend/src/applications/notifications/i18n/zh.ts b/backend/src/applications/notifications/i18n/zh.tsindex 19978f6f..404b9d35 100644--- a/backend/src/applications/notifications/i18n/zh.ts+++ b/backend/src/applications/notifications/i18n/zh.ts@@ -5,8 +5,8 @@*/export const zh = {- 'If you no longer wish to receive notifications, change your preferences directly from your user space':- '如果您不再希望接收通知,请在您的用户空间中直接更改偏好设置',+ 'If you no longer wish to receive notifications, change your preferences directly from your user space.':+ '如果您不再希望接收通知,请在您的用户空间中直接更改偏好设置。','Access it from': '通过以下入口访问',Comment: '评论',commented: '评论了',@@ -33,6 +33,9 @@ export const zh = {Sync: '同步','Access your syncs from': '从以下位置访问您的同步','You are no longer synchronizing': '您已停止同步',+ 'Unlock Request': '解锁请求',+ 'You receive this notification because you have a lock on this file.': '您收到此通知是因为您对该文件设置了锁。',+ 'sends you a request to unlock the file': '向您发送了解锁该文件的请求','Security notification': '安全通知','Your account has been locked after several unsuccessful authentication attempts': '在多次身份验证失败后,您的账户已被锁定','This security notification concerns your Sync-in account. Please contact an administrator to perform the analysis and unlock your account.':diff --git a/backend/src/applications/notifications/mails/models.ts b/backend/src/applications/notifications/mails/models.tsindex 53d87623..30016ed7 100644--- a/backend/src/applications/notifications/mails/models.ts+++ b/backend/src/applications/notifications/mails/models.ts@@ -183,7 +183,7 @@ export function auth2FaMail(language: i18nLocale, notification: NotificationContreturn [tr.title, mailTemplate(content, footer)]}-export function authLocked(language: i18nLocale, notification: NotificationContent): [string, string] {+export function authLockedMail(language: i18nLocale, notification: NotificationContent): [string, string] {const tr = translateObject(language, {title: 'Security notification',footer:@@ -198,3 +198,26 @@ export function authLocked(language: i18nLocale, notification: NotificationContereturn [tr.title, mailTemplate(content, footer)]}++export function requestUnlockMail(+ language: i18nLocale,+ notification: NotificationContent,+ options: {+ currentUrl: string+ author: UserModel+ }+): [string, string] {+ const tr = translateObject(language, {+ title: 'Unlock Request',+ defaultFooter: defaultFooter,+ footer: 'You receive this notification because you have a lock on this file.',+ urlText: 'Access it from',+ event: notification.event+ })++ const content = `${options.author ? mailAuthor(options.author) : ''}${mailEventOnElement(tr.event, notification.element)}`++ const footer = `<br>${tr.urlText} <a href="${urlFromSpaceFile(options.currentUrl, notification)}">${SERVER_NAME}</a><br>${tr.footer}<br>${tr.defaultFooter}`++ return [`${tr.title}: ${capitalizeString(notification.element)}`, mailTemplate(content, footer)]+}diff --git a/backend/src/applications/notifications/mails/templates.ts b/backend/src/applications/notifications/mails/templates.tsindex 52b4fc53..f78c9691 100644--- a/backend/src/applications/notifications/mails/templates.ts+++ b/backend/src/applications/notifications/mails/templates.ts@@ -7,7 +7,7 @@import { capitalizeString } from '../../../common/shared'import { UserModel } from '../../users/models/user.model'-export const defaultFooter = 'If you no longer wish to receive notifications, change your preferences directly from your user space'+export const defaultFooter = 'If you no longer wish to receive notifications, change your preferences directly from your user space.'export const mailTemplate = (content: string, footer: string) => `<html lang="en">diff --git a/backend/src/applications/notifications/services/notifications-manager.service.ts b/backend/src/applications/notifications/services/notifications-manager.service.tsindex 5cf2d7f0..db1dce0f 100644--- a/backend/src/applications/notifications/services/notifications-manager.service.ts+++ b/backend/src/applications/notifications/services/notifications-manager.service.ts@@ -15,7 +15,7 @@ import { NOTIFICATION_APP } from '../constants/notifications'import { NOTIFICATIONS_WS } from '../constants/websocket'import type { NotificationContent, NotificationFromUser, NotificationOptions } from '../interfaces/notification-properties.interface'import type { UserMailNotification } from '../interfaces/user-mail-notification'-import { auth2FaMail, authLocked, commentMail, linkMail, shareMail, spaceMail, spaceRootMail, syncMail } from '../mails/models'+import { auth2FaMail, authLockedMail, commentMail, linkMail, requestUnlockMail, shareMail, spaceMail, spaceRootMail, syncMail } from '../mails/models'import { WebSocketNotifications } from '../notifications.gateway'import { NotificationsQueries } from './notifications-queries.service'@@ -117,7 +117,9 @@ export class NotificationsManager {case NOTIFICATION_APP.AUTH_2FA:return auth2FaMail(language, content)case NOTIFICATION_APP.AUTH_LOCKED:- return authLocked(language, content)+ return authLockedMail(language, content)+ case NOTIFICATION_APP.UNLOCK_REQUEST:+ return requestUnlockMail(language, content, { currentUrl: options.currentUrl, author: options.author })default:this.logger.error(`${this.genMail.name} - case not handled : ${content.app}`)}diff --git a/frontend/src/app/applications/files/components/dialogs/files-lock-dialog.component.html b/frontend/src/app/applications/files/components/dialogs/files-lock-dialog.component.htmlnew file mode 100755index 00000000..67894e8f--- /dev/null+++ b/frontend/src/app/applications/files/components/dialogs/files-lock-dialog.component.html@@ -0,0 +1,46 @@+<!--+ ~ Copyright (C) 2012-2025 Johan Legrand <[email protected]>+ ~ This file is part of Sync-in | The open source file sync and share solution+ ~ See the LICENSE file for licensing details+ -->++<div class="modal-header">+ <h4 class="modal-title">+ <fa-icon [icon]="hasExclusiveLock ? icons.faLock : icons.faUnlock" class="me-1"></fa-icon>+ <span>{{ file.name }}</span>+ </h4>+ <button (click)="layout.closeDialog()" aria-label="Close" class="btn-close btn-close-white" type="button"></button>+</div>+<div class="modal-body">+ <div class="d-flex flex-column align-items-center avatar my-2">+ @if (hasExclusiveLock) {+ <span class="mb-2" l10nTranslate>The file is locked by</span>+ } @else {+ <span class="mb-2" l10nTranslate>The file is edited by</span>+ }+ <img class="avatar-img mb-2" [src]="userAvatarUrl" alt="">+ @if (isLockOwner) {+ <b l10nTranslate>me</b>+ } @else {+ <b>{{ file?.lock?.owner }}</b>+ }+ </div>+ @if (!isLockOwner && isFileOwner) {+ <div class="text-align-center mt-3 mb-1">+ <small l10nTranslate>As the file owner, you can unlock the file or request the current lock owner to release it.</small>+ </div>+ }+</div>+<div class="modal-footer">+ <button (click)="layout.closeDialog()" class="btn btn-sm btn-secondary" data-dismiss="modal" type="button" l10nTranslate>+ {{ hasExclusiveLock ? 'Cancel' : 'Close' | translate:locale.language }}+ </button>+ @if (hasExclusiveLock) {+ @if (isLockOwner || isFileOwner) {+ <button (click)="onUnlock()" [disabled]="submitted" class="btn btn-sm btn-primary" type="button" l10nTranslate>Unlock</button>+ }+ @if (!isLockOwner) {+ <button (click)="onSendUnLockRequest()" [disabled]="submitted" class="btn btn-sm btn-success" type="button" l10nTranslate>Send an unlock request</button>+ }+ }+</div>diff --git a/frontend/src/app/applications/files/components/dialogs/files-lock-dialog.component.ts b/frontend/src/app/applications/files/components/dialogs/files-lock-dialog.component.tsnew file mode 100644index 00000000..10ca9189--- /dev/null+++ b/frontend/src/app/applications/files/components/dialogs/files-lock-dialog.component.ts@@ -0,0 +1,83 @@+/*+ * Copyright (C) 2012-2025 Johan Legrand <[email protected]>+ * This file is part of Sync-in | The open source file sync and share solution+ * See the LICENSE file for licensing details+ */++import { HttpErrorResponse } from '@angular/common/http'+import { Component, HostListener, inject, Input, OnInit } from '@angular/core'+import { FaIconComponent } from '@fortawesome/angular-fontawesome'+import { faLock, faUnlock } from '@fortawesome/free-solid-svg-icons'+import { L10N_LOCALE, L10nLocale, L10nTranslateDirective, L10nTranslatePipe } from 'angular-l10n'+import { firstValueFrom } from 'rxjs'+import { LayoutService } from '../../../../layout/layout.service'+import { StoreService } from '../../../../store/store.service'+import { SpacesBrowserService } from '../../../spaces/services/spaces-browser.service'+import { userAvatarUrl } from '../../../users/user.functions'+import { FileModel } from '../../models/file.model'+import { FilesService } from '../../services/files.service'++@Component({+ selector: 'app-files-lock-dialog',+ imports: [FaIconComponent, L10nTranslateDirective, L10nTranslatePipe],+ templateUrl: 'files-lock-dialog.component.html'+})+export class FilesLockDialogComponent implements OnInit {+ @Input({ required: true }) file: FileModel+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)+ protected layout = inject(LayoutService)+ protected readonly icons = { faLock, faUnlock }+ protected submitted = false+ protected readonly store = inject(StoreService)+ protected readonly userLogin = this.store.user.getValue().login+ protected isFileOwner = false+ protected isLockOwner = false+ protected hasExclusiveLock = true+ protected userAvatarUrl: string+ private readonly spacesBrowserService = inject(SpacesBrowserService)+ private readonly filesService = inject<FilesService>(FilesService)++ ngOnInit() {+ this.hasExclusiveLock = this.file.lock.isExclusive+ this.isFileOwner = this.spacesBrowserService.inPersonalSpace || this.file.root?.owner?.login === this.userLogin+ this.isLockOwner = this.file.lock.ownerLogin === this.userLogin+ this.userAvatarUrl = userAvatarUrl(this.file.lock.ownerLogin)+ }++ @HostListener('document:keyup.enter')+ async onEnter() {+ if (this.isLockOwner) {+ await this.onUnlock()+ } else {+ this.onSendUnLockRequest()+ }+ }++ @HostListener('document:keyup.escape')+ onEsc() {+ this.layout.closeDialog()+ }++ async onUnlock() {+ try {+ this.submitted = true+ await firstValueFrom(this.filesService.unlock(this.file, !this.isLockOwner))+ delete this.file.lock+ this.layout.closeDialog()+ } catch (e: any) {+ this.submitted = false+ this.layout.sendNotification('warning', this.file.name, e.error.message)+ }+ }++ onSendUnLockRequest() {+ this.submitted = true+ this.filesService.unlockRequest(this.file).subscribe({+ next: () => this.layout.closeDialog(),+ error: (e: HttpErrorResponse) => {+ this.submitted = false+ this.layout.sendNotification('warning', this.file.name, e.error.message)+ }+ })+ }+}diff --git a/frontend/src/app/applications/files/components/dialogs/files-overwrite-dialog.component.ts b/frontend/src/app/applications/files/components/dialogs/files-overwrite-dialog.component.tsindex 47d9eb14..5678f7c3 100644--- a/frontend/src/app/applications/files/components/dialogs/files-overwrite-dialog.component.ts+++ b/frontend/src/app/applications/files/components/dialogs/files-overwrite-dialog.component.ts@@ -17,7 +17,7 @@ import { FileModel } from '../../models/file.model'templateUrl: 'files-overwrite-dialog.component.html'})export class FilesOverwriteDialogComponent {- @Input() files: FileModel[] = []+ @Input({ required: true }) files: FileModel[] = []@Input() renamedTo: stringpublic overwrite = output<boolean>()protected readonly locale = inject<L10nLocale>(L10N_LOCALE)diff --git a/frontend/src/app/applications/files/components/sidebar/files-selection.component.html b/frontend/src/app/applications/files/components/sidebar/files-selection.component.htmlindex 90e5f420..3c58d852 100644--- a/frontend/src/app/applications/files/components/sidebar/files-selection.component.html+++ b/frontend/src/app/applications/files/components/sidebar/files-selection.component.html@@ -65,6 +65,24 @@<div class="d-flex col-sm-5 ps-1 pb-1 fw-bold" l10nTranslate>Modified</div><div class="fs-xxs">{{ f.mtime | amDateFormat }}</div></div>+ <div class="d-flex align-items-center mb-1">+ <div class="d-flex col-sm-5 ps-1 pb-1 fw-bold" l10nTranslate>Lock</div>+ @if (f.lock) {+ @if (f.lock.isExclusive) {+ <span class="badge rounded-pill bg-maroon" l10nTranslate>+ <fa-icon [icon]="icons.faLock"></fa-icon>+ <span class="ms-1" l10nTranslate>Exclusive</span>+ </span>+ } @else {+ <span class="badge rounded-pill bg-maroon" l10nTranslate>+ <fa-icon [icon]="icons.faUnlock"></fa-icon>+ <span class="ms-1" l10nTranslate>Shared</span>+ </span>+ }+ } @else {+ <span class="badge rounded-pill bg-secondary-alt" l10nTranslate>no</span>+ }+ </div><div class="d-flex align-items-center mb-1"><div class="d-flex col-sm-5 ps-1 pb-1 fw-bold" l10nTranslate>Shared</div><div class="d-flex col-sm-7">@@ -121,9 +139,10 @@<hr class="mt-1 mb-2" /><div class="d-flex flex-wrap align-items-center p-2 fs-xs">@if (f.lock) {- <div class="badge rounded-pill white-space bg-warning cursor-pointer mb-2">- <fa-icon [icon]="f.lock.isExclusive ? icons.faLock : icons.faUnlock"></fa-icon>- <span> {{ f.lock.owner }}</span>+ <div (click)="openLockDialog(f)"+ class="badge rounded-pill white-space bg-maroon cursor-pointer mb-2">+ <fa-icon [icon]="f.lock.isExclusive ? icons.faLock : icons.faUnlock"></fa-icon>+ <span> {{ f.lock.owner }}</span></div>}@for (space of f.spaces; track space.id) {diff --git a/frontend/src/app/applications/files/components/sidebar/files-selection.component.ts b/frontend/src/app/applications/files/components/sidebar/files-selection.component.tsindex 1819f66e..2244d52f 100755--- a/frontend/src/app/applications/files/components/sidebar/files-selection.component.ts+++ b/frontend/src/app/applications/files/components/sidebar/files-selection.component.ts@@ -89,4 +89,8 @@ export class FilesSelectionComponent {}).catch(console.error)}++ openLockDialog(f: FileModel) {+ this.filesService.openLockDialog(f)+ }}diff --git a/frontend/src/app/applications/files/components/utils/only-office.component.ts b/frontend/src/app/applications/files/components/utils/only-office.component.tsindex 63009a79..a2e02068 100644--- a/frontend/src/app/applications/files/components/utils/only-office.component.ts+++ b/frontend/src/app/applications/files/components/utils/only-office.component.ts@@ -69,7 +69,8 @@ export class OnlyOfficeComponent implements OnInit, OnChanges, OnDestroy {window.DocEditor = { instances: {} }}- window.DocEditor.instances[this.id] = window.DocsAPI.DocEditor(this.id, JSON.parse(JSON.stringify(this.config)))+ const config: OnlyOfficeConfig = JSON.parse(JSON.stringify(this.config))+ window.DocEditor.instances[this.id] = window.DocsAPI.DocEditor(this.id, config)} catch (err) {console.error(err)this.onError(-1)diff --git a/frontend/src/app/applications/files/components/viewers/files-viewer-document.component.ts b/frontend/src/app/applications/files/components/viewers/files-viewer-document.component.tsindex 9ae61199..f101b834 100644--- a/frontend/src/app/applications/files/components/viewers/files-viewer-document.component.ts+++ b/frontend/src/app/applications/files/components/viewers/files-viewer-document.component.ts@@ -61,14 +61,14 @@ export class FilesViewerDocumentComponent implements OnInit, OnDestroy {this.layout.sendNotification('error', 'Unable to open document', 'Settings are missing')return}- // do not allow edit if backend only allow 'view' mode+ // Do not allow edit if backend only allows 'view' modeif (this.mode === FILE_MODE.EDIT && data.config.editorConfig.mode !== FILE_MODE.EDIT) {data.config.editorConfig.mode = FILE_MODE.VIEW} else {data.config.editorConfig.mode = this.mode}if (this.mode === FILE_MODE.EDIT) {- // set lock on file+ // Set lock on filethis.file.lock = {owner: `${SERVER_NAME} - ${this.store.user.getValue().fullName} (${this.store.user.getValue().email})`,ownerLogin: this.store.user.getValue().login,diff --git a/frontend/src/app/applications/files/components/viewers/files-viewer-text.component.ts b/frontend/src/app/applications/files/components/viewers/files-viewer-text.component.tsindex 41639c87..552135cc 100644--- a/frontend/src/app/applications/files/components/viewers/files-viewer-text.component.ts+++ b/frontend/src/app/applications/files/components/viewers/files-viewer-text.component.ts@@ -307,6 +307,15 @@ export class FilesViewerTextComponent implements OnInit, OnDestroy {private lockError(e: HttpErrorResponse) {this.isReadonly.set(true)this.isSupported.set(false)- this.layout.sendNotification('warning', this.file().name, e.error.message)+ if (e.error?.owner) {+ const lock: FileLockProps = e.error+ this.file.update((f) => {+ f.lock = lock+ return f+ })+ this.layout.sendNotification('info', 'The file is locked', lock.owner)+ } else {+ this.layout.sendNotification('warning', this.file().name, e.error.message)+ }}}diff --git a/frontend/src/app/applications/files/services/files.service.ts b/frontend/src/app/applications/files/services/files.service.tsindex 37053471..1930a8d1 100644--- a/frontend/src/app/applications/files/services/files.service.ts+++ b/frontend/src/app/applications/files/services/files.service.ts@@ -11,6 +11,7 @@ import { DomSanitizer } from '@angular/platform-browser'import { FILE_MODE, FILE_OPERATION } from '@sync-in-server/backend/src/applications/files/constants/operations'import {API_FILES_ONLY_OFFICE_STATUS,+ API_FILES_OPERATION,API_FILES_OPERATION_MAKE,API_FILES_RECENTS,API_FILES_SEARCH,@@ -40,6 +41,7 @@ import { downloadWithAnchor } from '../../../common/utils/functions'import { TAB_MENU } from '../../../layout/layout.interfaces'import { LayoutService } from '../../../layout/layout.service'import { StoreService } from '../../../store/store.service'+import { FilesLockDialogComponent } from '../components/dialogs/files-lock-dialog.component'import { FilesOverwriteDialogComponent } from '../components/dialogs/files-overwrite-dialog.component'import { FilesViewerDialogComponent } from '../components/dialogs/files-viewer-dialog.component'import { SHORT_MIME } from '../files.constants'@@ -94,7 +96,9 @@ export class FilesService {const operation = action ? action : this.clipboardActionif (this.store.filesClipboard.getValue().length) {const dirPath: string = this.currentRoute- this.copyMove([...this.store.filesClipboard.getValue()], dirPath, operation === 'copyPaste' ? FILE_OPERATION.COPY : FILE_OPERATION.MOVE)+ this.copyMove([...this.store.filesClipboard.getValue()], dirPath, operation === 'copyPaste' ? FILE_OPERATION.COPY : FILE_OPERATION.MOVE).catch(+ console.error+ )this.clearClipboard()}}@@ -217,11 +221,24 @@ export class FilesService {}lock(file: FileModel): Observable<FileLockProps> {- return this.http.request<FileLockProps>('lock', file.dataUrl)+ return this.http.request<FileLockProps>(FILE_OPERATION.LOCK, file.dataUrl)+ }++ unlock(file: FileModel, forceAsOwner = false): Observable<void> {+ const params = forceAsOwner ? new HttpParams().set('forceAsOwner', 'true') : null+ return this.http.request<void>(FILE_OPERATION.UNLOCK, file.dataUrl, { params: params })}- unlock(file: FileModel): Observable<void> {- return this.http.request<void>('unlock', file.dataUrl)+ unlockRequest(file: FileModel): Observable<void> {+ return this.http.request<void>(FILE_OPERATION.UNLOCK, `${API_FILES_OPERATION}/${FILE_OPERATION.UNLOCK_REQUEST}/${file.path}`)+ }++ openLockDialog(file: FileModel): void {+ this.layout.openDialog(FilesLockDialogComponent, null, {+ initialState: {+ file: file+ }+ })}async openOverwriteDialog(files: File[] | FileModel[], renamedTo?: string): Promise<boolean> {@@ -247,7 +264,11 @@ export class FilesService {this.download(file)return}- const isWriteable = permissions.indexOf(SPACE_OPERATION.MODIFY) > -1+ const isLockedByOther = file?.lock?.isExclusive && file.lock?.ownerLogin !== this.store.user.getValue().login+ if (isLockedByOther) {+ this.layout.sendNotification('info', 'The file is locked', file.lock.owner)+ }+ const isWriteable = !isLockedByOther && permissions.indexOf(SPACE_OPERATION.MODIFY) > -1if (mode === FILE_MODE.EDIT && !isWriteable) {mode = FILE_MODE.VIEW}diff --git a/frontend/src/app/applications/notifications/models/notification.model.ts b/frontend/src/app/applications/notifications/models/notification.model.tsindex 144d64ed..fc51e651 100644--- a/frontend/src/app/applications/notifications/models/notification.model.ts+++ b/frontend/src/app/applications/notifications/models/notification.model.ts@@ -4,13 +4,13 @@* See the LICENSE file for licensing details*/-import { IconDefinition } from '@fortawesome/fontawesome-svg-core'+import type { IconDefinition } from '@fortawesome/fontawesome-svg-core'import { NOTIFICATION_APP } from '@sync-in-server/backend/src/applications/notifications/constants/notifications'-import {- type NotificationContent,- type NotificationFromUser+import type {+ NotificationContent,+ NotificationFromUser} from '@sync-in-server/backend/src/applications/notifications/interfaces/notification-properties.interface'-import { Owner } from '@sync-in-server/backend/src/applications/users/interfaces/owner.interface'+import type { Owner } from '@sync-in-server/backend/src/applications/users/interfaces/owner.interface'import { userAvatarUrl } from '../../users/user.functions'import { NOTIFICATION_ICON } from '../notifications.constants'diff --git a/frontend/src/app/applications/notifications/notifications.constants.ts b/frontend/src/app/applications/notifications/notifications.constants.tsindex 8864aea7..8c62fc85 100644--- a/frontend/src/app/applications/notifications/notifications.constants.ts+++ b/frontend/src/app/applications/notifications/notifications.constants.ts@@ -5,6 +5,7 @@*/import { IconDefinition } from '@fortawesome/fontawesome-svg-core'+import { faLockOpen } from '@fortawesome/free-solid-svg-icons'import { NOTIFICATION_APP } from '@sync-in-server/backend/src/applications/notifications/constants/notifications'import { COMMENTS_ICON } from '../comments/comments.constants'import { SPACES_ICON } from '../spaces/spaces.constants'@@ -16,5 +17,6 @@ export const NOTIFICATION_ICON: Partial<Record<NOTIFICATION_APP, IconDefinition>[NOTIFICATION_APP.SPACE_ROOTS]: SPACES_ICON.SPACES,[NOTIFICATION_APP.SHARES]: SPACES_ICON.SHARES,[NOTIFICATION_APP.LINKS]: SPACES_ICON.LINKS,- [NOTIFICATION_APP.SYNC]: SYNC_ICON.SYNC+ [NOTIFICATION_APP.SYNC]: SYNC_ICON.SYNC,+ [NOTIFICATION_APP.UNLOCK_REQUEST]: faLockOpen}diff --git a/frontend/src/app/applications/spaces/components/spaces-browser.component.html b/frontend/src/app/applications/spaces/components/spaces-browser.component.htmlindex cca71b4d..5e841f74 100644--- a/frontend/src/app/applications/spaces/components/spaces-browser.component.html+++ b/frontend/src/app/applications/spaces/components/spaces-browser.component.html@@ -248,7 +248,11 @@}<span class="label-bottom-right">@if (f.lock) {- <span class="fs-lg cursor-pointer me-1" tooltip="{{f.lock.owner}}" placement="auto">+ <span (click)="openLockDialog(f)"+ tooltip="{{f.lock.owner}}"+ placement="auto"+ [style.font-size.px]="galleryMode.textSize"+ class="badge rounded-pill bg-maroon cursor-pointer"><fa-icon [icon]="f.lock.isExclusive ? icons.faLock : icons.faLockOpen"></fa-icon></span>}@@ -256,8 +260,8 @@<span (click)="layout.showRSideBarTab(TAB_MENU.SELECTION, true)"[style.font-size.px]="galleryMode.textSize"class="badge rounded-pill bg-primary cursor-pointer">- <fa-icon [icon]="icons.SHARES"></fa-icon> {{ f.shares.length }}- </span>+ <fa-icon [icon]="icons.SHARES"></fa-icon> {{ f.shares.length }}+ </span>}@if (f.spaces.length) {<span (click)="layout.showRSideBarTab(TAB_MENU.SELECTION, true)"@@ -391,7 +395,10 @@}@case ('infos') {@if (f.lock) {- <span class="fs-lg cursor-pointer me-1" tooltip="{{f.lock.owner}}" placement="auto">+ <span (click)="openLockDialog(f)"+ tooltip="{{f.lock.owner}}"+ placement="auto"+ class="badge rounded-pill bg-maroon cursor-pointer me-1"><fa-icon [icon]="f.lock.isExclusive ? icons.faLock : icons.faLockOpen"></fa-icon></span>}diff --git a/frontend/src/app/applications/spaces/components/spaces-browser.component.ts b/frontend/src/app/applications/spaces/components/spaces-browser.component.tsindex 2bd11979..51c27faa 100644--- a/frontend/src/app/applications/spaces/components/spaces-browser.component.ts+++ b/frontend/src/app/applications/spaces/components/spaces-browser.component.ts@@ -449,10 +449,6 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroy}shortcutEdit() {- if (this.selection[0]?.lock?.isExclusive && this.selection[0]?.lock?.ownerLogin !== this.store.user.getValue().login) {- this.layout.sendNotification('info', 'The file is locked', this.selection[0].lock.owner)- return- }this.openViewerDialog(FILE_MODE.EDIT)}@@ -647,6 +643,10 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroymodalRef.content.removeFiles.pipe(take(1)).subscribe(() => this.removeFiles())}+ openLockDialog(f: FileModel) {+ this.filesService.openLockDialog(f)+ }+private setSpace(route: { repository: SPACE_REPOSITORY; routes: UrlSegment[] }) {this.currentRoute = this.filesService.currentRoute = `${route.repository}${pathFromRoutes(route.routes)}`this.baseRepoUrl = `${route.repository}${route.routes.length ? `/${route.routes[0].path}` : ''}`diff --git a/frontend/src/i18n/de.json b/frontend/src/i18n/de.jsonindex cb0bcd72..f6bcfb6c 100644--- a/frontend/src/i18n/de.json+++ b/frontend/src/i18n/de.json@@ -608,5 +608,14 @@"Save And Exit": "Speichern und beenden","Close Without Saving": "Schließen ohne zu speichern","Undo": "Rückgängig",- "Redo": "Wiederholen"+ "Redo": "Wiederholen",+ "me": "ich",+ "The file is locked by": "Die Datei ist gesperrt von",+ "Unlock": "Entsperren",+ "Lock": "Sperre",+ "Exclusive": "Exklusiv",+ "Send an unlock request": "Entsperrung anfordern",+ "sends you a request to unlock the file": "sendet Ihnen eine Anfrage zum Entsperren der Datei",+ "As the file owner, you can unlock the file or request the current lock owner to release it.": "Als Dateieigentümer können Sie die Datei entsperren oder den aktuellen Sperrinhaber bitten, sie freizugeben.",+ "The file is edited by": "Die Datei wird bearbeitet von"}\ No newline at end of filediff --git a/frontend/src/i18n/es.json b/frontend/src/i18n/es.jsonindex 4a929a5f..d03f8e7d 100644--- a/frontend/src/i18n/es.json+++ b/frontend/src/i18n/es.json@@ -608,5 +608,14 @@"Save And Exit": "Guardar y salir","Close Without Saving": "Cerrar sin guardar","Undo": "Deshacer",- "Redo": "Rehacer"+ "Redo": "Rehacer",+ "me": "yo",+ "The file is locked by": "El archivo está bloqueado por",+ "Unlock": "Desbloquear",+ "Lock": "Bloqueo",+ "Exclusive": "Exclusivo",+ "Send an unlock request": "Enviar una solicitud de desbloqueo",+ "sends you a request to unlock the file": "le envía una solicitud para desbloquear el archivo",+ "As the file owner, you can unlock the file or request the current lock owner to release it.": "Como propietario del archivo, puede desbloquear el archivo o solicitar al propietario actual del bloqueo que lo libere.",+ "The file is edited by": "El archivo está siendo editado por"}\ No newline at end of filediff --git a/frontend/src/i18n/fr.json b/frontend/src/i18n/fr.jsonindex 417e3234..b40b76d2 100644--- a/frontend/src/i18n/fr.json+++ b/frontend/src/i18n/fr.json@@ -608,5 +608,14 @@"Save And Exit": "Enregistrer et quitter","Close Without Saving": "Fermer sans enregistrer","Undo": "Annuler",- "Redo": "Rétablir"-}+ "Redo": "Rétablir",+ "me": "moi",+ "The file is locked by": "Le fichier est verrouillé par",+ "Unlock": "Déverrouiller",+ "Lock": "Verrou",+ "Exclusive": "Exclusif",+ "Send an unlock request": "Envoyer une demande de déverrouillage",+ "sends you a request to unlock the file": "vous envoie une demande de déverrouillage du fichier",+ "As the file owner, you can unlock the file or request the current lock owner to release it.": "En tant que propriétaire du fichier, vous pouvez déverrouiller le fichier ou demander au propriétaire actuel du verrou de le libérer.",+ "The file is edited by": "Le fichier est en cours d’édition par"+}\ No newline at end of filediff --git a/frontend/src/i18n/hi.json b/frontend/src/i18n/hi.jsonindex 0970e082..0241b2ce 100644--- a/frontend/src/i18n/hi.json+++ b/frontend/src/i18n/hi.json@@ -608,5 +608,14 @@"Save And Exit": "सहेजें और बाहर निकलें","Close Without Saving": "बिना सहेजे बंद करें","Undo": "पूर्ववत करें",- "Redo": "फिर से करें"+ "Redo": "फिर से करें",+ "me": "मैं",+ "The file is locked by": "फ़ाइल निम्न द्वारा लॉक है",+ "Unlock": "अनलॉक करें",+ "Lock": "लॉक",+ "Exclusive": "अनन्य",+ "Send an unlock request": "अनलॉक करने का अनुरोध भेजें",+ "sends you a request to unlock the file": "आपको फ़ाइल अनलॉक करने का अनुरोध भेजता है",+ "As the file owner, you can unlock the file or request the current lock owner to release it.": "फ़ाइल के मालिक के रूप में, आप फ़ाइल को अनलॉक कर सकते हैं या वर्तमान लॉक मालिक से उसे रिलीज़ करने का अनुरोध कर सकते हैं।",+ "The file is edited by": "फ़ाइल निम्न द्वारा संपादित की जा रही है"}\ No newline at end of filediff --git a/frontend/src/i18n/it.json b/frontend/src/i18n/it.jsonindex 76748216..91a924c4 100644--- a/frontend/src/i18n/it.json+++ b/frontend/src/i18n/it.json@@ -608,5 +608,14 @@"Save And Exit": "Salva e esci","Close Without Saving": "Chiudi senza salvare","Undo": "Annulla",- "Redo": "Ripristina"+ "Redo": "Ripristina",+ "me": "io",+ "The file is locked by": "Il file è bloccato da",+ "Unlock": "Sblocca",+ "Lock": "Blocco",+ "Exclusive": "Esclusivo",+ "Send an unlock request": "Invia una richiesta di sblocco",+ "sends you a request to unlock the file": "ti invia una richiesta per sbloccare il file",+ "As the file owner, you can unlock the file or request the current lock owner to release it.": "In quanto proprietario del file, puoi sbloccare il file o chiedere all’attuale proprietario del blocco di rilasciarlo.",+ "The file is edited by": "Il file è in modifica da"}\ No newline at end of filediff --git a/frontend/src/i18n/ja.json b/frontend/src/i18n/ja.jsonindex 67952504..1451d986 100644--- a/frontend/src/i18n/ja.json+++ b/frontend/src/i18n/ja.json@@ -608,5 +608,14 @@"Save And Exit": "保存して終了","Close Without Saving": "保存せずに閉じる","Undo": "元に戻す",- "Redo": "やり直す"-}+ "Redo": "やり直す",+ "me": "自分",+ "The file is locked by": "ファイルは次のユーザーによってロックされています",+ "Unlock": "ロック解除",+ "Lock": "ロック",+ "Exclusive": "排他的",+ "Send an unlock request": "ロック解除を依頼",+ "sends you a request to unlock the file": "あなたにファイルのロック解除リクエストを送信しました",+ "As the file owner, you can unlock the file or request the current lock owner to release it.": "ファイルの所有者であるあなたは、ファイルのロックを解除するか、現在のロック所有者に解除を依頼できます。",+ "The file is edited by": "ファイルは次のユーザーによって編集中です"+}\ No newline at end of filediff --git a/frontend/src/i18n/ko.json b/frontend/src/i18n/ko.jsonindex fa9e9432..4a55f428 100644--- a/frontend/src/i18n/ko.json+++ b/frontend/src/i18n/ko.json@@ -608,5 +608,14 @@"Save And Exit": "저장하고 종료","Close Without Saving": "저장하지 않고 닫기","Undo": "실행 취소",- "Redo": "다시 실행"-}+ "Redo": "다시 실행",+ "me": "나",+ "The file is locked by": "파일이 다음 사용자에 의해 잠겨 있습니다",+ "Unlock": "잠금 해제",+ "Lock": "잠금",+ "Exclusive": "배타적",+ "Send an unlock request": "잠금 해제 요청 보내기",+ "sends you a request to unlock the file": "파일 잠금 해제 요청을 보냈습니다",+ "As the file owner, you can unlock the file or request the current lock owner to release it.": "파일 소유자인 경우 파일의 잠금을 직접 해제하거나 현재 잠금 소유자에게 해제를 요청할 수 있습니다.",+ "The file is edited by": "파일이 다음 사용자에 의해 편집 중입니다"+}\ No newline at end of filediff --git a/frontend/src/i18n/pl.json b/frontend/src/i18n/pl.jsonindex 2967c398..19279f92 100644--- a/frontend/src/i18n/pl.json+++ b/frontend/src/i18n/pl.json@@ -608,5 +608,14 @@"Save And Exit": "Zapisz i wyjdź","Close Without Saving": "Zamknij bez zapisywania","Undo": "Cofnij",- "Redo": "Ponów"-}+ "Redo": "Ponów",+ "me": "ja",+ "The file is locked by": "Plik jest zablokowany przez",+ "Unlock": "Odblokuj",+ "Lock": "Blokada",+ "Exclusive": "Wyłączna",+ "Send an unlock request": "Wyślij prośbę o odblokowanie",+ "sends you a request to unlock the file": "wysyła do Ciebie prośbę o odblokowanie pliku",+ "As the file owner, you can unlock the file or request the current lock owner to release it.": "Jako właściciel pliku możesz odblokować plik lub poprosić obecnego właściciela blokady o jej zwolnienie.",+ "The file is edited by": "Plik jest edytowany przez"+}\ No newline at end of filediff --git a/frontend/src/i18n/pt-BR.json b/frontend/src/i18n/pt-BR.jsonindex 56c538c9..08e8c26d 100644--- a/frontend/src/i18n/pt-BR.json+++ b/frontend/src/i18n/pt-BR.json@@ -608,5 +608,13 @@"Save And Exit": "Salvar e sair","Close Without Saving": "Fechar sem salvar","Undo": "Desfazer",- "Redo": "Refazer"-}+ "Redo": "Refazer",+ "me": "eu",+ "The file is locked by": "O arquivo está bloqueado por",+ "Unlock": "Desbloquear",+ "Lock": "Bloqueio",+ "Send an unlock request": "Enviar uma solicitação de desbloqueio",+ "sends you a request to unlock the file": "envia para você uma solicitação para desbloquear o arquivo",+ "As the file owner, you can unlock the file or request the current lock owner to release it.": "Como proprietário do arquivo, você pode desbloquear o arquivo ou solicitar ao proprietário atual do bloqueio que o libere.",+ "The file is edited by": "O arquivo está sendo editado por"+}\ No newline at end of filediff --git a/frontend/src/i18n/pt.json b/frontend/src/i18n/pt.jsonindex 7f36a967..3c111f27 100644--- a/frontend/src/i18n/pt.json+++ b/frontend/src/i18n/pt.json@@ -608,5 +608,14 @@"Save And Exit": "Salvar e sair","Close Without Saving": "Fechar sem salvar","Undo": "Desfazer",- "Redo": "Refazer"+ "Redo": "Refazer",+ "me": "eu",+ "The file is locked by": "O arquivo está bloqueado por",+ "Unlock": "Desbloquear",+ "Lock": "Bloqueio",+ "Exclusive": "Exclusivo",+ "Send an unlock request": "Enviar um pedido de desbloqueio",+ "sends you a request to unlock the file": "lhe envia um pedido para desbloquear o arquivo",+ "As the file owner, you can unlock the file or request the current lock owner to release it.": "Como proprietário do arquivo, você pode desbloquear o arquivo ou solicitar ao atual proprietário do bloqueio que o libere.",+ "The file is edited by": "O arquivo está sendo editado por"}\ No newline at end of filediff --git a/frontend/src/i18n/ru.json b/frontend/src/i18n/ru.jsonindex 0c2e5737..b3c73a23 100644--- a/frontend/src/i18n/ru.json+++ b/frontend/src/i18n/ru.json@@ -608,5 +608,14 @@"Save And Exit": "Сохранить и выйти","Close Without Saving": "Закрыть без сохранения","Undo": "Отменить",- "Redo": "Повторить"+ "Redo": "Повторить",+ "me": "я",+ "The file is locked by": "Файл заблокирован пользователем",+ "Unlock": "Разблокировать",+ "Lock": "Блокировка",+ "Exclusive": "Исключительная",+ "Send an unlock request": "Отправить запрос на разблокировку",+ "sends you a request to unlock the file": "отправляет вам запрос на разблокировку файла",+ "As the file owner, you can unlock the file or request the current lock owner to release it.": "Как владелец файла вы можете снять блокировку файла или попросить текущего владельца блокировки её снять.",+ "The file is edited by": "Файл редактируется пользователем"}\ No newline at end of filediff --git a/frontend/src/i18n/tr.json b/frontend/src/i18n/tr.jsonindex 2e605cc4..f960bf96 100644--- a/frontend/src/i18n/tr.json+++ b/frontend/src/i18n/tr.json@@ -608,5 +608,14 @@"Save And Exit": "Kaydet ve çık","Close Without Saving": "Kaydetmeden kapat","Undo": "Geri Al",- "Redo": "Yinele"-}+ "Redo": "Yinele",+ "me": "ben",+ "The file is locked by": "Dosya şu kişi tarafından kilitlendi",+ "Unlock": "Kilidi Aç",+ "Lock": "Kilit",+ "Exclusive": "Münhasır",+ "Send an unlock request": "Kilidi açma isteği gönder",+ "sends you a request to unlock the file": "dosyanın kilidini açmanız için size bir istek gönderiyor",+ "As the file owner, you can unlock the file or request the current lock owner to release it.": "Dosyanın sahibi olarak, dosyanın kilidini açabilir veya mevcut kilit sahibinden kilidi kaldırmasını isteyebilirsiniz.",+ "The file is edited by": "Dosya şu kişi tarafından düzenleniyor"+}\ No newline at end of filediff --git a/frontend/src/i18n/zh.json b/frontend/src/i18n/zh.jsonindex 5dd5c100..4c57fc63 100644--- a/frontend/src/i18n/zh.json+++ b/frontend/src/i18n/zh.json@@ -608,5 +608,14 @@"Save And Exit": "保存并退出","Close Without Saving": "不保存并关闭","Undo": "撤销",- "Redo": "重做"+ "Redo": "重做",+ "me": "我",+ "The file is locked by": "该文件被以下用户锁定",+ "Unlock": "解锁",+ "Lock": "锁定",+ "Exclusive": "独占",+ "Send an unlock request": "发送解锁请求",+ "sends you a request to unlock the file": "向您发送了解锁该文件的请求",+ "As the file owner, you can unlock the file or request the current lock owner to release it.": "作为文件所有者,您可以解锁该文件,或请求当前锁定所有者释放它。",+ "The file is edited by": "该文件正由以下用户编辑"}\ No newline at end of file