. Fixes for AWC-538 and AWC-540

- Handling of removal of permissions on user shortcut objects while the user is still logged in to the system

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2427 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-02-17 12:17:33 +00:00
parent 9cfa618c76
commit f23a841505
3 changed files with 35 additions and 10 deletions

View File

@@ -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_export_all=Please correct the export errors below then click OK.
error_save_search=Failed to save search due to error: {0} error_save_search=Failed to save search due to error: {0}
error_restore_search=Failed to restore saved 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 # Confirmations
return_to_application=Return to application return_to_application=Return to application

View File

@@ -32,6 +32,8 @@ import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.repository.InvalidNodeRefException; import org.alfresco.service.cmr.repository.InvalidNodeRefException;
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.security.AccessStatus;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application; import org.alfresco.web.app.Application;
@@ -57,6 +59,9 @@ public class UserShortcutsBean
/** The BrowseBean reference */ /** The BrowseBean reference */
protected BrowseBean browseBean; protected BrowseBean browseBean;
/** The PermissionService reference */
protected PermissionService permissionService;
/** List of shortcut nodes */ /** List of shortcut nodes */
private List<Node> shortcuts = null; private List<Node> shortcuts = null;
@@ -82,6 +87,14 @@ public class UserShortcutsBean
this.browseBean = browseBean; this.browseBean = browseBean;
} }
/**
* @param permissionService The PermissionService to set.
*/
public void setPermissionService(PermissionService permissionService)
{
this.permissionService = permissionService;
}
/** /**
* @return the List of shortcut Nodes * @return the List of shortcut Nodes
*/ */
@@ -327,19 +340,26 @@ public class UserShortcutsBean
try try
{ {
DictionaryService dd = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getDictionaryService(); if (permissionService.hasPermission(selectedNode.getNodeRef(), PermissionService.READ) == AccessStatus.ALLOWED)
if (dd.isSubClass(selectedNode.getType(), ContentModel.TYPE_FOLDER))
{ {
// then navigate to the appropriate node in UI DictionaryService dd = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getDictionaryService();
// use browse bean functionality for this as it will update the breadcrumb for us if (dd.isSubClass(selectedNode.getType(), ContentModel.TYPE_FOLDER))
this.browseBean.updateUILocation(selectedNode.getNodeRef()); {
// 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 Utils.addErrorMessage(Application.getMessage(FacesContext.getCurrentInstance(), "error_shortcut_permissions"));
this.browseBean.setupContentAction(selectedNode.getId(), true);
FacesContext fc = FacesContext.getCurrentInstance();
fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "dialog:showDocDetails");
} }
} }
catch (InvalidNodeRefException refErr) catch (InvalidNodeRefException refErr)

View File

@@ -144,6 +144,10 @@
<property-name>browseBean</property-name> <property-name>browseBean</property-name>
<value>#{BrowseBean}</value> <value>#{BrowseBean}</value>
</managed-property> </managed-property>
<managed-property>
<property-name>permissionService</property-name>
<value>#{PermissionService}</value>
</managed-property>
</managed-bean> </managed-bean>
<managed-bean> <managed-bean>