Uploaded image for project: 'Nuxeo Documentation'
  1. Nuxeo Documentation
  2. NXDOC-1211

doPrivilege should be run inside a transaction

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 8.10, Fast Track (FT)
    • Fix Version/s: 8.10, Fast Track (FT)
    • Component/s: None

      Description

      From 8.10, it is not possible to access a coresession outside a transaction. (see NXP-19361).

      https://doc.nuxeo.com/810/nxdoc/how-to-implement-local-groups-or-roles-using-computed-groups/

      The example should contain a call to TransactionHelp.runInTransaction:

      TransactionHelper.runInTransaction(() -> {
          CoreInstance.doPrivileged(repositoryName, session -> {
              try (IterableQueryResult results = session.queryAndFetch(query, "NXQL")) {
                  for (Map<String, Serializable> result : results) {
                      String groupId = (String) result.get("ecm:uuid");
                      groupIds.add(groupId);
                  }
              }
          });
      });
      

        Attachments

          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 - 20 minutes
                20m