Skip to content
Snippets Groups Projects
  1. Mar 29, 2025
  2. Mar 28, 2025
  3. Mar 27, 2025
  4. Mar 26, 2025
    • Manuel Raynaud's avatar
      🔒️(back) restrict accesss to document accesses · a4452784
      Manuel Raynaud authored
      Every user having an access to a document, no matter its role have
      access to the entire accesses list with all the user details. Only
      owner or admin should be able to have the entire list, for the other
      roles, they have access to the list containing only owner and
      administrator with less information on the username. The email and its
      id is removed
      a4452784
  5. Mar 24, 2025
    • Quentin BEY's avatar
      ♻️(documents) inherit manager from queryset · 2929e982
      Quentin BEY authored
      During a code review, I saw we are overriding the MP_NodeManager and
      redefine the queryset filters:
      
      - The MP_NodeManager sorts the queryset by `path` by default and it's
        not done on our side, is it on purpose?
      - The fact we need to redefine `readable_per_se` as a boilerplate is
        surprising.
      
      I suggest we use the Django mechanism to generate the manager from the
      queryset.
      2929e982
    • Manuel Raynaud's avatar
      🐛(backend) compute ancestor_links in get_abilities if needed · a1914c62
      Manuel Raynaud authored
      The refactor made in the tree view caching the ancestors_links to not
      compute them again in the document.get_abilities method lead to a bug.
      If the get_abilities method is called without ancestors_links, then they
      are computed on all the ancestors but not from the highest readable
      ancestor for the current user. We have to compute them with this
      constraint.
      a1914c62
    • Samuel Paccoud - DINUM's avatar
      ♻️(backend) remove lazy from languages field on User model · c882f138
      Samuel Paccoud - DINUM authored
      The idea behind wrapping choices in `lazy` function was to allow
      overriding the list of languages in tests with `override_settings`.
      This was causin makemigrations to keep on including the field in
      migrations when it is not needed. Since we finally don't override
      the LANGUAGES setting in tests, we can remove it to fix the problem.
      c882f138
    • Samuel Paccoud - DINUM's avatar
      (backend) extract attachment keys from updated content for access · c02f19a2
      Samuel Paccoud - DINUM authored
      We can't prevent document editors from copy/pasting content to from one
      document to another. The problem is that copying content, will copy the
      urls pointing to attachments but if we don't do anything, the reader of
      the document to which the content is being pasted, may not be allowed to
      access the attachment files from the original document.
      
      Using the work from the previous commit, we can grant access to the readers
      of the target document by extracting the attachment keys from the content and
      adding themto the target document's "attachments" field. Before doing this,
      we check that the current user can indeed access the attachment files extracted
      from the content and that they are allowed to edit the current document.
      c02f19a2
    • Samuel Paccoud - DINUM's avatar
      (backend) add duplicate action to the document API endpoint · 34a208a8
      Samuel Paccoud - DINUM authored
      We took this opportunity to refactor the way access is controlled on
      media attachments. We now add the media key to a list on the document
      instance each time a media is uploaded to a document. This list is
      passed along when a document is duplicated, allowing us to grant
      access to readers on the new document, even if they don't have or
      lost access to the original document.
      
      We also propose an option to reproduce the same access rights on the
      duplicate document as what was in place on the original document.
      This can be requested by passing the "with_accesses=true" option in
      the query string.
      
      The tricky point is that we need to extract attachment keys from the
      existing documents and set them on the new "attachments" field that is
      now used to track access rights on media files.
      34a208a8
    • Samuel Paccoud - DINUM's avatar
      (backend) fix migration test using model factory · 6976bb7c
      Samuel Paccoud - DINUM authored
      Migration tests should not import and use factories or models
      directly from the code because they would not be in sync with
      the database in the state that each state needs to test it.
      
      Instead the migrator object passed as argument allows us to
      retrieve a minimal version of the models in sync with the state
      of the database that we are testing. What we get is a minimal
      model and we need to simulate all the methods that we could have
      on the real model and that are needed for testing.
      6976bb7c
    • Samuel Paccoud - DINUM's avatar
      (backend) add missing test on media-auth and collaboration-auth · 62139316
      Samuel Paccoud - DINUM authored
      These methods were involved in a bug that was fixed without first
      evidencing the error in a test:
      https://github.com/suitenumerique/docs/pull/556
      
      Fixes https://github.com/suitenumerique/docs/issues/567
      62139316
    • Samuel Paccoud - DINUM's avatar
      (backend) add missing tests for collaboration auth · 3e9b5309
      Samuel Paccoud - DINUM authored
      Tests were forgotten. While writing the tests, I fixed
      a few edge cases like the possibility to connect to the
      collaboration server for an anonymous user.
      3e9b5309
    • Samuel Paccoud - DINUM's avatar
      ♻️(backend) refactor media_auth and collaboration_auth for flexibility · 54f9b396
      Samuel Paccoud - DINUM authored
      These 2 actions had factorized code but a few iterations lead to
      spaghetti code where factorized code includes "if" clauses.
      
      Refactor abstractions so that code factorization really works.
      54f9b396
    • Samuel Paccoud - DINUM's avatar
      (backend) add util to extract text from Ydoc content · 710bbf51
      Samuel Paccoud - DINUM authored
      Documents content is stored in the Ydoc format. We need a util
      to extract it as xml/text.
      710bbf51
    • Jacques ROUSSEL's avatar
      🐛(ci) fix Tilt resources dependencies · 747ca701
      Jacques ROUSSEL authored
      The Tilt stack was not starting properly due to dependency issues. We
      need to wait for PostgreSQL to be running before starting the migration.
      747ca701
    • renovate[bot]'s avatar
  6. Mar 23, 2025
  7. Mar 22, 2025
  8. Mar 21, 2025
Loading