mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged 5.0.N (5.0.3) to HEAD (5.1/Cloud) (PARTIAL MERGE)
109176: MNT-3053 : User can see page with information about all events (they are entitled to see) on all sites, if they use an incorrect url. - UserCalendarEntriesGet.java now returns 404 status code of requested site doesn't exist. - Unit test added. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@109197 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -25,6 +25,8 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.alfresco.query.PagingRequest;
|
||||
import org.alfresco.query.PagingResults;
|
||||
import org.alfresco.repo.calendar.CalendarServiceImpl;
|
||||
@@ -63,6 +65,13 @@ public class UserCalendarEntriesGet extends AbstractCalendarListingWebScript
|
||||
if (siteName != null)
|
||||
{
|
||||
site = siteService.getSite(siteName);
|
||||
|
||||
// MNT-3053 fix, siteName was provided in request but it doesn't exists or user has no permissions to access it.
|
||||
if (site == null)
|
||||
{
|
||||
status.setCode(HttpServletResponse.SC_NOT_FOUND, "Site '" + siteName + "' does not exist or user has no permissions to access it.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return executeImpl(site, null, req, null, status, cache);
|
||||
|
@@ -39,6 +39,7 @@ import org.alfresco.service.cmr.security.PersonService;
|
||||
import org.alfresco.service.cmr.site.SiteInfo;
|
||||
import org.alfresco.service.cmr.site.SiteService;
|
||||
import org.alfresco.service.cmr.site.SiteVisibility;
|
||||
import org.alfresco.util.GUID;
|
||||
import org.alfresco.util.PropertyMap;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -1182,6 +1183,20 @@ public class CalendarRestApiTest extends BaseWebScriptTest
|
||||
events = result.getJSONArray("events");
|
||||
assertEquals(0, events.length());
|
||||
}
|
||||
|
||||
/**
|
||||
* Listing for a user
|
||||
*/
|
||||
public void testMNT_3053() throws Exception
|
||||
{
|
||||
String siteName = null;
|
||||
do
|
||||
{
|
||||
siteName = GUID.generate();
|
||||
}
|
||||
while (siteService.getSite(siteName) != null);
|
||||
sendRequest(new GetRequest("/calendar/events/" + siteName + "/user"), 404);
|
||||
}
|
||||
|
||||
/**
|
||||
* Repeating events support, across both the site
|
||||
|
Reference in New Issue
Block a user