Uploaded image for project: 'Integrated'
  1. Integrated
  2. INTEGRATED-631

Don't allow to delete content or search selections when referenced somewhere

    Details

    • Type: Story
    • Status: Closed
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: integrated-0.5
    • Component/s: None
    • Labels:
      None

      Description

      Currently content items or search selections can be deleted (of /admin/content and /admin/search-selection) when they are referenced somewhere else in the database. This should not be allowed, to keep the database consistent.

      Because we don't know which bundles are loaded or which custom documents have been made the fields that contain a reference to the current class must be determined automatically. This can be done with this code: https://gist.github.com/zarathustra323/9551530. After that all found fields need to be queried to see if the document that will be deleted is in use somewhere.

      When the document is still in use an error message needs to be shown: This item is still on use by <a href="">item name</a>
      The "by <a href..." part will only be shown if they object is instanceof Article, otherwise you don't know the title and where to link to.

      Note: please don't write this code in the controller, maybe a service or event listener.

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                marijn Marijn Otte
                Code reviewer:
                Jeroen van Leeuwen
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Draw.io Diagrams

                    OTM