@sync-in/server 1.5.2 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/README.md +2 -1
- package/environment/environment.dist.min.yaml +1 -0
- package/environment/environment.dist.yaml +88 -30
- package/migrations/0002_sleepy_korath.sql +1 -0
- package/migrations/meta/0002_snapshot.json +2424 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +14 -12
- package/server/app.bootstrap.js +1 -1
- package/server/app.bootstrap.js.map +1 -1
- package/server/applications/files/services/files-manager.service.js +1 -2
- package/server/applications/files/services/files-manager.service.js.map +1 -1
- package/server/applications/files/services/files-only-office-manager.service.js +5 -6
- package/server/applications/files/services/files-only-office-manager.service.js.map +1 -1
- package/server/applications/files/utils/files.js +6 -4
- package/server/applications/files/utils/files.js.map +1 -1
- package/server/applications/links/links.controller.js +2 -2
- package/server/applications/links/links.controller.js.map +1 -1
- package/server/applications/links/services/links-manager.service.js +2 -1
- package/server/applications/links/services/links-manager.service.js.map +1 -1
- package/server/applications/links/services/links-manager.service.spec.js +6 -3
- package/server/applications/links/services/links-manager.service.spec.js.map +1 -1
- package/server/applications/notifications/constants/notifications.js +9 -0
- package/server/applications/notifications/constants/notifications.js.map +1 -1
- package/server/applications/notifications/i18n/fr.js +10 -1
- package/server/applications/notifications/i18n/fr.js.map +1 -1
- package/server/applications/notifications/interfaces/notification-properties.interface.js.map +1 -1
- package/server/applications/notifications/mails/models.js +41 -3
- package/server/applications/notifications/mails/models.js.map +1 -1
- package/server/applications/notifications/mails/templates.js +1 -1
- package/server/applications/notifications/mails/templates.js.map +1 -1
- package/server/applications/notifications/schemas/notifications.schema.js +2 -1
- package/server/applications/notifications/schemas/notifications.schema.js.map +1 -1
- package/server/applications/notifications/services/notifications-manager.service.js +16 -13
- package/server/applications/notifications/services/notifications-manager.service.js.map +1 -1
- package/server/applications/notifications/services/notifications-manager.service.spec.js +9 -8
- package/server/applications/notifications/services/notifications-manager.service.spec.js.map +1 -1
- package/server/applications/notifications/services/notifications-queries.service.js +1 -1
- package/server/applications/notifications/services/notifications-queries.service.js.map +1 -1
- package/server/applications/shares/services/shares-manager.service.js +3 -2
- package/server/applications/shares/services/shares-manager.service.js.map +1 -1
- package/server/applications/sync/constants/auth.js +2 -2
- package/server/applications/sync/constants/auth.js.map +1 -1
- package/server/applications/sync/dtos/sync-client-registration.dto.js +5 -0
- package/server/applications/sync/dtos/sync-client-registration.dto.js.map +1 -1
- package/server/applications/sync/dtos/sync-operations.dto.js +1 -2
- package/server/applications/sync/dtos/sync-operations.dto.js.map +1 -1
- package/server/applications/sync/schemas/sync-clients.schema.js +2 -1
- package/server/applications/sync/schemas/sync-clients.schema.js.map +1 -1
- package/server/applications/sync/schemas/sync-paths.schema.js +2 -1
- package/server/applications/sync/schemas/sync-paths.schema.js.map +1 -1
- package/server/applications/sync/services/sync-clients-manager.service.js +28 -20
- package/server/applications/sync/services/sync-clients-manager.service.js.map +1 -1
- package/server/applications/sync/services/sync-clients-manager.service.spec.js +24 -18
- package/server/applications/sync/services/sync-clients-manager.service.spec.js.map +1 -1
- package/server/applications/sync/services/sync-queries.service.js +5 -5
- package/server/applications/sync/services/sync-queries.service.js.map +1 -1
- package/server/applications/users/admin-users.controller.js +48 -37
- package/server/applications/users/admin-users.controller.js.map +1 -1
- package/server/applications/users/admin-users.controller.spec.js +15 -0
- package/server/applications/users/admin-users.controller.spec.js.map +1 -1
- package/server/applications/users/constants/routes.js +5 -0
- package/server/applications/users/constants/routes.js.map +1 -1
- package/server/applications/users/constants/user.js +8 -0
- package/server/applications/users/constants/user.js.map +1 -1
- package/server/applications/users/dto/delete-user.dto.js +5 -23
- package/server/applications/users/dto/delete-user.dto.js.map +1 -1
- package/server/applications/users/dto/user-properties.dto.js +38 -3
- package/server/applications/users/dto/user-properties.dto.js.map +1 -1
- package/server/applications/users/interfaces/admin-user.interface.js.map +1 -1
- package/server/applications/users/interfaces/user-secrets.interface.js +10 -0
- package/server/applications/users/interfaces/user-secrets.interface.js.map +1 -0
- package/server/applications/users/models/user.model.js +84 -50
- package/server/applications/users/models/user.model.js.map +1 -1
- package/server/applications/users/schemas/user.interface.js.map +1 -1
- package/server/applications/users/schemas/users.schema.js +2 -0
- package/server/applications/users/schemas/users.schema.js.map +1 -1
- package/server/applications/users/services/admin-users-manager.service.js +7 -19
- package/server/applications/users/services/admin-users-manager.service.js.map +1 -1
- package/server/applications/users/services/admin-users-manager.service.spec.js +7 -26
- package/server/applications/users/services/admin-users-manager.service.spec.js.map +1 -1
- package/server/applications/users/services/admin-users-queries.service.js +1 -0
- package/server/applications/users/services/admin-users-queries.service.js.map +1 -1
- package/server/applications/users/services/users-manager.service.js +138 -28
- package/server/applications/users/services/users-manager.service.js.map +1 -1
- package/server/applications/users/services/users-manager.service.spec.js +11 -9
- package/server/applications/users/services/users-manager.service.spec.js.map +1 -1
- package/server/applications/users/services/users-queries.service.js +63 -57
- package/server/applications/users/services/users-queries.service.js.map +1 -1
- package/server/applications/users/users.controller.js +48 -1
- package/server/applications/users/users.controller.js.map +1 -1
- package/server/applications/users/users.controller.spec.js +8 -1
- package/server/applications/users/users.controller.spec.js.map +1 -1
- package/server/applications/users/users.e2e-spec.js +2 -1
- package/server/applications/users/users.e2e-spec.js.map +1 -1
- package/server/applications/users/utils/avatar.js +48 -0
- package/server/applications/users/utils/avatar.js.map +1 -0
- package/server/authentication/auth.config.js +89 -26
- package/server/authentication/auth.config.js.map +1 -1
- package/server/authentication/auth.controller.js +117 -9
- package/server/authentication/auth.controller.js.map +1 -1
- package/server/authentication/auth.controller.spec.js +16 -1
- package/server/authentication/auth.controller.spec.js.map +1 -1
- package/server/authentication/auth.e2e-spec.js +4 -3
- package/server/authentication/auth.e2e-spec.js.map +1 -1
- package/server/authentication/auth.module.js +4 -1
- package/server/authentication/auth.module.js.map +1 -1
- package/server/authentication/constants/auth-ldap.js +44 -0
- package/server/authentication/constants/auth-ldap.js.map +1 -0
- package/server/authentication/constants/auth.js +37 -4
- package/server/authentication/constants/auth.js.map +1 -1
- package/server/authentication/constants/routes.js +21 -0
- package/server/authentication/constants/routes.js.map +1 -1
- package/server/authentication/constants/scope.js +20 -0
- package/server/authentication/constants/scope.js.map +1 -0
- package/server/authentication/dto/login-response.dto.js +27 -4
- package/server/authentication/dto/login-response.dto.js.map +1 -1
- package/server/authentication/dto/token-response.dto.js +5 -0
- package/server/authentication/dto/token-response.dto.js.map +1 -1
- package/server/{applications/users/dto/user-password.dto.js → authentication/dto/two-fa-verify.dto.js} +27 -9
- package/server/authentication/dto/two-fa-verify.dto.js.map +1 -0
- package/server/authentication/guards/auth-basic.strategy.js +6 -5
- package/server/authentication/guards/auth-basic.strategy.js.map +1 -1
- package/server/authentication/guards/auth-token-access.strategy.js +3 -2
- package/server/authentication/guards/auth-token-access.strategy.js.map +1 -1
- package/server/authentication/guards/auth-token-refresh.strategy.js +3 -2
- package/server/authentication/guards/auth-token-refresh.strategy.js.map +1 -1
- package/server/authentication/guards/auth-two-fa-guard.js +81 -0
- package/server/authentication/guards/auth-two-fa-guard.js.map +1 -0
- package/server/authentication/interfaces/jwt-payload.interface.js +5 -0
- package/server/authentication/interfaces/jwt-payload.interface.js.map +1 -1
- package/server/authentication/interfaces/token.interface.js +2 -0
- package/server/authentication/interfaces/token.interface.js.map +1 -1
- package/server/authentication/interfaces/two-fa-setup.interface.js +10 -0
- package/server/authentication/interfaces/two-fa-setup.interface.js.map +1 -0
- package/server/authentication/models/auth-method.js.map +1 -1
- package/server/authentication/services/auth-manager.service.js +72 -49
- package/server/authentication/services/auth-manager.service.js.map +1 -1
- package/server/authentication/services/auth-methods/auth-method-database.service.js +3 -3
- package/server/authentication/services/auth-methods/auth-method-database.service.js.map +1 -1
- package/server/authentication/services/auth-methods/auth-method-database.service.spec.js +5 -0
- package/server/authentication/services/auth-methods/auth-method-database.service.spec.js.map +1 -1
- package/server/authentication/services/auth-methods/auth-method-ldap.service.js +151 -66
- package/server/authentication/services/auth-methods/auth-method-ldap.service.js.map +1 -1
- package/server/authentication/services/auth-methods/auth-method-ldap.service.spec.js +52 -50
- package/server/authentication/services/auth-methods/auth-method-ldap.service.spec.js.map +1 -1
- package/server/authentication/services/auth-methods/auth-method-two-fa.service.js +251 -0
- package/server/authentication/services/auth-methods/auth-method-two-fa.service.js.map +1 -0
- package/server/authentication/services/auth-methods/auth-method-two-fa.service.spec.js +41 -0
- package/server/authentication/services/auth-methods/auth-method-two-fa.service.spec.js.map +1 -0
- package/server/authentication/utils/crypt-secret.js +68 -0
- package/server/authentication/utils/crypt-secret.js.map +1 -0
- package/server/common/functions.js +18 -2
- package/server/common/functions.js.map +1 -1
- package/server/common/qrcode.js +34 -0
- package/server/common/qrcode.js.map +1 -0
- package/server/common/shared.js +18 -0
- package/server/common/shared.js.map +1 -1
- package/server/configuration/config.environment.js +23 -6
- package/server/configuration/config.environment.js.map +1 -1
- package/server/configuration/config.interfaces.js +10 -0
- package/server/configuration/config.interfaces.js.map +1 -0
- package/server/configuration/config.loader.js.map +1 -1
- package/server/configuration/config.validation.js +13 -13
- package/server/configuration/config.validation.js.map +1 -1
- package/server/infrastructure/cache/adapters/mysql-cache.adapter.js +6 -6
- package/server/infrastructure/cache/adapters/mysql-cache.adapter.js.map +1 -1
- package/server/infrastructure/cache/schemas/mysql-cache.schema.js +2 -1
- package/server/infrastructure/cache/schemas/mysql-cache.schema.js.map +1 -1
- package/server/infrastructure/cache/services/cache.service.js.map +1 -1
- package/server/infrastructure/database/columns.js +39 -0
- package/server/infrastructure/database/columns.js.map +1 -0
- package/server/infrastructure/database/database.config.js +0 -1
- package/server/infrastructure/database/database.config.js.map +1 -1
- package/server/infrastructure/mailer/interfaces/mail.interface.js.map +1 -1
- package/server/infrastructure/mailer/mailer.config.js +12 -0
- package/server/infrastructure/mailer/mailer.config.js.map +1 -1
- package/server/infrastructure/mailer/mailer.service.js +2 -1
- package/server/infrastructure/mailer/mailer.service.js.map +1 -1
- package/static/assets/mimes/text-x-c.svg +1 -0
- package/static/assets/pdfjs/build/pdf.mjs +2522 -914
- package/static/assets/pdfjs/build/pdf.mjs.map +1 -1
- package/static/assets/pdfjs/build/pdf.sandbox.mjs +2 -2
- package/static/assets/pdfjs/build/pdf.worker.mjs +1024 -566
- package/static/assets/pdfjs/build/pdf.worker.mjs.map +1 -1
- package/static/assets/pdfjs/version +1 -1
- package/static/assets/pdfjs/web/debugger.mjs +116 -37
- package/static/assets/pdfjs/web/images/comment-popup-editButton.svg +5 -0
- package/static/assets/pdfjs/web/locale/ach/viewer.ftl +0 -12
- package/static/assets/pdfjs/web/locale/af/viewer.ftl +0 -12
- package/static/assets/pdfjs/web/locale/an/viewer.ftl +0 -16
- package/static/assets/pdfjs/web/locale/ar/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/ast/viewer.ftl +0 -19
- package/static/assets/pdfjs/web/locale/az/viewer.ftl +0 -16
- package/static/assets/pdfjs/web/locale/be/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/bg/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/bn/viewer.ftl +0 -16
- package/static/assets/pdfjs/web/locale/bo/viewer.ftl +0 -12
- package/static/assets/pdfjs/web/locale/br/viewer.ftl +0 -22
- package/static/assets/pdfjs/web/locale/brx/viewer.ftl +0 -16
- package/static/assets/pdfjs/web/locale/bs/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/ca/viewer.ftl +12 -23
- package/static/assets/pdfjs/web/locale/cak/viewer.ftl +0 -23
- package/static/assets/pdfjs/web/locale/ckb/viewer.ftl +0 -16
- package/static/assets/pdfjs/web/locale/cs/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/cy/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/da/viewer.ftl +3 -35
- package/static/assets/pdfjs/web/locale/de/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/dsb/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/el/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/en-CA/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/en-GB/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/en-US/viewer.ftl +25 -13
- package/static/assets/pdfjs/web/locale/eo/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/es-AR/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/es-CL/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/es-ES/viewer.ftl +5 -32
- package/static/assets/pdfjs/web/locale/es-MX/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/et/viewer.ftl +0 -16
- package/static/assets/pdfjs/web/locale/eu/viewer.ftl +38 -32
- package/static/assets/pdfjs/web/locale/fa/viewer.ftl +0 -19
- package/static/assets/pdfjs/web/locale/ff/viewer.ftl +0 -12
- package/static/assets/pdfjs/web/locale/fi/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/fr/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/fur/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/fy-NL/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/ga-IE/viewer.ftl +0 -12
- package/static/assets/pdfjs/web/locale/gd/viewer.ftl +0 -23
- package/static/assets/pdfjs/web/locale/gl/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/gn/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/gu-IN/viewer.ftl +0 -12
- package/static/assets/pdfjs/web/locale/he/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/hi-IN/viewer.ftl +0 -16
- package/static/assets/pdfjs/web/locale/hr/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/hsb/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/hu/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/hy-AM/viewer.ftl +372 -16
- package/static/assets/pdfjs/web/locale/hye/viewer.ftl +0 -16
- package/static/assets/pdfjs/web/locale/ia/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/id/viewer.ftl +38 -32
- package/static/assets/pdfjs/web/locale/is/viewer.ftl +27 -32
- package/static/assets/pdfjs/web/locale/it/viewer.ftl +0 -33
- package/static/assets/pdfjs/web/locale/ja/viewer.ftl +31 -33
- package/static/assets/pdfjs/web/locale/ka/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/kab/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/kk/viewer.ftl +31 -32
- package/static/assets/pdfjs/web/locale/km/viewer.ftl +0 -12
- package/static/assets/pdfjs/web/locale/kn/viewer.ftl +0 -12
- package/static/assets/pdfjs/web/locale/ko/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/lij/viewer.ftl +0 -12
- package/static/assets/pdfjs/web/locale/lo/viewer.ftl +0 -23
- package/static/assets/pdfjs/web/locale/lt/viewer.ftl +0 -16
- package/static/assets/pdfjs/web/locale/ltg/viewer.ftl +0 -12
- package/static/assets/pdfjs/web/locale/lv/viewer.ftl +0 -12
- package/static/assets/pdfjs/web/locale/meh/viewer.ftl +0 -14
- package/static/assets/pdfjs/web/locale/mk/viewer.ftl +0 -19
- package/static/assets/pdfjs/web/locale/ml/viewer.ftl +0 -31
- package/static/assets/pdfjs/web/locale/mr/viewer.ftl +0 -16
- package/static/assets/pdfjs/web/locale/ms/viewer.ftl +0 -12
- package/static/assets/pdfjs/web/locale/my/viewer.ftl +0 -12
- package/static/assets/pdfjs/web/locale/nb-NO/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/ne-NP/viewer.ftl +0 -12
- package/static/assets/pdfjs/web/locale/nl/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/nn-NO/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/oc/viewer.ftl +0 -24
- package/static/assets/pdfjs/web/locale/pa-IN/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/pl/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/pt-BR/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/pt-PT/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/rm/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/ro/viewer.ftl +5 -37
- package/static/assets/pdfjs/web/locale/ru/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/sat/viewer.ftl +0 -23
- package/static/assets/pdfjs/web/locale/sc/viewer.ftl +8 -27
- package/static/assets/pdfjs/web/locale/sco/viewer.ftl +0 -16
- package/static/assets/pdfjs/web/locale/si/viewer.ftl +0 -22
- package/static/assets/pdfjs/web/locale/sk/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/skr/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/sl/viewer.ftl +30 -32
- package/static/assets/pdfjs/web/locale/son/viewer.ftl +0 -12
- package/static/assets/pdfjs/web/locale/sq/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/sr/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/sv-SE/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/szl/viewer.ftl +0 -16
- package/static/assets/pdfjs/web/locale/ta/viewer.ftl +0 -12
- package/static/assets/pdfjs/web/locale/te/viewer.ftl +0 -16
- package/static/assets/pdfjs/web/locale/tg/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/th/viewer.ftl +38 -32
- package/static/assets/pdfjs/web/locale/tl/viewer.ftl +0 -16
- package/static/assets/pdfjs/web/locale/tr/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/trs/viewer.ftl +0 -12
- package/static/assets/pdfjs/web/locale/uk/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/ur/viewer.ftl +0 -16
- package/static/assets/pdfjs/web/locale/uz/viewer.ftl +0 -12
- package/static/assets/pdfjs/web/locale/vi/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/xh/viewer.ftl +0 -12
- package/static/assets/pdfjs/web/locale/zh-CN/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/locale/zh-TW/viewer.ftl +0 -32
- package/static/assets/pdfjs/web/viewer.css +586 -437
- package/static/assets/pdfjs/web/viewer.html +12 -23
- package/static/assets/pdfjs/web/viewer.mjs +955 -514
- package/static/assets/pdfjs/web/viewer.mjs.map +1 -1
- package/static/assets/pdfjs/web/wasm/openjpeg.wasm +0 -0
- package/static/assets/pdfjs/web/wasm/openjpeg_nowasm_fallback.js +10 -22
- package/static/{chunk-SPTF6FSM.js → chunk-27YQB3TE.js} +1 -1
- package/static/chunk-2I4CUFUA.js +1 -0
- package/static/chunk-2MTM6SWN.js +4 -0
- package/static/{chunk-7VRUZRJG.js → chunk-34MKICK5.js} +2 -2
- package/static/chunk-5O3DIUU3.js +1 -0
- package/static/{chunk-VJRTMDEJ.js → chunk-6NMVZIIT.js} +1 -1
- package/static/{chunk-L6MU6S2V.js → chunk-7DN7ZAPU.js} +1 -1
- package/static/{chunk-MVO4WZLK.js → chunk-7FUM3JGM.js} +1 -1
- package/static/{chunk-RSS6GYNE.js → chunk-7ITZXYYJ.js} +1 -1
- package/static/chunk-7P27WBGC.js +4 -0
- package/static/chunk-ATP3BFHV.js +562 -0
- package/static/chunk-AWQ2YTVC.js +1 -0
- package/static/chunk-DSOE3FEP.js +1 -0
- package/static/{chunk-2R6HHGUR.js → chunk-EFKMBLRE.js} +1 -1
- package/static/chunk-FUFKVHPU.js +1 -0
- package/static/{chunk-MRSWNAVB.js → chunk-HCDLWTMW.js} +1 -1
- package/static/chunk-IPAC4VAF.js +1 -0
- package/static/{chunk-ZC5NIT55.js → chunk-IQOALFYU.js} +1 -1
- package/static/chunk-JASU3CIH.js +1 -0
- package/static/{chunk-6OJZWYRZ.js → chunk-JQ5FTO2M.js} +1 -1
- package/static/chunk-JUNZFADM.js +1 -0
- package/static/{chunk-LLWSLOSX.js → chunk-LJUKI4SQ.js} +1 -1
- package/static/{chunk-WI7FOANP.js → chunk-LUWQFIWR.js} +1 -1
- package/static/{chunk-BIUNUYZ5.js → chunk-ORMRCEGT.js} +1 -1
- package/static/{chunk-IZL7JPTS.js → chunk-Q7D6RN4N.js} +1 -1
- package/static/{chunk-JYXLQRHG.js → chunk-QJX6ITLW.js} +1 -1
- package/static/{chunk-YJMN3B4N.js → chunk-QQ6UQQBR.js} +1 -1
- package/static/chunk-S2HDY3OL.js +1 -0
- package/static/{chunk-NE4NDO45.js → chunk-S75P2FFI.js} +1 -1
- package/static/{chunk-CRQNEHTX.js → chunk-T3EYFSVZ.js} +1 -1
- package/static/{chunk-MCLQFZ3S.js → chunk-U34OZUZ7.js} +1 -1
- package/static/chunk-Y7EH7G5K.js +1 -0
- package/static/{chunk-MGGT6MIJ.js → chunk-ZQQPUYLU.js} +1 -1
- package/static/index.html +2 -2
- package/static/main-7SQDDVMD.js +9 -0
- package/static/{styles-FYUSO6OJ.css → styles-A5VYX3CE.css} +1 -1
- package/server/applications/users/dto/user-password.dto.js.map +0 -1
- package/static/chunk-4U5A2DEP.js +0 -4
- package/static/chunk-54EAZ2UD.js +0 -1
- package/static/chunk-7ZRXJONB.js +0 -1
- package/static/chunk-F2J2IIJE.js +0 -1
- package/static/chunk-FNFGUIQH.js +0 -4
- package/static/chunk-GGLK52CG.js +0 -1
- package/static/chunk-HW2H3ISM.js +0 -559
- package/static/chunk-HX6BBYVD.js +0 -1
- package/static/chunk-JF7S3UYQ.js +0 -1
- package/static/chunk-KSHPKI4G.js +0 -1
- package/static/chunk-VPJ2V27B.js +0 -1
- package/static/chunk-VUI3KV7V.js +0 -1
- package/static/chunk-ZXS4V7J2.js +0 -1
- package/static/main-FFIWFD2F.js +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../backend/src/applications/users/dto/delete-user.dto.ts"],"sourcesContent":["/*\n * Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>\n * This file is part of Sync-in | The open source file sync and share solution\n * See the LICENSE file for licensing details\n */\n\nimport { IsBoolean
|
|
1
|
+
{"version":3,"sources":["../../../../../backend/src/applications/users/dto/delete-user.dto.ts"],"sourcesContent":["/*\n * Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>\n * This file is part of Sync-in | The open source file sync and share solution\n * See the LICENSE file for licensing details\n */\n\nimport { IsBoolean } from 'class-validator'\n\nexport class DeleteUserDto {\n @IsBoolean()\n deleteSpace: boolean\n\n @IsBoolean()\n isGuest: boolean\n}\n"],"names":["DeleteUserDto"],"mappings":"AAAA;;;;CAIC;;;;+BAIYA;;;eAAAA;;;gCAFa;;;;;;;;;;AAEnB,IAAA,AAAMA,gBAAN,MAAMA;AAMb"}
|
|
@@ -13,6 +13,9 @@ function _export(target, all) {
|
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
15
|
_export(exports, {
|
|
16
|
+
get UserAppPasswordDto () {
|
|
17
|
+
return UserAppPasswordDto;
|
|
18
|
+
},
|
|
16
19
|
get UserLanguageDto () {
|
|
17
20
|
return UserLanguageDto;
|
|
18
21
|
},
|
|
@@ -21,9 +24,15 @@ _export(exports, {
|
|
|
21
24
|
},
|
|
22
25
|
get UserPasswordDto () {
|
|
23
26
|
return UserPasswordDto;
|
|
27
|
+
},
|
|
28
|
+
get UserUpdatePasswordDto () {
|
|
29
|
+
return UserUpdatePasswordDto;
|
|
24
30
|
}
|
|
25
31
|
});
|
|
32
|
+
const _classtransformer = require("class-transformer");
|
|
26
33
|
const _classvalidator = require("class-validator");
|
|
34
|
+
const _scope = require("../../../authentication/constants/scope");
|
|
35
|
+
const _shared = require("../../../common/shared");
|
|
27
36
|
const _user = require("../constants/user");
|
|
28
37
|
function _ts_decorate(decorators, target, key, desc) {
|
|
29
38
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -47,18 +56,44 @@ _ts_decorate([
|
|
|
47
56
|
(0, _classvalidator.IsInt)(),
|
|
48
57
|
_ts_metadata("design:type", Number)
|
|
49
58
|
], UserNotificationDto.prototype, "notification", void 0);
|
|
50
|
-
let
|
|
59
|
+
let UserUpdatePasswordDto = class UserUpdatePasswordDto {
|
|
51
60
|
};
|
|
52
61
|
_ts_decorate([
|
|
53
62
|
(0, _classvalidator.IsNotEmpty)(),
|
|
54
63
|
(0, _classvalidator.IsString)(),
|
|
55
64
|
_ts_metadata("design:type", String)
|
|
56
|
-
],
|
|
65
|
+
], UserUpdatePasswordDto.prototype, "oldPassword", void 0);
|
|
57
66
|
_ts_decorate([
|
|
58
67
|
(0, _classvalidator.IsNotEmpty)(),
|
|
59
68
|
(0, _classvalidator.IsString)(),
|
|
60
69
|
(0, _classvalidator.MinLength)(_user.USER_PASSWORD_MIN_LENGTH),
|
|
61
70
|
_ts_metadata("design:type", String)
|
|
62
|
-
],
|
|
71
|
+
], UserUpdatePasswordDto.prototype, "newPassword", void 0);
|
|
72
|
+
let UserPasswordDto = class UserPasswordDto {
|
|
73
|
+
};
|
|
74
|
+
_ts_decorate([
|
|
75
|
+
(0, _classvalidator.IsNotEmpty)(),
|
|
76
|
+
(0, _classvalidator.IsString)(),
|
|
77
|
+
(0, _classvalidator.MinLength)(_user.USER_PASSWORD_MIN_LENGTH),
|
|
78
|
+
_ts_metadata("design:type", String)
|
|
79
|
+
], UserPasswordDto.prototype, "password", void 0);
|
|
80
|
+
let UserAppPasswordDto = class UserAppPasswordDto {
|
|
81
|
+
};
|
|
82
|
+
_ts_decorate([
|
|
83
|
+
(0, _classvalidator.IsNotEmpty)(),
|
|
84
|
+
(0, _classvalidator.IsString)(),
|
|
85
|
+
_ts_metadata("design:type", String)
|
|
86
|
+
], UserAppPasswordDto.prototype, "name", void 0);
|
|
87
|
+
_ts_decorate([
|
|
88
|
+
(0, _classtransformer.Transform)(({ value })=>value.toLowerCase()),
|
|
89
|
+
(0, _classvalidator.IsEnum)(_scope.AUTH_SCOPE),
|
|
90
|
+
_ts_metadata("design:type", typeof _scope.AUTH_SCOPE === "undefined" ? Object : _scope.AUTH_SCOPE)
|
|
91
|
+
], UserAppPasswordDto.prototype, "app", void 0);
|
|
92
|
+
_ts_decorate([
|
|
93
|
+
(0, _classvalidator.IsOptional)(),
|
|
94
|
+
(0, _classtransformer.Transform)(({ value })=>value ? (0, _shared.currentDate)(value) : null),
|
|
95
|
+
(0, _classvalidator.IsDate)(),
|
|
96
|
+
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
97
|
+
], UserAppPasswordDto.prototype, "expiration", void 0);
|
|
63
98
|
|
|
64
99
|
//# sourceMappingURL=user-properties.dto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../backend/src/applications/users/dto/user-properties.dto.ts"],"sourcesContent":["/*\n * Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>\n * This file is part of Sync-in | The open source file sync and share solution\n * See the LICENSE file for licensing details\n */\n\nimport { IsInt, IsNotEmpty, IsString, MinLength, ValidateIf } from 'class-validator'\nimport { USER_PASSWORD_MIN_LENGTH } from '../constants/user'\n\nexport class UserLanguageDto {\n @ValidateIf((_, language) => language === null || typeof language === 'string')\n language: string | null\n}\n\nexport class UserNotificationDto {\n @IsNotEmpty()\n @IsInt()\n notification: number\n}\n\nexport class
|
|
1
|
+
{"version":3,"sources":["../../../../../backend/src/applications/users/dto/user-properties.dto.ts"],"sourcesContent":["/*\n * Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>\n * This file is part of Sync-in | The open source file sync and share solution\n * See the LICENSE file for licensing details\n */\n\nimport { Transform } from 'class-transformer'\nimport { IsDate, IsEnum, IsInt, IsNotEmpty, IsOptional, IsString, MinLength, ValidateIf } from 'class-validator'\nimport { AUTH_SCOPE } from '../../../authentication/constants/scope'\nimport { currentDate } from '../../../common/shared'\nimport { USER_PASSWORD_MIN_LENGTH } from '../constants/user'\n\nexport class UserLanguageDto {\n @ValidateIf((_, language) => language === null || typeof language === 'string')\n language: string | null\n}\n\nexport class UserNotificationDto {\n @IsNotEmpty()\n @IsInt()\n notification: number\n}\n\nexport class UserUpdatePasswordDto {\n @IsNotEmpty()\n @IsString()\n oldPassword: string\n\n @IsNotEmpty()\n @IsString()\n @MinLength(USER_PASSWORD_MIN_LENGTH)\n newPassword: string\n}\n\nexport class UserPasswordDto {\n @IsNotEmpty()\n @IsString()\n @MinLength(USER_PASSWORD_MIN_LENGTH)\n password: string\n}\n\nexport class UserAppPasswordDto {\n @IsNotEmpty()\n @IsString()\n name: string\n\n @Transform(({ value }) => value.toLowerCase())\n @IsEnum(AUTH_SCOPE)\n app: AUTH_SCOPE\n\n @IsOptional()\n @Transform(({ value }) => (value ? currentDate(value) : null))\n @IsDate()\n expiration?: Date\n}\n"],"names":["UserAppPasswordDto","UserLanguageDto","UserNotificationDto","UserPasswordDto","UserUpdatePasswordDto","_","language","value","toLowerCase","currentDate"],"mappings":"AAAA;;;;CAIC;;;;;;;;;;;QAqCYA;eAAAA;;QA7BAC;eAAAA;;QAKAC;eAAAA;;QAiBAC;eAAAA;;QAXAC;eAAAA;;;kCAjBa;gCACqE;uBACpE;wBACC;sBACa;;;;;;;;;;AAElC,IAAA,AAAMH,kBAAN,MAAMA;AAGb;;qCAFeI,GAAGC,WAAaA,aAAa,QAAQ,OAAOA,aAAa;;;AAIjE,IAAA,AAAMJ,sBAAN,MAAMA;AAIb;;;;;;AAEO,IAAA,AAAME,wBAAN,MAAMA;AASb;;;;;;;;;;;;AAEO,IAAA,AAAMD,kBAAN,MAAMA;AAKb;;;;;;;AAEO,IAAA,AAAMH,qBAAN,MAAMA;AAab;;;;;;;sCARc,EAAEO,KAAK,EAAE,GAAKA,MAAMC,WAAW;;;;;;sCAK/B,EAAED,KAAK,EAAE,GAAMA,QAAQE,IAAAA,mBAAW,EAACF,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../backend/src/applications/users/interfaces/admin-user.interface.ts"],"sourcesContent":["/*\n * Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>\n * This file is part of Sync-in | The open source file sync and share solution\n * See the LICENSE file for licensing details\n */\n\nimport type { User } from '../schemas/user.interface'\nimport type { Member } from './member.interface'\n\nexport type AdminUser = Partial<User> & { fullName: string; groups?: Member[] }\n"],"names":[],"mappings":"AAAA;;;;CAIC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../backend/src/applications/users/interfaces/admin-user.interface.ts"],"sourcesContent":["/*\n * Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>\n * This file is part of Sync-in | The open source file sync and share solution\n * See the LICENSE file for licensing details\n */\n\nimport type { User } from '../schemas/user.interface'\nimport type { Member } from './member.interface'\n\nexport type AdminUser = Partial<User> & { fullName: string; groups?: Member[]; twoFaEnabled?: boolean }\n"],"names":[],"mappings":"AAAA;;;;CAIC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>
|
|
3
|
+
* This file is part of Sync-in | The open source file sync and share solution
|
|
4
|
+
* See the LICENSE file for licensing details
|
|
5
|
+
*/ "use strict";
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=user-secrets.interface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../backend/src/applications/users/interfaces/user-secrets.interface.ts"],"sourcesContent":["/*\n * Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>\n * This file is part of Sync-in | The open source file sync and share solution\n * See the LICENSE file for licensing details\n */\n\nimport { AUTH_SCOPE } from '../../../authentication/constants/scope'\nimport { USER_SECRET } from '../constants/user'\n\nexport interface UserAppPassword {\n name: string\n app: AUTH_SCOPE\n password: string\n expiration: Date\n currentIp: string\n lastIp: string\n currentAccess: Date\n lastAccess: Date\n createdAt: Date\n}\n\nexport interface UserSecrets {\n [USER_SECRET.TWO_FA_SECRET]?: string\n [USER_SECRET.RECOVERY_CODES]?: string[]\n [USER_SECRET.APP_PASSWORDS]?: UserAppPassword[]\n}\n"],"names":[],"mappings":"AAAA;;;;CAIC"}
|
|
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "UserModel", {
|
|
|
15
15
|
const _classtransformer = require("class-transformer");
|
|
16
16
|
const _promises = /*#__PURE__*/ _interop_require_default(require("node:fs/promises"));
|
|
17
17
|
const _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path"));
|
|
18
|
+
const _shared = require("../../../common/shared");
|
|
18
19
|
const _configenvironment = require("../../../configuration/config.environment");
|
|
19
20
|
const _spaces = require("../../spaces/constants/spaces");
|
|
20
21
|
const _user = require("../constants/user");
|
|
@@ -33,16 +34,23 @@ function _ts_metadata(k, v) {
|
|
|
33
34
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
34
35
|
}
|
|
35
36
|
let UserModel = class UserModel {
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
get homePath() {
|
|
38
|
+
if (this.isLink || this.isGuest) {
|
|
39
|
+
return this._homePath ||= _nodepath.default.join(_configenvironment.configuration.applications.files.tmpPath, this.isGuest ? 'guests' : 'links', this.login);
|
|
40
|
+
}
|
|
41
|
+
return this._homePath ||= _nodepath.default.join(_configenvironment.configuration.applications.files.usersPath, this.login);
|
|
38
42
|
}
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
get filesPath() {
|
|
44
|
+
return this._filesPath ||= _nodepath.default.join(this.homePath, _spaces.SPACE_REPOSITORY.FILES);
|
|
41
45
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
get trashPath() {
|
|
47
|
+
return this._trashPath ||= _nodepath.default.join(this.homePath, _spaces.SPACE_REPOSITORY.TRASH);
|
|
48
|
+
}
|
|
49
|
+
get tmpPath() {
|
|
50
|
+
return this._tmpPath ||= _nodepath.default.join(this.homePath, _user.USER_PATH.TMP);
|
|
51
|
+
}
|
|
52
|
+
get tasksPath() {
|
|
53
|
+
return this._tasksPath ||= _nodepath.default.join(this.tmpPath, _user.USER_PATH.TASKS);
|
|
46
54
|
}
|
|
47
55
|
get isAdmin() {
|
|
48
56
|
return this.role === _user.USER_ROLE.ADMINISTRATOR;
|
|
@@ -59,23 +67,41 @@ let UserModel = class UserModel {
|
|
|
59
67
|
get quotaIsExceeded() {
|
|
60
68
|
return this.storageQuota !== null && this.storageUsage >= this.storageQuota;
|
|
61
69
|
}
|
|
62
|
-
get
|
|
63
|
-
|
|
64
|
-
|
|
70
|
+
get twoFaEnabled() {
|
|
71
|
+
return !!this.secrets?.twoFaSecret;
|
|
72
|
+
}
|
|
73
|
+
get appPasswords() {
|
|
74
|
+
return this.secrets?.appPasswords?.length || 0;
|
|
75
|
+
}
|
|
76
|
+
static getHomePath(userLogin, isGuest = false, isLink = false) {
|
|
77
|
+
if (isGuest || isLink) {
|
|
78
|
+
return _nodepath.default.join(_configenvironment.configuration.applications.files.tmpPath, isGuest ? 'guests' : 'links', userLogin);
|
|
65
79
|
}
|
|
66
|
-
return
|
|
80
|
+
return _nodepath.default.join(_configenvironment.configuration.applications.files.usersPath, userLogin);
|
|
67
81
|
}
|
|
68
|
-
|
|
69
|
-
return
|
|
82
|
+
static getFilesPath(userLogin) {
|
|
83
|
+
return _nodepath.default.join(UserModel.getHomePath(userLogin), _spaces.SPACE_REPOSITORY.FILES);
|
|
70
84
|
}
|
|
71
|
-
|
|
72
|
-
return
|
|
85
|
+
static getTrashPath(userLogin) {
|
|
86
|
+
return _nodepath.default.join(UserModel.getHomePath(userLogin), _spaces.SPACE_REPOSITORY.TRASH);
|
|
73
87
|
}
|
|
74
|
-
|
|
75
|
-
return
|
|
88
|
+
static getTasksPath(userLogin, isGuest = false, isLink = false) {
|
|
89
|
+
return _nodepath.default.join(UserModel.getHomePath(userLogin, isGuest, isLink), _user.USER_PATH.TMP, _user.USER_PATH.TASKS);
|
|
76
90
|
}
|
|
77
|
-
|
|
78
|
-
|
|
91
|
+
static getRepositoryPath(userLogin, inTrash = false) {
|
|
92
|
+
if (inTrash) return UserModel.getTrashPath(userLogin);
|
|
93
|
+
return UserModel.getFilesPath(userLogin);
|
|
94
|
+
}
|
|
95
|
+
toString() {
|
|
96
|
+
return `*User <${this.login}> (${this.id})*`;
|
|
97
|
+
}
|
|
98
|
+
removePassword() {
|
|
99
|
+
delete this.password;
|
|
100
|
+
}
|
|
101
|
+
setFullName(force = false) {
|
|
102
|
+
if (!this.fullName || force) {
|
|
103
|
+
this.fullName = `${this.firstName || ''} ${this.lastName || ''}`.trim();
|
|
104
|
+
}
|
|
79
105
|
}
|
|
80
106
|
async makePaths() {
|
|
81
107
|
if (this.isGuest || this.isLink) {
|
|
@@ -123,21 +149,6 @@ let UserModel = class UserModel {
|
|
|
123
149
|
}
|
|
124
150
|
return `${initials.f.toUpperCase()}${initials.l.toLowerCase()}`;
|
|
125
151
|
}
|
|
126
|
-
setProfile() {
|
|
127
|
-
if (this.isLink) {
|
|
128
|
-
this.login = `Link (${this.id})`;
|
|
129
|
-
this.email = 'guest-link@sync-in';
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
setApplications() {
|
|
133
|
-
if (this.isGuest) {
|
|
134
|
-
// dynamically set the permissions
|
|
135
|
-
this.applications = Object.values(_user.GUEST_PERMISSION);
|
|
136
|
-
} else if (this.permissions) {
|
|
137
|
-
this.applications = this.permissions.split(_user.USER_PERMS_SEP);
|
|
138
|
-
}
|
|
139
|
-
delete this.permissions;
|
|
140
|
-
}
|
|
141
152
|
havePermission(permission) {
|
|
142
153
|
if (this.isAdmin) {
|
|
143
154
|
return true;
|
|
@@ -150,28 +161,37 @@ let UserModel = class UserModel {
|
|
|
150
161
|
haveRole(role) {
|
|
151
162
|
return this.role <= role;
|
|
152
163
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
164
|
+
initSecrets(props) {
|
|
165
|
+
// Remove the `twoFaEnabled` property to avoid conflicts with the current getter when using `plainToClass` with `class-validator`
|
|
166
|
+
// The `props` variable may be empty when the class is instantiated using `plainToClass`
|
|
167
|
+
if (props && 'twoFaEnabled' in props) {
|
|
168
|
+
// Only used when the User model is instantiated from a token payload
|
|
169
|
+
// Set a `twoFaSecret` property (boolean) on the `secrets` property so that the `twoFaEnabled` getter returns `true`
|
|
170
|
+
this.secrets = {
|
|
171
|
+
twoFaSecret: (0, _shared.popFromObject)('twoFaEnabled', props)
|
|
172
|
+
};
|
|
156
173
|
}
|
|
157
|
-
return _nodepath.default.join(_configenvironment.configuration.applications.files.usersPath, userLogin);
|
|
158
|
-
}
|
|
159
|
-
static getFilesPath(userLogin) {
|
|
160
|
-
return _nodepath.default.join(UserModel.getHomePath(userLogin), _spaces.SPACE_REPOSITORY.FILES);
|
|
161
|
-
}
|
|
162
|
-
static getTrashPath(userLogin) {
|
|
163
|
-
return _nodepath.default.join(UserModel.getHomePath(userLogin), _spaces.SPACE_REPOSITORY.TRASH);
|
|
164
174
|
}
|
|
165
|
-
|
|
166
|
-
|
|
175
|
+
setProfile() {
|
|
176
|
+
if (this.isLink) {
|
|
177
|
+
this.login = `Link (${this.id})`;
|
|
178
|
+
this.email = 'guest-link@sync-in';
|
|
179
|
+
}
|
|
167
180
|
}
|
|
168
|
-
|
|
169
|
-
if (
|
|
170
|
-
|
|
181
|
+
setApplications() {
|
|
182
|
+
if (this.isGuest) {
|
|
183
|
+
// dynamically set the permissions
|
|
184
|
+
this.applications = Object.values(_user.GUEST_PERMISSION);
|
|
185
|
+
} else if (this.permissions) {
|
|
186
|
+
this.applications = this.permissions.split(_user.USER_PERMS_SEP);
|
|
187
|
+
}
|
|
188
|
+
delete this.permissions;
|
|
171
189
|
}
|
|
172
190
|
constructor(props, removePassword = true){
|
|
173
191
|
// permissions as a list
|
|
174
192
|
this.applications = [];
|
|
193
|
+
// User model can be instantiated with data from the database or from a token payload
|
|
194
|
+
this.initSecrets(props);
|
|
175
195
|
Object.assign(this, props);
|
|
176
196
|
if (removePassword) {
|
|
177
197
|
// always remove the password field from model for obvious security reasons
|
|
@@ -187,6 +207,10 @@ _ts_decorate([
|
|
|
187
207
|
(0, _classtransformer.Exclude)(),
|
|
188
208
|
_ts_metadata("design:type", String)
|
|
189
209
|
], UserModel.prototype, "password", void 0);
|
|
210
|
+
_ts_decorate([
|
|
211
|
+
(0, _classtransformer.Exclude)(),
|
|
212
|
+
_ts_metadata("design:type", typeof UserSecrets === "undefined" ? Object : UserSecrets)
|
|
213
|
+
], UserModel.prototype, "secrets", void 0);
|
|
190
214
|
_ts_decorate([
|
|
191
215
|
(0, _classtransformer.Exclude)(),
|
|
192
216
|
_ts_metadata("design:type", Number)
|
|
@@ -222,5 +246,15 @@ _ts_decorate([
|
|
|
222
246
|
_ts_metadata("design:type", Boolean),
|
|
223
247
|
_ts_metadata("design:paramtypes", [])
|
|
224
248
|
], UserModel.prototype, "quotaIsExceeded", null);
|
|
249
|
+
_ts_decorate([
|
|
250
|
+
(0, _classtransformer.Expose)(),
|
|
251
|
+
_ts_metadata("design:type", Boolean),
|
|
252
|
+
_ts_metadata("design:paramtypes", [])
|
|
253
|
+
], UserModel.prototype, "twoFaEnabled", null);
|
|
254
|
+
_ts_decorate([
|
|
255
|
+
(0, _classtransformer.Expose)(),
|
|
256
|
+
_ts_metadata("design:type", Number),
|
|
257
|
+
_ts_metadata("design:paramtypes", [])
|
|
258
|
+
], UserModel.prototype, "appPasswords", null);
|
|
225
259
|
|
|
226
260
|
//# sourceMappingURL=user.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../backend/src/applications/users/models/user.model.ts"],"sourcesContent":["/*\n * Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>\n * This file is part of Sync-in | The open source file sync and share solution\n * See the LICENSE file for licensing details\n */\n\nimport { Exclude, Expose } from 'class-transformer'\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\nimport { configuration } from '../../../configuration/config.environment'\nimport { SPACE_REPOSITORY } from '../../spaces/constants/spaces'\nimport { GUEST_PERMISSION, USER_PATH, USER_PERMISSION, USER_PERMS_SEP, USER_ROLE } from '../constants/user'\nimport type { Owner } from '../interfaces/owner.interface'\nimport type { User } from '../schemas/user.interface'\n\nexport class UserModel implements User {\n id: number\n login: string\n email: string\n firstName: string\n lastName: string\n role: number\n language: string\n notification: number\n onlineStatus: number\n permissions: string\n storageUsage: number\n storageQuota: number\n isActive: boolean\n passwordAttempts: number\n currentIp: string\n lastIp: string\n currentAccess: Date\n lastAccess: Date\n createdAt: Date\n // exclusions\n @Exclude()\n password: string\n @Exclude()\n // only used on backend\n impersonatedFromId?: number\n impersonatedClientId?: string\n // used for desktop|cmd app\n clientId?: string\n\n // outside db schema\n fullName: string\n impersonated?: boolean\n avatarBase64?: string\n // permissions as a list\n applications: string[] = []\n private _homePath: string\n private _filesPath: string\n private _trashPath: string\n private _tmpPath: string\n private _tasksPath: string\n\n @Exclude({ toPlainOnly: true })\n exp?: number // refresh token expiration needed to refresh\n\n constructor(props: Partial<User> & { exp?: number }, removePassword = true) {\n Object.assign(this, props)\n if (removePassword) {\n // always remove the password field from model for obvious security reasons\n // do not remove it from `props` to not mutate the object\n this.removePassword()\n }\n this.setFullName()\n this.setApplications()\n this.setProfile()\n }\n\n toString(): string {\n return `*User <${this.login}> (${this.id})*`\n }\n\n removePassword() {\n delete this.password\n }\n\n setFullName() {\n if (!this.fullName) {\n this.fullName = `${this.firstName || ''} ${this.lastName || ''}`.trim()\n }\n }\n\n @Expose()\n get isAdmin(): boolean {\n return this.role === USER_ROLE.ADMINISTRATOR\n }\n\n @Expose()\n get isUser(): boolean {\n return this.role === USER_ROLE.USER || this.role === USER_ROLE.ADMINISTRATOR\n }\n\n @Expose()\n get isGuest(): boolean {\n return this.role === USER_ROLE.GUEST\n }\n\n @Expose()\n get isLink(): boolean {\n return this.role === USER_ROLE.LINK\n }\n\n @Expose()\n get quotaIsExceeded(): boolean {\n return this.storageQuota !== null && this.storageUsage >= this.storageQuota\n }\n\n get homePath(): string {\n if (this.isLink || this.isGuest) {\n return (this._homePath ||= path.join(configuration.applications.files.tmpPath, this.isGuest ? 'guests' : 'links', this.login))\n }\n return (this._homePath ||= path.join(configuration.applications.files.usersPath, this.login))\n }\n\n get filesPath(): string {\n return (this._filesPath ||= path.join(this.homePath, SPACE_REPOSITORY.FILES))\n }\n\n get trashPath(): string {\n return (this._trashPath ||= path.join(this.homePath, SPACE_REPOSITORY.TRASH))\n }\n\n get tmpPath(): string {\n return (this._tmpPath ||= path.join(this.homePath, USER_PATH.TMP))\n }\n\n get tasksPath(): string {\n return (this._tasksPath ||= path.join(this.tmpPath, USER_PATH.TASKS))\n }\n\n async makePaths(): Promise<void> {\n if (this.isGuest || this.isLink) {\n await fs.mkdir(this.tasksPath, { recursive: true })\n } else {\n for (const p of [this.filesPath, this.trashPath, this.tasksPath]) {\n await fs.mkdir(p, { recursive: true })\n }\n }\n }\n\n asOwner(): Owner {\n return { id: this.id, login: this.login, email: this.email, fullName: this.fullName }\n }\n\n getInitials(): string {\n let initials: { f: string; l: string }\n if (this.firstName) {\n if (this.lastName) {\n initials = { f: this.firstName.charAt(0), l: this.lastName.charAt(0) }\n }\n initials = { f: this.firstName.charAt(0), l: this.firstName.charAt(1) }\n } else {\n initials = { f: this.login.charAt(0), l: this.login.charAt(1) }\n }\n return `${initials.f.toUpperCase()}${initials.l.toLowerCase()}`\n }\n\n private setProfile() {\n if (this.isLink) {\n this.login = `Link (${this.id})`\n this.email = 'guest-link@sync-in'\n }\n }\n\n private setApplications() {\n if (this.isGuest) {\n // dynamically set the permissions\n this.applications = Object.values(GUEST_PERMISSION)\n } else if (this.permissions) {\n this.applications = this.permissions.split(USER_PERMS_SEP)\n }\n delete this.permissions\n }\n\n havePermission(permission: string): boolean {\n if (this.isAdmin) {\n return true\n }\n if (permission === USER_PERMISSION.PERSONAL_SPACE && this.isGuest) {\n return false\n }\n return this.applications.indexOf(permission) !== -1\n }\n\n haveRole(role: number): boolean {\n return this.role <= role\n }\n\n static getHomePath(userLogin: string, isGuest = false, isLink = false): string {\n if (isGuest || isLink) {\n return path.join(configuration.applications.files.tmpPath, isGuest ? 'guests' : 'links', userLogin)\n }\n return path.join(configuration.applications.files.usersPath, userLogin)\n }\n\n static getFilesPath(userLogin: string): string {\n return path.join(UserModel.getHomePath(userLogin), SPACE_REPOSITORY.FILES)\n }\n\n static getTrashPath(userLogin: string): string {\n return path.join(UserModel.getHomePath(userLogin), SPACE_REPOSITORY.TRASH)\n }\n\n static getTasksPath(userLogin: string, isGuest = false, isLink = false): string {\n return path.join(UserModel.getHomePath(userLogin, isGuest, isLink), USER_PATH.TMP, USER_PATH.TASKS)\n }\n\n static getRepositoryPath(userLogin: string, inTrash = false): string {\n if (inTrash) return UserModel.getTrashPath(userLogin)\n return UserModel.getFilesPath(userLogin)\n }\n}\n"],"names":["UserModel","toString","login","id","removePassword","password","setFullName","fullName","firstName","lastName","trim","isAdmin","role","USER_ROLE","ADMINISTRATOR","isUser","USER","isGuest","GUEST","isLink","LINK","quotaIsExceeded","storageQuota","storageUsage","homePath","_homePath","path","join","configuration","applications","files","tmpPath","usersPath","filesPath","_filesPath","SPACE_REPOSITORY","FILES","trashPath","_trashPath","TRASH","_tmpPath","USER_PATH","TMP","tasksPath","_tasksPath","TASKS","makePaths","fs","mkdir","recursive","p","asOwner","email","getInitials","initials","f","charAt","l","toUpperCase","toLowerCase","setProfile","setApplications","Object","values","GUEST_PERMISSION","permissions","split","USER_PERMS_SEP","havePermission","permission","USER_PERMISSION","PERSONAL_SPACE","indexOf","haveRole","getHomePath","userLogin","getFilesPath","getTrashPath","getTasksPath","getRepositoryPath","inTrash","props","assign","toPlainOnly"],"mappings":"AAAA;;;;CAIC;;;;+BAWYA;;;eAAAA;;;kCATmB;iEACjB;iEACE;mCACa;wBACG;sBACuD;;;;;;;;;;;;;;;AAIjF,IAAA,AAAMA,YAAN,MAAMA;IAyDXC,WAAmB;QACjB,OAAO,CAAC,OAAO,E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;;;;;QA9JauB,aAAa"}
|
|
1
|
+
{"version":3,"sources":["../../../../../backend/src/applications/users/models/user.model.ts"],"sourcesContent":["/*\n * Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>\n * This file is part of Sync-in | The open source file sync and share solution\n * See the LICENSE file for licensing details\n */\n\nimport { Exclude, Expose } from 'class-transformer'\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\nimport { popFromObject } from '../../../common/shared'\nimport { configuration } from '../../../configuration/config.environment'\nimport { SPACE_REPOSITORY } from '../../spaces/constants/spaces'\nimport { GUEST_PERMISSION, USER_PATH, USER_PERMISSION, USER_PERMS_SEP, USER_ROLE } from '../constants/user'\nimport type { Owner } from '../interfaces/owner.interface'\nimport type { UserSecrets } from '../interfaces/user-secrets.interface'\nimport type { User } from '../schemas/user.interface'\n\nexport class UserModel implements User {\n id: number\n login: string\n email: string\n firstName: string\n lastName: string\n role: number\n language: string\n isActive: boolean\n notification: number\n onlineStatus: number\n permissions: string\n storageUsage: number\n storageQuota: number\n passwordAttempts: number\n currentIp: string\n lastIp: string\n currentAccess: Date\n lastAccess: Date\n createdAt: Date\n // exclusions\n @Exclude()\n password: string\n @Exclude()\n secrets: UserSecrets\n @Exclude()\n // only used on backend\n impersonatedFromId?: number\n impersonatedClientId?: string\n // used for desktop|cmd app\n clientId?: string\n\n // outside db schema\n fullName: string\n impersonated?: boolean\n avatarBase64?: string\n // permissions as a list\n applications: string[] = []\n @Exclude({ toPlainOnly: true })\n exp?: number // refresh token expiration needed to refresh\n\n constructor(props: Partial<User> & { exp?: number; twoFaEnabled?: boolean }, removePassword = true) {\n // User model can be instantiated with data from the database or from a token payload\n this.initSecrets(props)\n Object.assign(this, props)\n if (removePassword) {\n // always remove the password field from model for obvious security reasons\n // do not remove it from `props` to not mutate the object\n this.removePassword()\n }\n this.setFullName()\n this.setApplications()\n this.setProfile()\n }\n\n private _homePath: string\n\n get homePath(): string {\n if (this.isLink || this.isGuest) {\n return (this._homePath ||= path.join(configuration.applications.files.tmpPath, this.isGuest ? 'guests' : 'links', this.login))\n }\n return (this._homePath ||= path.join(configuration.applications.files.usersPath, this.login))\n }\n\n private _filesPath: string\n\n get filesPath(): string {\n return (this._filesPath ||= path.join(this.homePath, SPACE_REPOSITORY.FILES))\n }\n\n private _trashPath: string\n\n get trashPath(): string {\n return (this._trashPath ||= path.join(this.homePath, SPACE_REPOSITORY.TRASH))\n }\n\n private _tmpPath: string\n\n get tmpPath(): string {\n return (this._tmpPath ||= path.join(this.homePath, USER_PATH.TMP))\n }\n\n private _tasksPath: string\n\n get tasksPath(): string {\n return (this._tasksPath ||= path.join(this.tmpPath, USER_PATH.TASKS))\n }\n\n @Expose()\n get isAdmin(): boolean {\n return this.role === USER_ROLE.ADMINISTRATOR\n }\n\n @Expose()\n get isUser(): boolean {\n return this.role === USER_ROLE.USER || this.role === USER_ROLE.ADMINISTRATOR\n }\n\n @Expose()\n get isGuest(): boolean {\n return this.role === USER_ROLE.GUEST\n }\n\n @Expose()\n get isLink(): boolean {\n return this.role === USER_ROLE.LINK\n }\n\n @Expose()\n get quotaIsExceeded(): boolean {\n return this.storageQuota !== null && this.storageUsage >= this.storageQuota\n }\n\n @Expose()\n get twoFaEnabled(): boolean {\n return !!this.secrets?.twoFaSecret\n }\n\n @Expose()\n get appPasswords(): number {\n return this.secrets?.appPasswords?.length || 0\n }\n\n static getHomePath(userLogin: string, isGuest = false, isLink = false): string {\n if (isGuest || isLink) {\n return path.join(configuration.applications.files.tmpPath, isGuest ? 'guests' : 'links', userLogin)\n }\n return path.join(configuration.applications.files.usersPath, userLogin)\n }\n\n static getFilesPath(userLogin: string): string {\n return path.join(UserModel.getHomePath(userLogin), SPACE_REPOSITORY.FILES)\n }\n\n static getTrashPath(userLogin: string): string {\n return path.join(UserModel.getHomePath(userLogin), SPACE_REPOSITORY.TRASH)\n }\n\n static getTasksPath(userLogin: string, isGuest = false, isLink = false): string {\n return path.join(UserModel.getHomePath(userLogin, isGuest, isLink), USER_PATH.TMP, USER_PATH.TASKS)\n }\n\n static getRepositoryPath(userLogin: string, inTrash = false): string {\n if (inTrash) return UserModel.getTrashPath(userLogin)\n return UserModel.getFilesPath(userLogin)\n }\n\n toString(): string {\n return `*User <${this.login}> (${this.id})*`\n }\n\n removePassword() {\n delete this.password\n }\n\n setFullName(force = false) {\n if (!this.fullName || force) {\n this.fullName = `${this.firstName || ''} ${this.lastName || ''}`.trim()\n }\n }\n\n async makePaths(): Promise<void> {\n if (this.isGuest || this.isLink) {\n await fs.mkdir(this.tasksPath, { recursive: true })\n } else {\n for (const p of [this.filesPath, this.trashPath, this.tasksPath]) {\n await fs.mkdir(p, { recursive: true })\n }\n }\n }\n\n asOwner(): Owner {\n return { id: this.id, login: this.login, email: this.email, fullName: this.fullName }\n }\n\n getInitials(): string {\n let initials: { f: string; l: string }\n if (this.firstName) {\n if (this.lastName) {\n initials = { f: this.firstName.charAt(0), l: this.lastName.charAt(0) }\n }\n initials = { f: this.firstName.charAt(0), l: this.firstName.charAt(1) }\n } else {\n initials = { f: this.login.charAt(0), l: this.login.charAt(1) }\n }\n return `${initials.f.toUpperCase()}${initials.l.toLowerCase()}`\n }\n\n havePermission(permission: string): boolean {\n if (this.isAdmin) {\n return true\n }\n if (permission === USER_PERMISSION.PERSONAL_SPACE && this.isGuest) {\n return false\n }\n return this.applications.indexOf(permission) !== -1\n }\n\n haveRole(role: number): boolean {\n return this.role <= role\n }\n\n private initSecrets(props: Partial<UserModel>) {\n // Remove the `twoFaEnabled` property to avoid conflicts with the current getter when using `plainToClass` with `class-validator`\n // The `props` variable may be empty when the class is instantiated using `plainToClass`\n if (props && 'twoFaEnabled' in props) {\n // Only used when the User model is instantiated from a token payload\n // Set a `twoFaSecret` property (boolean) on the `secrets` property so that the `twoFaEnabled` getter returns `true`\n this.secrets = { twoFaSecret: popFromObject('twoFaEnabled', props) }\n }\n }\n\n private setProfile() {\n if (this.isLink) {\n this.login = `Link (${this.id})`\n this.email = 'guest-link@sync-in'\n }\n }\n\n private setApplications() {\n if (this.isGuest) {\n // dynamically set the permissions\n this.applications = Object.values(GUEST_PERMISSION)\n } else if (this.permissions) {\n this.applications = this.permissions.split(USER_PERMS_SEP)\n }\n delete this.permissions\n }\n}\n"],"names":["UserModel","homePath","isLink","isGuest","_homePath","path","join","configuration","applications","files","tmpPath","login","usersPath","filesPath","_filesPath","SPACE_REPOSITORY","FILES","trashPath","_trashPath","TRASH","_tmpPath","USER_PATH","TMP","tasksPath","_tasksPath","TASKS","isAdmin","role","USER_ROLE","ADMINISTRATOR","isUser","USER","GUEST","LINK","quotaIsExceeded","storageQuota","storageUsage","twoFaEnabled","secrets","twoFaSecret","appPasswords","length","getHomePath","userLogin","getFilesPath","getTrashPath","getTasksPath","getRepositoryPath","inTrash","toString","id","removePassword","password","setFullName","force","fullName","firstName","lastName","trim","makePaths","fs","mkdir","recursive","p","asOwner","email","getInitials","initials","f","charAt","l","toUpperCase","toLowerCase","havePermission","permission","USER_PERMISSION","PERSONAL_SPACE","indexOf","haveRole","initSecrets","props","popFromObject","setProfile","setApplications","Object","values","GUEST_PERMISSION","permissions","split","USER_PERMS_SEP","assign","toPlainOnly"],"mappings":"AAAA;;;;CAIC;;;;+BAaYA;;;eAAAA;;;kCAXmB;iEACjB;iEACE;wBACa;mCACA;wBACG;sBACuD;;;;;;;;;;;;;;;AAKjF,IAAA,AAAMA,YAAN,MAAMA;IAyDX,IAAIC,WAAmB;QACrB,IAAI,IAAI,CAACC,MAAM,IAAI,IAAI,CAACC,OAAO,EAAE;YAC/B,OAAQ,IAAI,CAACC,SAAS,KAAKC,iBAAI,CAACC,IAAI,CAACC,gCAAa,CAACC,YAAY,CAACC,KAAK,CAACC,OAAO,EAAE,IAAI,CAACP,OAAO,GAAG,WAAW,SAAS,IAAI,CAACQ,KAAK;QAC9H;QACA,OAAQ,IAAI,CAACP,SAAS,KAAKC,iBAAI,CAACC,IAAI,CAACC,gCAAa,CAACC,YAAY,CAACC,KAAK,CAACG,SAAS,EAAE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ACA,IAAI,CAACE,WAAW;QAChB,IAAI,CAAC8B,eAAe;QACpB,IAAI,CAACD,UAAU;IACjB;AA+KF;;;;;;;;;;;;;;;QA9LaS,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../backend/src/applications/users/schemas/user.interface.ts"],"sourcesContent":["/*\n * Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>\n * This file is part of Sync-in | The open source file sync and share solution\n * See the LICENSE file for licensing details\n */\n\nimport type { users } from './users.schema'\n\ntype UserSchema = typeof users.$inferSelect\n\nexport class User implements UserSchema {\n id: number\n email: string\n login: string\n firstName: string\n lastName: string\n password: string\n role: number\n isActive: boolean\n language: string\n permissions: string\n storageUsage: number\n storageQuota: number\n notification: number\n onlineStatus: number\n passwordAttempts: number\n currentIp: string\n lastIp: string\n currentAccess: Date\n lastAccess: Date\n createdAt: Date\n}\n"],"names":["User"],"mappings":"AAAA;;;;CAIC;;;;+
|
|
1
|
+
{"version":3,"sources":["../../../../../backend/src/applications/users/schemas/user.interface.ts"],"sourcesContent":["/*\n * Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>\n * This file is part of Sync-in | The open source file sync and share solution\n * See the LICENSE file for licensing details\n */\n\nimport type { UserSecrets } from '../interfaces/user-secrets.interface'\nimport type { users } from './users.schema'\n\ntype UserSchema = typeof users.$inferSelect\n\nexport class User implements UserSchema {\n id: number\n email: string\n login: string\n firstName: string\n lastName: string\n password: string\n role: number\n isActive: boolean\n secrets: UserSecrets\n language: string\n permissions: string\n storageUsage: number\n storageQuota: number\n notification: number\n onlineStatus: number\n passwordAttempts: number\n currentIp: string\n lastIp: string\n currentAccess: Date\n lastAccess: Date\n createdAt: Date\n}\n"],"names":["User"],"mappings":"AAAA;;;;CAIC;;;;+BAOYA;;;eAAAA;;;AAAN,IAAA,AAAMA,OAAN,MAAMA;AAsBb"}
|
|
@@ -22,6 +22,7 @@ _export(exports, {
|
|
|
22
22
|
});
|
|
23
23
|
const _drizzleorm = require("drizzle-orm");
|
|
24
24
|
const _mysqlcore = require("drizzle-orm/mysql-core");
|
|
25
|
+
const _columns = require("../../../infrastructure/database/columns");
|
|
25
26
|
const users = (0, _mysqlcore.mysqlTable)('users', {
|
|
26
27
|
id: (0, _mysqlcore.bigint)('id', {
|
|
27
28
|
mode: 'number',
|
|
@@ -49,6 +50,7 @@ const users = (0, _mysqlcore.mysqlTable)('users', {
|
|
|
49
50
|
unsigned: true
|
|
50
51
|
}).default(1).notNull(),
|
|
51
52
|
isActive: (0, _mysqlcore.boolean)('isActive').default(true).notNull(),
|
|
53
|
+
secrets: (0, _columns.jsonColumn)()('secrets'),
|
|
52
54
|
language: (0, _mysqlcore.char)('language', {
|
|
53
55
|
length: 2
|
|
54
56
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../backend/src/applications/users/schemas/users.schema.ts"],"sourcesContent":["/*\n * Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>\n * This file is part of Sync-in | The open source file sync and share solution\n * See the LICENSE file for licensing details\n */\n\nimport { SQL, sql } from 'drizzle-orm'\nimport { bigint, boolean, char, datetime, index, mysqlTable, tinyint, uniqueIndex, varchar } from 'drizzle-orm/mysql-core'\n\n/*\n role:\n 0: administrator\n 1: user\n 2: guest\n 3: link\n notification:\n 0: application\n 1: application + mail\n onlineStatus:\n 0: available\n 1: busy\n 2: absent\n 3: offline\n storageQuota:\n 0 : no storage\n null : unlimited\n other: limited to value\n*/\n\nexport const users = mysqlTable(\n 'users',\n {\n id: bigint('id', { mode: 'number', unsigned: true }).autoincrement().primaryKey(),\n email: varchar('email', { length: 255 }).notNull(),\n login: varchar('login', { length: 255 }).notNull(),\n firstName: varchar('firstName', { length: 255 }),\n lastName: varchar('lastName', { length: 255 }),\n password: varchar('password', { length: 255 }).notNull(),\n passwordAttempts: tinyint('passwordAttempts', { unsigned: true }).default(0).notNull(),\n role: tinyint('role', { unsigned: true }).default(1).notNull(),\n isActive: boolean('isActive').default(true).notNull(),\n language: char('language', { length: 2 }),\n permissions: varchar('permissions', { length: 255 }).default('').notNull(),\n storageUsage: bigint('storageUsage', { mode: 'number', unsigned: true }).default(0),\n storageQuota: bigint('storageQuota', { mode: 'number', unsigned: true }),\n notification: tinyint('notification', { unsigned: true }).default(1).notNull(),\n onlineStatus: tinyint('onlineStatus', { unsigned: true }).default(0).notNull(),\n currentIp: varchar('currentIp', { length: 45 }),\n lastIp: varchar('lastIp', { length: 45 }),\n currentAccess: datetime('currentAccess', { mode: 'date' }),\n lastAccess: datetime('lastAccess', { mode: 'date' }),\n createdAt: datetime('createdAt', { mode: 'date' })\n .default(sql`CURRENT_TIMESTAMP`)\n .notNull()\n },\n (table) => [uniqueIndex('email_idx').on(table.email), uniqueIndex('login_idx').on(table.login), index('role_idx').on(table.role)]\n)\n\nexport const userFullNameSQL = (user: any): SQL<string> => sql`TRIM(CONCAT(${user.firstName}, ' ', ${user.lastName}))`\n"],"names":["userFullNameSQL","users","mysqlTable","id","bigint","mode","unsigned","autoincrement","primaryKey","email","varchar","length","notNull","login","firstName","lastName","password","passwordAttempts","tinyint","default","role","isActive","boolean","language","char","permissions","storageUsage","storageQuota","notification","onlineStatus","currentIp","lastIp","currentAccess","datetime","lastAccess","createdAt","sql","table","uniqueIndex","on","index","user"],"mappings":"AAAA;;;;CAIC;;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../../../backend/src/applications/users/schemas/users.schema.ts"],"sourcesContent":["/*\n * Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>\n * This file is part of Sync-in | The open source file sync and share solution\n * See the LICENSE file for licensing details\n */\n\nimport { SQL, sql } from 'drizzle-orm'\nimport { bigint, boolean, char, datetime, index, mysqlTable, tinyint, uniqueIndex, varchar } from 'drizzle-orm/mysql-core'\nimport { jsonColumn } from '../../../infrastructure/database/columns'\nimport { UserSecrets } from '../interfaces/user-secrets.interface'\n\n/*\n role:\n 0: administrator\n 1: user\n 2: guest\n 3: link\n notification:\n 0: application\n 1: application + mail\n onlineStatus:\n 0: available\n 1: busy\n 2: absent\n 3: offline\n storageQuota:\n 0 : no storage\n null : unlimited\n other: limited to value\n*/\n\nexport const users = mysqlTable(\n 'users',\n {\n id: bigint('id', { mode: 'number', unsigned: true }).autoincrement().primaryKey(),\n email: varchar('email', { length: 255 }).notNull(),\n login: varchar('login', { length: 255 }).notNull(),\n firstName: varchar('firstName', { length: 255 }),\n lastName: varchar('lastName', { length: 255 }),\n password: varchar('password', { length: 255 }).notNull(),\n passwordAttempts: tinyint('passwordAttempts', { unsigned: true }).default(0).notNull(),\n role: tinyint('role', { unsigned: true }).default(1).notNull(),\n isActive: boolean('isActive').default(true).notNull(),\n secrets: jsonColumn<UserSecrets>()('secrets'),\n language: char('language', { length: 2 }),\n permissions: varchar('permissions', { length: 255 }).default('').notNull(),\n storageUsage: bigint('storageUsage', { mode: 'number', unsigned: true }).default(0),\n storageQuota: bigint('storageQuota', { mode: 'number', unsigned: true }),\n notification: tinyint('notification', { unsigned: true }).default(1).notNull(),\n onlineStatus: tinyint('onlineStatus', { unsigned: true }).default(0).notNull(),\n currentIp: varchar('currentIp', { length: 45 }),\n lastIp: varchar('lastIp', { length: 45 }),\n currentAccess: datetime('currentAccess', { mode: 'date' }),\n lastAccess: datetime('lastAccess', { mode: 'date' }),\n createdAt: datetime('createdAt', { mode: 'date' })\n .default(sql`CURRENT_TIMESTAMP`)\n .notNull()\n },\n (table) => [uniqueIndex('email_idx').on(table.email), uniqueIndex('login_idx').on(table.login), index('role_idx').on(table.role)]\n)\n\nexport const userFullNameSQL = (user: any): SQL<string> => sql`TRIM(CONCAT(${user.firstName}, ' ', ${user.lastName}))`\n"],"names":["userFullNameSQL","users","mysqlTable","id","bigint","mode","unsigned","autoincrement","primaryKey","email","varchar","length","notNull","login","firstName","lastName","password","passwordAttempts","tinyint","default","role","isActive","boolean","secrets","jsonColumn","language","char","permissions","storageUsage","storageQuota","notification","online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iBAAM,EAAC,gBAAgB;QAAEC,MAAM;QAAUC,UAAU;IAAK;IACtEwB,cAAcZ,IAAAA,kBAAO,EAAC,gBAAgB;QAAEZ,UAAU;IAAK,GAAGa,OAAO,CAAC,GAAGP,OAAO;IAC5EmB,cAAcb,IAAAA,kBAAO,EAAC,gBAAgB;QAAEZ,UAAU;IAAK,GAAGa,OAAO,CAAC,GAAGP,OAAO;IAC5EoB,WAAWtB,IAAAA,kBAAO,EAAC,aAAa;QAAEC,QAAQ;IAAG;IAC7CsB,QAAQvB,IAAAA,kBAAO,EAAC,UAAU;QAAEC,QAAQ;IAAG;IACvCuB,eAAeC,IAAAA,mBAAQ,EAAC,iBAAiB;QAAE9B,MAAM;IAAO;IACxD+B,YAAYD,IAAAA,mBAAQ,EAAC,cAAc;QAAE9B,MAAM;IAAO;IAClDgC,WAAWF,IAAAA,mBAAQ,EAAC,aAAa;QAAE9B,MAAM;IAAO,GAC7Cc,OAAO,CAACmB,IAAAA,eAAG,CAAA,CAAC,iBAAiB,CAAC,EAC9B1B,OAAO;AACZ,GACA,CAAC2B,QAAU;QAACC,IAAAA,sBAAW,EAAC,aAAaC,EAAE,CAACF,MAAM9B,KAAK;QAAG+B,IAAAA,sBAAW,EAAC,aAAaC,EAAE,CAACF,MAAM1B,KAAK;QAAG6B,IAAAA,gBAAK,EAAC,YAAYD,EAAE,CAACF,MAAMnB,IAAI;KAAE;AAG5H,MAAMpB,kBAAkB,CAAC2C,OAA2BL,IAAAA,eAAG,CAAA,CAAC,YAAY,EAAEK,KAAK7B,SAAS,CAAC,OAAO,EAAE6B,KAAK5B,QAAQ,CAAC,EAAE,CAAC"}
|
|
@@ -168,14 +168,14 @@ let AdminUsersManager = class AdminUsersManager {
|
|
|
168
168
|
throw new _common.HttpException('Unable to delete user', _common.HttpStatus.INTERNAL_SERVER_ERROR);
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
async
|
|
172
|
-
// check admin password
|
|
173
|
-
if (!await this.adminQueries.usersQueries.compareUserPassword(admin.id, adminDeleteUserDto.adminPassword)) {
|
|
174
|
-
throw new _common.HttpException('Bad password', _common.HttpStatus.BAD_REQUEST);
|
|
175
|
-
}
|
|
171
|
+
async deleteUserOrGuestFromAdmin(userId, deleteUserDto) {
|
|
176
172
|
const userToDelete = this.checkUser(await this.adminQueries.usersQueries.from(userId));
|
|
173
|
+
if (userToDelete.isGuest !== deleteUserDto.isGuest) {
|
|
174
|
+
throw new _common.HttpException('User mismatch', _common.HttpStatus.BAD_REQUEST);
|
|
175
|
+
}
|
|
177
176
|
await this.deleteUserOrGuest(userToDelete.id, userToDelete.login, {
|
|
178
|
-
deleteSpace:
|
|
177
|
+
deleteSpace: deleteUserDto.isGuest ? true : deleteUserDto.deleteSpace,
|
|
178
|
+
isGuest: deleteUserDto.isGuest
|
|
179
179
|
});
|
|
180
180
|
}
|
|
181
181
|
listGuests() {
|
|
@@ -196,14 +196,6 @@ let AdminUsersManager = class AdminUsersManager {
|
|
|
196
196
|
}
|
|
197
197
|
return this.updateUserOrGuest(guestId, updateGuestDto, _user.USER_ROLE.GUEST);
|
|
198
198
|
}
|
|
199
|
-
async deleteGuest(guestId) {
|
|
200
|
-
// guest has no space but a temporary directory
|
|
201
|
-
const guest = await this.getGuest(guestId);
|
|
202
|
-
return this.deleteUserOrGuest(guest.id, guest.login, {
|
|
203
|
-
deleteSpace: true,
|
|
204
|
-
isGuest: true
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
199
|
async browseGroups(name, type = _group.GROUP_TYPE.USER) {
|
|
208
200
|
if (name) {
|
|
209
201
|
const group = await this.adminQueries.groupFromName(name);
|
|
@@ -287,14 +279,10 @@ let AdminUsersManager = class AdminUsersManager {
|
|
|
287
279
|
searchMembers(searchMembersDto) {
|
|
288
280
|
return this.adminQueries.usersQueries.searchUsersOrGroups(searchMembersDto);
|
|
289
281
|
}
|
|
290
|
-
async impersonateUser(admin, userId,
|
|
291
|
-
// check admin password
|
|
282
|
+
async impersonateUser(admin, userId, res) {
|
|
292
283
|
if (admin.id === userId) {
|
|
293
284
|
throw new _common.HttpException('You are already logged in', _common.HttpStatus.BAD_REQUEST);
|
|
294
285
|
}
|
|
295
|
-
if (!await this.adminQueries.usersQueries.compareUserPassword(admin.id, adminPassword.password)) {
|
|
296
|
-
throw new _common.HttpException('Bad password', _common.HttpStatus.BAD_REQUEST);
|
|
297
|
-
}
|
|
298
286
|
const user = this.checkUser(await this.adminQueries.usersQueries.from(userId));
|
|
299
287
|
user.impersonatedFromId = admin.id;
|
|
300
288
|
user.impersonatedClientId = admin.clientId;
|