ALF-9156 Calendar listing permissions check unit tests

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29025 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Nick Burch
2011-07-14 11:52:52 +00:00
parent d60b7631af
commit e22d74350d
2 changed files with 59 additions and 29 deletions

View File

@@ -120,6 +120,24 @@ public class CalendarServiceImpl implements CalendarService
*/
protected NodeRef getSiteCalendarContainer(final String siteShortName, boolean create)
{
// Does the site exist?
if(siteService.getSite(siteShortName) == null) {
// Either the site doesn't exist, or you're not allowed to see it
if(! create)
{
// Just say there's no container
return null;
}
else
{
// We can't create on a non-existant site
throw new AlfrescoRuntimeException(
"Unable to create the calendar container from a hidden or non-existant site"
);
}
}
// Check about the container
if(! siteService.hasContainer(siteShortName, CALENDAR_COMPONENT))
{
if(create)
@@ -405,12 +423,6 @@ public class CalendarServiceImpl implements CalendarService
List<NodeRef> containersL = new ArrayList<NodeRef>();
for(String siteShortName : siteShortNames)
{
// Ensure the site exists, skip if not
if(siteService.getSite(siteShortName) == null)
{
continue;
}
// Grab the container for this site
NodeRef container = getSiteCalendarContainer(siteShortName, false);
if(container != null)