Merged V2.2 to HEAD

7732: Support to cache null QName look ups ...
   7733: Support for store ACLs
   7741: Fix for over keen stiore ACLs ....
   7794: Fix for WCM-1019, tasks show all assets as modified when only one has
   7996: Fix for AWC-1519: cancelling discussion creation results in error


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8448 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2008-03-07 01:50:03 +00:00
parent 309a3da7f5
commit e6136a4c4e
5 changed files with 301 additions and 228 deletions

View File

@@ -61,11 +61,9 @@ import org.alfresco.util.ISO9075;
import org.alfresco.web.app.servlet.DownloadContentServlet; import org.alfresco.web.app.servlet.DownloadContentServlet;
import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.repository.Repository;
// TODO: DownloadServlet - use of request parameter for property name? // TODO: DownloadServlet - use of request parameter for property name?
// TODO: Anyway to switch content view url link / property value text? // TODO: Anyway to switch content view url link / property value text?
/** /**
* Backing bean to support the Admin Node Browser * Backing bean to support the Admin Node Browser
*/ */
@@ -88,20 +86,22 @@ public class AdminNodeBrowseBean implements Serializable
// query and results // query and results
private String query = null; private String query = null;
private SearchResults searchResults = new SearchResults((List<NodeRef>)null); private SearchResults searchResults = new SearchResults((List<NodeRef>) null);
// stores and node
transient private DataModel stores = null;
private NodeRef nodeRef = null; private NodeRef nodeRef = null;
private QName nodeType = null; private QName nodeType = null;
private Path primaryPath = null; private Path primaryPath = null;
private Boolean inheritPermissions = null;
// stores and node
transient private DataModel stores = null;
transient private DataModel parents = null; transient private DataModel parents = null;
transient private DataModel aspects = null; transient private DataModel aspects = null;
transient private DataModel properties = null; transient private DataModel properties = null;
transient private DataModel children = null; transient private DataModel children = null;
transient private DataModel assocs = null; transient private DataModel assocs = null;
private Boolean inheritPermissions = null;
transient private DataModel permissions = null; transient private DataModel permissions = null;
transient private DataModel permissionMasks = null;
transient private DataModel avmStoreProps = null; transient private DataModel avmStoreProps = null;
// supporting repository services // supporting repository services
@@ -262,6 +262,7 @@ public class AdminNodeBrowseBean implements Serializable
assocs = null; assocs = null;
inheritPermissions = null; inheritPermissions = null;
permissions = null; permissions = null;
permissionMasks = null;
} }
/** /**
@@ -301,7 +302,7 @@ public class AdminNodeBrowseBean implements Serializable
{ {
getPrimaryPath(); getPrimaryPath();
Path.Element element = primaryPath.last(); Path.Element element = primaryPath.last();
NodeRef parentRef = ((Path.ChildAssocElement)element).getRef().getParentRef(); NodeRef parentRef = ((Path.ChildAssocElement) element).getRef().getParentRef();
return parentRef; return parentRef;
} }
@@ -394,6 +395,30 @@ public class AdminNodeBrowseBean implements Serializable
return permissions; return permissions;
} }
/**
* Gets the current node permissions
*
* @return the permissions
*/
public DataModel getStorePermissionMasks()
{
if (permissionMasks == null)
{
if (nodeRef.getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_AVM))
{
List<AccessPermission> nodePermissions = new ArrayList<AccessPermission>(getPermissionService().getAllSetPermissions(nodeRef.getStoreRef()));
permissionMasks = new ListDataModel(nodePermissions);
}
else
{
List<NoStoreMask> noReadPermissions = new ArrayList<NoStoreMask>(1);
noReadPermissions.add(new NoStoreMask());
permissionMasks = new ListDataModel(noReadPermissions);
}
}
return permissionMasks;
}
/** /**
* Gets the current node children * Gets the current node children
* *
@@ -526,7 +551,7 @@ public class AdminNodeBrowseBean implements Serializable
*/ */
public String selectStore() public String selectStore()
{ {
StoreRef storeRef = (StoreRef)getStores().getRowData(); StoreRef storeRef = (StoreRef) getStores().getRowData();
NodeRef rootNode = getNodeService().getRootNode(storeRef); NodeRef rootNode = getNodeService().getRootNode(storeRef);
setNodeRef(rootNode); setNodeRef(rootNode);
@@ -576,7 +601,7 @@ public class AdminNodeBrowseBean implements Serializable
*/ */
public String selectParent() public String selectParent()
{ {
ChildAssociationRef assocRef = (ChildAssociationRef)getParents().getRowData(); ChildAssociationRef assocRef = (ChildAssociationRef) getParents().getRowData();
NodeRef parentRef = assocRef.getParentRef(); NodeRef parentRef = assocRef.getParentRef();
setNodeRef(parentRef); setNodeRef(parentRef);
return "success"; return "success";
@@ -589,7 +614,7 @@ public class AdminNodeBrowseBean implements Serializable
*/ */
public String selectToNode() public String selectToNode()
{ {
AssociationRef assocRef = (AssociationRef)getAssocs().getRowData(); AssociationRef assocRef = (AssociationRef) getAssocs().getRowData();
NodeRef targetRef = assocRef.getTargetRef(); NodeRef targetRef = assocRef.getTargetRef();
setNodeRef(targetRef); setNodeRef(targetRef);
return "success"; return "success";
@@ -602,9 +627,9 @@ public class AdminNodeBrowseBean implements Serializable
*/ */
public String selectNodeProperty() public String selectNodeProperty()
{ {
Property property = (Property)getProperties().getRowData(); Property property = (Property) getProperties().getRowData();
Property.Value value = (Property.Value)property.getValues().getRowData(); Property.Value value = (Property.Value) property.getValues().getRowData();
NodeRef nodeRef = (NodeRef)value.getValue(); NodeRef nodeRef = (NodeRef) value.getValue();
setNodeRef(nodeRef); setNodeRef(nodeRef);
return "success"; return "success";
} }
@@ -616,7 +641,7 @@ public class AdminNodeBrowseBean implements Serializable
*/ */
public String selectChild() public String selectChild()
{ {
ChildAssociationRef assocRef = (ChildAssociationRef)getChildren().getRowData(); ChildAssociationRef assocRef = (ChildAssociationRef) getChildren().getRowData();
NodeRef childRef = assocRef.getChildRef(); NodeRef childRef = assocRef.getChildRef();
setNodeRef(childRef); setNodeRef(childRef);
return "success"; return "success";
@@ -629,7 +654,7 @@ public class AdminNodeBrowseBean implements Serializable
*/ */
public String selectResultNode() public String selectResultNode()
{ {
ChildAssociationRef assocRef = (ChildAssociationRef)searchResults.getRows().getRowData(); ChildAssociationRef assocRef = (ChildAssociationRef) searchResults.getRows().getRowData();
NodeRef childRef = assocRef.getChildRef(); NodeRef childRef = assocRef.getChildRef();
setNodeRef(childRef); setNodeRef(childRef);
return "success"; return "success";
@@ -667,7 +692,7 @@ public class AdminNodeBrowseBean implements Serializable
searchResults = new SearchResults(getSearchService().query(getNodeRef().getStoreRef(), queryLanguage, query)); searchResults = new SearchResults(getSearchService().query(getNodeRef().getStoreRef(), queryLanguage, query));
return "search"; return "search";
} }
catch(Throwable e) catch (Throwable e)
{ {
FacesContext context = FacesContext.getCurrentInstance(); FacesContext context = FacesContext.getCurrentInstance();
FacesMessage message = new FacesMessage(); FacesMessage message = new FacesMessage();
@@ -684,9 +709,13 @@ public class AdminNodeBrowseBean implements Serializable
public class Property public class Property
{ {
private QName name; private QName name;
private boolean isCollection = false; private boolean isCollection = false;
private DataModel values; private DataModel values;
private String datatype; private String datatype;
private String residual; private String residual;
/** /**
@@ -716,7 +745,7 @@ public class AdminNodeBrowseBean implements Serializable
if (value instanceof Collection) if (value instanceof Collection)
{ {
isCollection = true; isCollection = true;
for (Serializable multiValue : (Collection<Serializable>)value) for (Serializable multiValue : (Collection<Serializable>) value)
{ {
values.add(new Value(multiValue)); values.add(new Value(multiValue));
} }
@@ -788,7 +817,6 @@ public class AdminNodeBrowseBean implements Serializable
return isCollection; return isCollection;
} }
/** /**
* Value wrapper * Value wrapper
*/ */
@@ -908,6 +936,26 @@ public class AdminNodeBrowseBean implements Serializable
} }
} }
public static class NoStoreMask implements Serializable
{
private static final long serialVersionUID = -6256369557521402921L;
public String getPermission()
{
return "All <No Mask>";
}
public String getAuthority()
{
return "All";
}
public String getAccessStatus()
{
return "Allowed";
}
}
/** /**
* Wrapper class for Search Results * Wrapper class for Search Results
*/ */
@@ -979,5 +1027,4 @@ public class AdminNodeBrowseBean implements Serializable
private static final long serialVersionUID = 4154583769762846020L; private static final long serialVersionUID = 4154583769762846020L;
} }
} }
} }

View File

@@ -180,16 +180,15 @@ public class CreateDiscussionDialog extends CreateTopicDialog
tx.begin(); tx.begin();
// remove the discussable aspect from the node we were going to discuss! // remove the discussable aspect from the node we were going to discuss!
// AWC-1519: removing the aspect that defines the child association now does the
// cascade delete so we no longer have to delete the child explicitly
this.getNodeService().removeAspect(this.discussingNodeRef, ForumModel.ASPECT_DISCUSSABLE); this.getNodeService().removeAspect(this.discussingNodeRef, ForumModel.ASPECT_DISCUSSABLE);
// delete the forum space created when the wizard started
Node forumNode = this.navigator.getCurrentNode();
this.getNodeService().deleteNode(forumNode.getNodeRef());
// commit the transaction // commit the transaction
tx.commit(); tx.commit();
// remove this node from the breadcrumb if required // remove this node from the breadcrumb if required
Node forumNode = this.navigator.getCurrentNode();
this.browseBean.removeSpaceFromBreadcrumb(forumNode); this.browseBean.removeSpaceFromBreadcrumb(forumNode);
// clear action context // clear action context

View File

@@ -131,11 +131,12 @@ public class AVMWorkflowUtil extends WorkflowUtil
avmService.setNodeProperty(packagesPath, WorkflowModel.PROP_IS_SYSTEM_PACKAGE, new PropertyValue(DataTypeDefinition.BOOLEAN, true)); avmService.setNodeProperty(packagesPath, WorkflowModel.PROP_IS_SYSTEM_PACKAGE, new PropertyValue(DataTypeDefinition.BOOLEAN, true));
// apply global permission to workflow package // NOTE: WCM-1019: As permissions are now implemented for AVM nodes we no longer need to set permisssions here
// TODO: Determine appropriate permissions // as they will be inherited from the store the workflow store is layered over.
final ServiceRegistry services = Repository.getServiceRegistry(FacesContext.getCurrentInstance());
final PermissionService permissionService = services.getPermissionService(); //final ServiceRegistry services = Repository.getServiceRegistry(FacesContext.getCurrentInstance());
permissionService.setPermission(packageNodeRef, PermissionService.ALL_AUTHORITIES, PermissionService.ALL_PERMISSIONS, true); //final PermissionService permissionService = services.getPermissionService();
//permissionService.setPermission(packageNodeRef, PermissionService.ALL_AUTHORITIES, PermissionService.ALL_PERMISSIONS, true);
return packageNodeRef; return packageNodeRef;
} }

