diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index 75ca8fe209..681451075d 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -915,6 +915,7 @@ error_import_all=Please correct the import errors below then click OK. error_export_all=Please correct the export errors below then click OK. error_save_search=Failed to save search due to error: {0} error_restore_search=Failed to restore saved search due to error: {0} +error_shortcut_permissions=Unable to navigate to the item as it cannot be read by this user. Another user may have modified the permission. # Confirmations return_to_application=Return to application diff --git a/source/java/org/alfresco/web/bean/UserShortcutsBean.java b/source/java/org/alfresco/web/bean/UserShortcutsBean.java index e3041e5d0c..a6097352dc 100644 --- a/source/java/org/alfresco/web/bean/UserShortcutsBean.java +++ b/source/java/org/alfresco/web/bean/UserShortcutsBean.java @@ -32,6 +32,8 @@ import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.repository.InvalidNodeRefException; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.cmr.security.PermissionService; import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; import org.alfresco.web.app.Application; @@ -57,6 +59,9 @@ public class UserShortcutsBean /** The BrowseBean reference */ protected BrowseBean browseBean; + /** The PermissionService reference */ + protected PermissionService permissionService; + /** List of shortcut nodes */ private List shortcuts = null; @@ -82,6 +87,14 @@ public class UserShortcutsBean this.browseBean = browseBean; } + /** + * @param permissionService The PermissionService to set. + */ + public void setPermissionService(PermissionService permissionService) + { + this.permissionService = permissionService; + } + /** * @return the List of shortcut Nodes */ @@ -327,19 +340,26 @@ public class UserShortcutsBean try { - DictionaryService dd = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getDictionaryService(); - if (dd.isSubClass(selectedNode.getType(), ContentModel.TYPE_FOLDER)) + if (permissionService.hasPermission(selectedNode.getNodeRef(), PermissionService.READ) == AccessStatus.ALLOWED) { - // then navigate to the appropriate node in UI - // use browse bean functionality for this as it will update the breadcrumb for us - this.browseBean.updateUILocation(selectedNode.getNodeRef()); + DictionaryService dd = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getDictionaryService(); + if (dd.isSubClass(selectedNode.getType(), ContentModel.TYPE_FOLDER)) + { + // then navigate to the appropriate node in UI + // use browse bean functionality for this as it will update the breadcrumb for us + this.browseBean.updateUILocation(selectedNode.getNodeRef()); + } + else if (dd.isSubClass(selectedNode.getType(), ContentModel.TYPE_CONTENT)) + { + // view details for document + this.browseBean.setupContentAction(selectedNode.getId(), true); + FacesContext fc = FacesContext.getCurrentInstance(); + fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "dialog:showDocDetails"); + } } - else if (dd.isSubClass(selectedNode.getType(), ContentModel.TYPE_CONTENT)) + else { - // view details for document - this.browseBean.setupContentAction(selectedNode.getId(), true); - FacesContext fc = FacesContext.getCurrentInstance(); - fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "dialog:showDocDetails"); + Utils.addErrorMessage(Application.getMessage(FacesContext.getCurrentInstance(), "error_shortcut_permissions")); } } catch (InvalidNodeRefException refErr) diff --git a/source/web/WEB-INF/faces-config-beans.xml b/source/web/WEB-INF/faces-config-beans.xml index e4f658ac3b..5e39f0db56 100644 --- a/source/web/WEB-INF/faces-config-beans.xml +++ b/source/web/WEB-INF/faces-config-beans.xml @@ -144,6 +144,10 @@ browseBean #{BrowseBean} + + permissionService + #{PermissionService} +