diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/authority.lib.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/authority.lib.ftl index 446fa7e25c..f37979a6c3 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/authority.lib.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/authority.lib.ftl @@ -6,10 +6,6 @@ "shortName": "${authority.shortName}", "fullName": "${authority.fullName}", "displayName": "${authority.displayName}", - <#-- Group specific properties --> - <#if authority.rootGroup??>"isRootGroup": ${authority.rootGroup?string("true", "false")}, - <#if authority.adminGroup??>"isAdminGroup": ${authority.adminGroup?string("true", "false")}, - <#-- end of group specific properties --> <#if authority.authorityType = "GROUP"> "url": "/api/groups/${authority.shortName?url}" diff --git a/config/alfresco/templates/webscripts/org/alfresco/slingshot/profile/usercontents.get.js b/config/alfresco/templates/webscripts/org/alfresco/slingshot/profile/usercontents.get.js index 36d5d7341d..397a224214 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/slingshot/profile/usercontents.get.js +++ b/config/alfresco/templates/webscripts/org/alfresco/slingshot/profile/usercontents.get.js @@ -6,23 +6,38 @@ function getContents(user, type, maxResults) { return (number < 10) ? '0' + number : number; } + //set range to within last 28 days var date = new Date(); - var toQuery = date.getFullYear() + "\\-" + padZeros((date.getMonth()+1)) + "\\-" + padZeros(date.getDate()); + var toQuery = date.getFullYear() + "-" + padZeros((date.getMonth()+1)) + "-" + padZeros(date.getDate()); date.setDate(date.getDate() - 28); - var fromQuery = date.getFullYear() + "\\-" + padZeros((date.getMonth()+1)) + "\\-" + padZeros(date.getDate()); - - var userType = (type == 'created') ? 'creator' : 'modifier'; + var fromQuery = date.getFullYear() + "-" + padZeros((date.getMonth()+1)) + "-" + padZeros(date.getDate()); - var query = "+PATH:\"/app:company_home/st:sites/*//*\"" + - " +@cm\\:" + userType + ":\"" + user + "\"" + - " +@cm\\:" + type + ":[" + fromQuery + "T00\\:00\\:00 TO " + toQuery + "T23\\:59\\:59]" + - " +TYPE:\"cm:content\"" + - " -TYPE:\"dl:dataListItem\"" + - " -TYPE:\"cm:thumbnail\""; + var userProperty = (type == 'created') ? 'creator' : 'modifier'; + var query = 'PATH:"/*/st:sites/*/*//*" ' + + 'AND +@cm:' + userProperty + ':"' + user + '" ' + + 'AND +@cm:' + type + ':["' + fromQuery + '" TO "' + toQuery + '"] ' + + 'AND +TYPE:"cm:content" ' + + 'AND -TYPE:"ia:calendarEvent" ' + + 'AND -TYPE:"dl:dataListItem" '; - var nodes = search.luceneSearch(query, "@cm:" + type, false, maxResults); - //reset processed results (in search.lib.js) + // perform fts-alfresco language query + var sortColumns = []; + sortColumns.push( + { + column: "@" + utils.longQName("cm:" + type), + ascending: false + }); + var queryDef = { + query: query, + language: "fts-alfresco", + page: {maxItems: maxResults}, + onerror: "no-results", + sort: sortColumns + }; + var nodes = search.query(queryDef); + + // reset processed results (in search.lib.js) processedCache = {} return processResults(nodes, maxResults); } diff --git a/source/java/org/alfresco/repo/web/scripts/groups/GroupsTest.java b/source/java/org/alfresco/repo/web/scripts/groups/GroupsTest.java index 25ef02d82f..3275780a71 100644 --- a/source/java/org/alfresco/repo/web/scripts/groups/GroupsTest.java +++ b/source/java/org/alfresco/repo/web/scripts/groups/GroupsTest.java @@ -210,7 +210,6 @@ public class GroupsTest extends BaseWebScriptTest JSONArray data = top.getJSONArray("data"); assertTrue(data.length() >= 3); boolean gotRootGroup = false; - boolean gotAdminGroup = false; boolean gotEmailGroup = false; @@ -223,22 +222,14 @@ public class GroupsTest extends BaseWebScriptTest assertEquals("shortName wrong", TEST_ROOTGROUP, rootGroup.getString("shortName")); assertEquals("displayName wrong", TEST_ROOTGROUP_DISPLAY_NAME, rootGroup.getString("displayName")); assertEquals("authorityType wrong", "GROUP", rootGroup.getString("authorityType")); - assertFalse("test rootgroup is admin group", rootGroup.getBoolean("isAdminGroup")); gotRootGroup = true; } - if(rootGroup.getString("shortName").equals(ADMIN_GROUP)) - { - gotAdminGroup = true; - //assertTrue("admin group is not admin group", rootGroup.getBoolean("isAdminGroup")); - } if(rootGroup.getString("shortName").equals(EMAIL_GROUP)) { - //assertTrue("admin group is not admin group", rootGroup.getBoolean("isAdminGroup")); gotEmailGroup = true; } } assertTrue("root group not found", gotRootGroup); - assertTrue("admin group not found", gotAdminGroup); assertTrue("email group not found", gotEmailGroup); } @@ -272,11 +263,6 @@ public class GroupsTest extends BaseWebScriptTest assertEquals("shortName wrong", TEST_ROOTGROUP, rootGroup.getString("shortName")); assertEquals("displayName wrong", TEST_ROOTGROUP_DISPLAY_NAME, rootGroup.getString("displayName")); assertEquals("authorityType wrong", "GROUP", rootGroup.getString("authorityType")); - assertFalse("test rootgroup is admin group", rootGroup.getBoolean("isAdminGroup")); - } - if(rootGroup.getString("shortName").equals(ADMIN_GROUP)) - { - //assertTrue("admin group is not admin group", rootGroup.getBoolean("isAdminGroup")); } } } @@ -300,11 +286,6 @@ public class GroupsTest extends BaseWebScriptTest assertEquals("shortName wrong", TEST_ROOTGROUP, rootGroup.getString("shortName")); assertEquals("displayName wrong", TEST_ROOTGROUP_DISPLAY_NAME, rootGroup.getString("displayName")); assertEquals("authorityType wrong", "GROUP", rootGroup.getString("authorityType")); - assertFalse("test rootgroup is admin group", rootGroup.getBoolean("isAdminGroup")); - } - if(rootGroup.getString("shortName").equals(ADMIN_GROUP)) - { - //assertTrue("admin group is not admin group", rootGroup.getBoolean("isAdminGroup")); } } } @@ -336,8 +317,6 @@ public class GroupsTest extends BaseWebScriptTest logger.debug(response.getContentAsString()); JSONObject data = top.getJSONObject("data"); assertTrue(data.length() > 0); - //assertTrue("admin group is not admin group", data.getBoolean("isAdminGroup")); - assertTrue("admin group is not root group", data.getBoolean("isRootGroup")); } { @@ -353,8 +332,6 @@ public class GroupsTest extends BaseWebScriptTest logger.debug(response.getContentAsString()); JSONObject data = top.getJSONObject("data"); assertTrue(data.length() > 0); - assertFalse("group B is not admin group", data.getBoolean("isAdminGroup")); - assertFalse("group B is not root group", data.getBoolean("isRootGroup")); } /** @@ -366,8 +343,6 @@ public class GroupsTest extends BaseWebScriptTest logger.debug(response.getContentAsString()); JSONObject data = top.getJSONObject("data"); assertTrue(data.length() > 0); - assertFalse("group E is not admin group", data.getBoolean("isAdminGroup")); - assertFalse("group E is not root group", data.getBoolean("isRootGroup")); } } @@ -928,7 +903,7 @@ public class GroupsTest extends BaseWebScriptTest assertFalse("The first group should not be the same!!", firstGroup.equals(data.get(0).toString())); // Test maxItems and skipCount when maxItems is too big. - // Shoudl return last 2 items. + // Should return last 2 items. data = getDataArray(baseUrl + "?skipCount=1&maxItems=5"); assertEquals("The number of groups returned is wrong!", 2, data.length()); assertFalse("The first group should not be the same!!", firstGroup.equals(data.get(0).toString())); @@ -944,7 +919,7 @@ public class GroupsTest extends BaseWebScriptTest // Test maxItems works data = getDataArray(baseUrl +"&maxItems=2"); - assertEquals("There should only be 3 groups!", 2, data.length()); + assertEquals("There should only be 2 groups!", 2, data.length()); assertEquals("The first group should be the same!!", firstGroup, data.get(0).toString()); // Test skipCount works