View File

@@ -199,8 +199,11 @@ public final class SandboxFactory
// apply READ permissions for all users // apply READ permissions for all users
NodeRef dirRef = AVMNodeConverter.ToNodeRef(-1, AVMUtil.buildStoreRootPath(storeName)); NodeRef dirRef = AVMNodeConverter.ToNodeRef(-1, AVMUtil.buildStoreRootPath(storeName));
permissionService.setPermission(dirRef, PermissionService.ALL_AUTHORITIES, PermissionService.READ, true); permissionService.setPermission(dirRef, PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
// Set store permission mask
permissionService.setPermission(dirRef.getStoreRef(), PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
// Apply sepcific user permissions as set on the web project // Apply sepcific user permissions as set on the web project
// All these will be masked out
List<ChildAssociationRef> userInfoRefs = nodeService.getChildAssocs( List<ChildAssociationRef> userInfoRefs = nodeService.getChildAssocs(
webProjectNodeRef, WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL); webProjectNodeRef, WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef ref : userInfoRefs) for (ChildAssociationRef ref : userInfoRefs)
@@ -218,6 +221,7 @@ public final class SandboxFactory
public static void updateStagingAreaManagers(String storeId, public static void updateStagingAreaManagers(String storeId,
NodeRef webProjectNodeRef, final List<String> managers) NodeRef webProjectNodeRef, final List<String> managers)
{ {
// The stores have the mask set in updateSandboxManagers
String storeName = AVMUtil.buildStagingStoreName(storeId); String storeName = AVMUtil.buildStagingStoreName(storeId);
ServiceRegistry services = Repository.getServiceRegistry(FacesContext.getCurrentInstance()); ServiceRegistry services = Repository.getServiceRegistry(FacesContext.getCurrentInstance());
PermissionService permissionService = services.getPermissionService(); PermissionService permissionService = services.getPermissionService();
@@ -282,16 +286,16 @@ public final class SandboxFactory
JNDIConstants.DIR_DEFAULT_WWW); JNDIConstants.DIR_DEFAULT_WWW);
NodeRef dirRef = AVMNodeConverter.ToNodeRef(-1, AVMUtil.buildStoreRootPath(userStoreName)); NodeRef dirRef = AVMNodeConverter.ToNodeRef(-1, AVMUtil.buildStoreRootPath(userStoreName));
// TODO: Apply access mask to the store and ACls to the staging area // Apply access mask to the store (ACls are applie to the staging area)
// apply the user role permissions to the sandbox // apply the user role permissions to the sandbox
//permissionService.setPermission(dirRef, username, role, true); permissionService.setPermission(dirRef.getStoreRef(), username, PermissionService.ALL_PERMISSIONS, true);
//permissionService.setPermission(dirRef, PermissionService.ALL_AUTHORITIES, PermissionService.READ, true); permissionService.setPermission(dirRef.getStoreRef(), PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
// apply the manager role permission for each manager in the web project // apply the manager role permission for each manager in the web project
//for (String manager : managers) for (String manager : managers)
//{ {
// permissionService.setPermission(dirRef, manager, AVMUtil.ROLE_CONTENT_MANAGER, true); permissionService.setPermission(dirRef.getStoreRef(), manager, AVMUtil.ROLE_CONTENT_MANAGER, true);
//} }
// tag the store with the store type // tag the store with the store type
avmService.setStoreProperty(userStoreName, avmService.setStoreProperty(userStoreName,
@@ -330,15 +334,16 @@ public final class SandboxFactory
JNDIConstants.DIR_DEFAULT_WWW); JNDIConstants.DIR_DEFAULT_WWW);
dirRef = AVMNodeConverter.ToNodeRef(-1, AVMUtil.buildStoreRootPath(previewStoreName)); dirRef = AVMNodeConverter.ToNodeRef(-1, AVMUtil.buildStoreRootPath(previewStoreName));
// TODO: Apply access mask to the store // Apply access mask to the store (ACls are applied to the staging area)
// apply the user role permissions to the sandbox // apply the user role permissions to the sandbox
//permissionService.setPermission(dirRef, username, role, true); permissionService.setPermission(dirRef.getStoreRef(), username, PermissionService.ALL_PERMISSIONS, true);
//permissionService.setPermission(dirRef, PermissionService.ALL_AUTHORITIES, PermissionService.READ, true); permissionService.setPermission(dirRef.getStoreRef(), PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
// apply the manager role permission for each manager in the web project // apply the manager role permission for each manager in the web project
//for (String manager : managers) for (String manager : managers)
//{ {
// permissionService.setPermission(dirRef, manager, AVMUtil.ROLE_CONTENT_MANAGER, true); permissionService.setPermission(dirRef.getStoreRef(), manager, AVMUtil.ROLE_CONTENT_MANAGER, true);
//} }
// tag the store with the store type // tag the store with the store type
avmService.setStoreProperty(previewStoreName, avmService.setStoreProperty(previewStoreName,
@@ -513,21 +518,21 @@ public final class SandboxFactory
final String userStoreName = AVMUtil.buildUserMainStoreName(storeId, username); final String userStoreName = AVMUtil.buildUserMainStoreName(storeId, username);
final String previewStoreName = AVMUtil.buildUserPreviewStoreName(storeId, username); final String previewStoreName = AVMUtil.buildUserPreviewStoreName(storeId, username);
// TODO: Fix to apply application mask to the stores and ACLs to the staging area // Apply masks to the stores
// apply the manager role permission to the user main sandbox for each manager // apply the manager role permission to the user main sandbox for each manager
//NodeRef dirRef = AVMNodeConverter.ToNodeRef(-1, AVMUtil.buildStoreRootPath(userStoreName)); NodeRef dirRef = AVMNodeConverter.ToNodeRef(-1, AVMUtil.buildStoreRootPath(userStoreName));
//for (String manager : managers) for (String manager : managers)
//{ {
// permissionService.setPermission(dirRef, manager, AVMUtil.ROLE_CONTENT_MANAGER, true); permissionService.setPermission(dirRef.getStoreRef(), manager, AVMUtil.ROLE_CONTENT_MANAGER, true);
//} }
// apply the manager role permission to the user preview sandbox for each manager // apply the manager role permission to the user preview sandbox for each manager
//dirRef = AVMNodeConverter.ToNodeRef(-1, AVMUtil.buildStoreRootPath(previewStoreName)); dirRef = AVMNodeConverter.ToNodeRef(-1, AVMUtil.buildStoreRootPath(previewStoreName));
//for (String manager : managers) for (String manager : managers)
//{ {
// permissionService.setPermission(dirRef, manager, AVMUtil.ROLE_CONTENT_MANAGER, true); permissionService.setPermission(dirRef.getStoreRef(), manager, AVMUtil.ROLE_CONTENT_MANAGER, true);
// } }
} }
/** /**

View File

@@ -193,6 +193,27 @@
</h:column> </h:column>
</h:dataTable> </h:dataTable>
<h:dataTable id="storePermissionMasks" border="1" value="#{AdminNodeBrowseBean.storePermissionMasks}" var="permission" styleClass="nodeBrowserTable">
<h:column>
<f:facet name="header">
<h:outputText value="Store Permission"/>
</f:facet>
<h:outputText value="#{permission.permission}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="To Authority"/>
</f:facet>
<h:outputText value="#{permission.authority}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Access"/>
</f:facet>
<h:outputText value="#{permission.accessStatus}"/>
</h:column>
</h:dataTable>
<br/> <br/>
<h:outputText styleClass="mainTitle" value="Children"/> <h:outputText styleClass="mainTitle" value="Children"/>