Uploaded image for project: 'Nuxeo Python Client'
  1. Nuxeo Python Client
  2. NXPY-132

Add enrichers argument to Documents.get_children()

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.2
    • Fix Version/s: 2.2.3
    • Component/s: Core

      Description

      Issue

      For NXDRIVE-1838 to be efficient, it would be very useful to be able to fetch permissions of documents when retrieving them.

      Currently, to get all children of a given parent folder, this code works well:

      docs = server.documents.get_children(path="/")
      

      But for NXDRIVE-1838, it is needed to know if the user has write access to all folderish documents. And so another call will be made for each folder:

      # Peuso-code
      can_write = server.documents.has_permission(doc.uid, "ReadWrite")
      

      This would explode any decent server.

      Proposition

      Add a new argument to Documents.API.get_children() to be able to fetch more than basic information:

      def get_children(self, uid=None, path=None, enrichers=None):
          # type: (Optional[Text], Optional[Text], Optional[List[str]]) -> List[Document]
          return super(API, self).get(
              path=self._path(uid=uid, path=path), enrichers=enrichers, adapter="children"
          )
      

      And the new call would be:

      docs = server.documents.get_children(path="/", enrichers=["permissions"])
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 15 minutes
                  15m