Alfresco CMIS Query Issue: Retrieving All Users

41 Views Asked by At

I'm facing an issue with a JavaScript script containing a CMIS query aimed at retrieving the list of Alfresco users. Here's how the script is composed (I've included only the main part):


var output = "lastName;firstName;userName;authorizationStatus" + "\n";

var resultCount = 0;
var pageSize = 10000;
var currentPage = 0;
    
var queryDefinition = {
    query: 'SELECT * FROM cm:person',
    store: 'workspace://SpacesStore',
    language: 'cmis-strict',
    sort: [{ column: 'cm:userName', ascending: true }],
    page: { maxItems: pageSize, skipCount: 0 }
};

do {
    queryDefinition.page.skipCount = currentPage * pageSize;
    var queryResult = search.query(queryDefinition);
    var currentPageSize = queryResult.length || 0;
    if (currentPageSize > 0) {
        queryResult.forEach(function (user) {
            output += user.properties["cm:lastName"] + ";" + user.properties["cm:firstName"] + ";" + user.properties["cm:userName"] + ";" + user.properties["cm:authorizationStatus"] + "\n";
      });
    }
    currentPage++;
    // WRITING TO CSV
    // There seems to be an error here as the 'output' variable is reset on each iteration
    // output = "";
} while (currentPageSize != 0);

The issue I'm encountering is that this script only returns 1001 users, whereas I've found several others in the application that don't appear via this query.

What's surprising is that if I perform the same query in the browser but add a filter on the username (e.g., SELECT * FROM cm:person WHERE cm:userName like 'BELI%'), those users appear correctly.

How can I modify this to get all users through this query? I tried changing the value of pageSize, but the returned result remains strictly identical. I attempted using both 'cmis-strict' and 'cmis-alfresco' languages, yet in both cases, I'm getting the same outcome.

Additionally, is it possible to perform a search to retrieve all users with an authorization status of 'AUTHORIZED'? I tried the test SELECT * FROM cm:person WHERE cm:authorizationStatus = 'AUTHORIZED', but it didn't work.

Thanks in advance for your help!

0

There are 0 best solutions below