mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix for MOB-1558 - ThumbnailService no longer makes explicit permission checks based on DM permissions - RM users can now see content previews and document thumbnails correctly if they have ReadRecords access or similar.
ThumbnailServiceImplTest executed with no errors. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16440 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -40,7 +40,6 @@
|
|||||||
<bean id="thumbnailService" class="org.alfresco.repo.thumbnail.ThumbnailServiceImpl">
|
<bean id="thumbnailService" class="org.alfresco.repo.thumbnail.ThumbnailServiceImpl">
|
||||||
<property name="nodeService" ref="nodeService"/>
|
<property name="nodeService" ref="nodeService"/>
|
||||||
<property name="contentService" ref="contentService"/>
|
<property name="contentService" ref="contentService"/>
|
||||||
<property name="permissionService" ref="PermissionService"/>
|
|
||||||
<property name="mimetypeMap" ref="mimetypeService"/>
|
<property name="mimetypeMap" ref="mimetypeService"/>
|
||||||
<property name="behaviourFilter" ref="policyBehaviourFilter" />
|
<property name="behaviourFilter" ref="policyBehaviourFilter" />
|
||||||
<property name="thumbnailRegistry" ref="thumbnailRegistry" />
|
<property name="thumbnailRegistry" ref="thumbnailRegistry" />
|
||||||
|
@@ -35,7 +35,6 @@ import org.alfresco.model.ContentModel;
|
|||||||
import org.alfresco.repo.content.MimetypeMap;
|
import org.alfresco.repo.content.MimetypeMap;
|
||||||
import org.alfresco.repo.policy.BehaviourFilter;
|
import org.alfresco.repo.policy.BehaviourFilter;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
import org.alfresco.service.cmr.repository.ContentData;
|
import org.alfresco.service.cmr.repository.ContentData;
|
||||||
import org.alfresco.service.cmr.repository.ContentReader;
|
import org.alfresco.service.cmr.repository.ContentReader;
|
||||||
@@ -44,8 +43,6 @@ import org.alfresco.service.cmr.repository.ContentWriter;
|
|||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.cmr.repository.TransformationOptions;
|
import org.alfresco.service.cmr.repository.TransformationOptions;
|
||||||
import org.alfresco.service.cmr.security.AccessStatus;
|
|
||||||
import org.alfresco.service.cmr.security.PermissionService;
|
|
||||||
import org.alfresco.service.cmr.thumbnail.ThumbnailException;
|
import org.alfresco.service.cmr.thumbnail.ThumbnailException;
|
||||||
import org.alfresco.service.cmr.thumbnail.ThumbnailParentAssociationDetails;
|
import org.alfresco.service.cmr.thumbnail.ThumbnailParentAssociationDetails;
|
||||||
import org.alfresco.service.cmr.thumbnail.ThumbnailService;
|
import org.alfresco.service.cmr.thumbnail.ThumbnailService;
|
||||||
@@ -76,9 +73,6 @@ public class ThumbnailServiceImpl implements ThumbnailService
|
|||||||
/** Content service */
|
/** Content service */
|
||||||
private ContentService contentService;
|
private ContentService contentService;
|
||||||
|
|
||||||
/** Permission service */
|
|
||||||
private PermissionService permissionService;
|
|
||||||
|
|
||||||
/** Mimetype map */
|
/** Mimetype map */
|
||||||
private MimetypeMap mimetypeMap;
|
private MimetypeMap mimetypeMap;
|
||||||
|
|
||||||
@@ -108,14 +102,6 @@ public class ThumbnailServiceImpl implements ThumbnailService
|
|||||||
this.contentService = contentService;
|
this.contentService = contentService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param permissionService permission service
|
|
||||||
*/
|
|
||||||
public void setPermissionService(PermissionService permissionService)
|
|
||||||
{
|
|
||||||
this.permissionService = permissionService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the mimetype map
|
* Sets the mimetype map
|
||||||
*
|
*
|
||||||
@@ -177,11 +163,6 @@ public class ThumbnailServiceImpl implements ThumbnailService
|
|||||||
logger.debug("Creating thumbnail (node=" + node.toString() + "; contentProperty=" + contentProperty.toString() + "; mimetype=" + mimetype);
|
logger.debug("Creating thumbnail (node=" + node.toString() + "; contentProperty=" + contentProperty.toString() + "; mimetype=" + mimetype);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!permissionService.hasPermission(node, PermissionService.READ_PROPERTIES).equals(AccessStatus.ALLOWED))
|
|
||||||
{
|
|
||||||
throw new AccessDeniedException("Access Denied");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for duplicate names
|
// Check for duplicate names
|
||||||
if (thumbnailName != null && getThumbnailByName(node, contentProperty, thumbnailName) != null)
|
if (thumbnailName != null && getThumbnailByName(node, contentProperty, thumbnailName) != null)
|
||||||
{
|
{
|
||||||
@@ -314,11 +295,6 @@ public class ThumbnailServiceImpl implements ThumbnailService
|
|||||||
logger.debug("Updating thumbnail (thumbnail=" + thumbnail.toString() + ")");
|
logger.debug("Updating thumbnail (thumbnail=" + thumbnail.toString() + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!permissionService.hasPermission(thumbnail, PermissionService.READ_PROPERTIES).equals(AccessStatus.ALLOWED))
|
|
||||||
{
|
|
||||||
throw new AccessDeniedException("Access Denied");
|
|
||||||
}
|
|
||||||
|
|
||||||
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>()
|
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>()
|
||||||
{
|
{
|
||||||
public Object doWork() throws Exception
|
public Object doWork() throws Exception
|
||||||
@@ -404,11 +380,6 @@ public class ThumbnailServiceImpl implements ThumbnailService
|
|||||||
logger.debug("Getting thumbnail by name (nodeRef=" + node.toString() + "; contentProperty=" + contentProperty.toString() + "; thumbnailName=" + thumbnailName + ")");
|
logger.debug("Getting thumbnail by name (nodeRef=" + node.toString() + "; contentProperty=" + contentProperty.toString() + "; thumbnailName=" + thumbnailName + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (!permissionService.hasPermission(node, PermissionService.READ_PROPERTIES).equals(AccessStatus.ALLOWED))
|
|
||||||
//{
|
|
||||||
// throw new AccessDeniedException("Access Denied");
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Check that the node has the thumbnailed aspect applied
|
// Check that the node has the thumbnailed aspect applied
|
||||||
if (nodeService.hasAspect(node, ContentModel.ASPECT_THUMBNAILED) == true)
|
if (nodeService.hasAspect(node, ContentModel.ASPECT_THUMBNAILED) == true)
|
||||||
{
|
{
|
||||||
@@ -449,11 +420,6 @@ public class ThumbnailServiceImpl implements ThumbnailService
|
|||||||
logger.debug("Getting thumbnails (nodeRef=" + node.toString() + "; contentProperty=" + contentProperty.toString() + "; mimetype=" + mimetype + ")");
|
logger.debug("Getting thumbnails (nodeRef=" + node.toString() + "; contentProperty=" + contentProperty.toString() + "; mimetype=" + mimetype + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!permissionService.hasPermission(node, PermissionService.READ_PROPERTIES).equals(AccessStatus.ALLOWED))
|
|
||||||
{
|
|
||||||
throw new AccessDeniedException("Access Denied");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check that the node has the thumbnailed aspect applied
|
// Check that the node has the thumbnailed aspect applied
|
||||||
if (nodeService.hasAspect(node, ContentModel.ASPECT_THUMBNAILED) == true)
|
if (nodeService.hasAspect(node, ContentModel.ASPECT_THUMBNAILED) == true)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user