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

@@ -23,7 +23,7 @@
* http://www.alfresco.com/legal/licensing" * http://www.alfresco.com/legal/licensing"
*/ */
package org.alfresco.web.bean.admin; package org.alfresco.web.bean.admin;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@@ -61,16 +61,14 @@ 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
*/ */
public class AdminNodeBrowseBean implements Serializable public class AdminNodeBrowseBean implements Serializable
{ {
private static final long serialVersionUID = -8702324672426537379L; private static final long serialVersionUID = -8702324672426537379L;
/** selected query language */ /** selected query language */
@@ -88,22 +86,24 @@ 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
transient private NodeService nodeService; transient private NodeService nodeService;
transient private DictionaryService dictionaryService; transient private DictionaryService dictionaryService;
@@ -111,92 +111,92 @@ public class AdminNodeBrowseBean implements Serializable
transient private NamespaceService namespaceService; transient private NamespaceService namespaceService;
transient private PermissionService permissionService; transient private PermissionService permissionService;
transient private AVMService avmService; transient private AVMService avmService;
/** /**
* @param nodeService node service * @param nodeService node service
*/ */
public void setNodeService(NodeService nodeService) public void setNodeService(NodeService nodeService)
{ {
this.nodeService = nodeService; this.nodeService = nodeService;
} }
private NodeService getNodeService() private NodeService getNodeService()
{ {
if (nodeService == null) if (nodeService == null)
{ {
nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService(); nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService();
} }
return nodeService; return nodeService;
} }
/** /**
* @param searchService search service * @param searchService search service
*/ */
public void setSearchService(SearchService searchService) public void setSearchService(SearchService searchService)
{ {
this.searchService = searchService; this.searchService = searchService;
}
private SearchService getSearchService()
{
if (searchService == null)
{
searchService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getSearchService();
}
return searchService;
} }
private SearchService getSearchService()
{
if (searchService == null)
{
searchService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getSearchService();
}
return searchService;
}
/** /**
* @param dictionaryService dictionary service * @param dictionaryService dictionary service
*/ */
public void setDictionaryService(DictionaryService dictionaryService) public void setDictionaryService(DictionaryService dictionaryService)
{ {
this.dictionaryService = dictionaryService; this.dictionaryService = dictionaryService;
}
private DictionaryService getDictionaryService()
{
if (dictionaryService == null)
{
dictionaryService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getDictionaryService();
}
return dictionaryService;
} }
private DictionaryService getDictionaryService()
{
if (dictionaryService == null)
{
dictionaryService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getDictionaryService();
}
return dictionaryService;
}
/** /**
* @param namespaceService namespace service * @param namespaceService namespace service
*/ */
public void setNamespaceService(NamespaceService namespaceService) public void setNamespaceService(NamespaceService namespaceService)
{ {
this.namespaceService = namespaceService; this.namespaceService = namespaceService;
} }
private NamespaceService getNamespaceService() private NamespaceService getNamespaceService()
{ {
if (namespaceService == null) if (namespaceService == null)
{ {
namespaceService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNamespaceService(); namespaceService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNamespaceService();
} }
return namespaceService; return namespaceService;
} }
/** /**
* @param permissionService permission service * @param permissionService permission service
*/ */
public void setPermissionService(PermissionService permissionService) public void setPermissionService(PermissionService permissionService)
{ {
this.permissionService = permissionService; this.permissionService = permissionService;
}
private PermissionService getPermissionService()
{
if (permissionService == null)
{
permissionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService();
}
return permissionService;
} }
private PermissionService getPermissionService()
{
if (permissionService == null)
{
permissionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService();
}
return permissionService;
}
/** /**
* @param avmService AVM service * @param avmService AVM service
*/ */
@@ -204,7 +204,7 @@ public class AdminNodeBrowseBean implements Serializable
{ {
this.avmService = avmService; this.avmService = avmService;
} }
private AVMService getAVMService() private AVMService getAVMService()
{ {
if (avmService == null) if (avmService == null)
@@ -217,7 +217,7 @@ public class AdminNodeBrowseBean implements Serializable
/** /**
* Gets the list of repository stores * Gets the list of repository stores
* *
* @return stores * @return stores
*/ */
public DataModel getStores() public DataModel getStores()
{ {
@@ -228,11 +228,11 @@ public class AdminNodeBrowseBean implements Serializable
} }
return stores; return stores;
} }
/** /**
* Gets the selected node reference * Gets the selected node reference
* *
* @return node reference (defaults to system store root) * @return node reference (defaults to system store root)
*/ */
public NodeRef getNodeRef() public NodeRef getNodeRef()
{ {
@@ -246,7 +246,7 @@ public class AdminNodeBrowseBean implements Serializable
/** /**
* Sets the selected node reference * Sets the selected node reference
* *
* @param nodeRef node reference * @param nodeRef node reference
*/ */
private void setNodeRef(NodeRef nodeRef) private void setNodeRef(NodeRef nodeRef)
{ {
@@ -257,17 +257,18 @@ public class AdminNodeBrowseBean implements Serializable
nodeType = null; nodeType = null;
parents = null; parents = null;
aspects = null; aspects = null;
properties = null; properties = null;
children = null; children = null;
assocs = null; assocs = null;
inheritPermissions = null; inheritPermissions = null;
permissions = null; permissions = null;
permissionMasks = null;
} }
/** /**
* Gets the current node type * Gets the current node type
* *
* @return node type * @return node type
*/ */
public QName getNodeType() public QName getNodeType()
{ {
@@ -277,11 +278,11 @@ public class AdminNodeBrowseBean implements Serializable
} }
return nodeType; return nodeType;
} }
/** /**
* Gets the current node primary path * Gets the current node primary path
* *
* @return primary path * @return primary path
*/ */
public String getPrimaryPath() public String getPrimaryPath()
{ {
@@ -295,20 +296,20 @@ public class AdminNodeBrowseBean implements Serializable
/** /**
* Gets the current node primary parent reference * Gets the current node primary parent reference
* *
* @return primary parent ref * @return primary parent ref
*/ */
public NodeRef getPrimaryParent() public NodeRef getPrimaryParent()
{ {
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;
} }
/** /**
* Gets the current node aspects * Gets the current node aspects
* *
* @return node aspects * @return node aspects
*/ */
public DataModel getAspects() public DataModel getAspects()
{ {
@@ -319,11 +320,11 @@ public class AdminNodeBrowseBean implements Serializable
} }
return aspects; return aspects;
} }
/** /**
* Gets the current node parents * Gets the current node parents
* *
* @return node parents * @return node parents
*/ */
public DataModel getParents() public DataModel getParents()
{ {
@@ -332,13 +333,13 @@ public class AdminNodeBrowseBean implements Serializable
List<ChildAssociationRef> parentRefs = getNodeService().getParentAssocs(getNodeRef()); List<ChildAssociationRef> parentRefs = getNodeService().getParentAssocs(getNodeRef());
parents = new ListDataModel(parentRefs); parents = new ListDataModel(parentRefs);
} }
return parents; return parents;
} }
/** /**
* Gets the current node properties * Gets the current node properties
* *
* @return properties * @return properties
*/ */
public DataModel getProperties() public DataModel getProperties()
{ {
@@ -358,7 +359,7 @@ public class AdminNodeBrowseBean implements Serializable
/** /**
* Gets whether the current node inherits its permissions from a parent node * Gets whether the current node inherits its permissions from a parent node
* *
* @return true => inherits permissions * @return true => inherits permissions
*/ */
public boolean getInheritPermissions() public boolean getInheritPermissions()
{ {
@@ -368,11 +369,11 @@ public class AdminNodeBrowseBean implements Serializable
} }
return inheritPermissions.booleanValue(); return inheritPermissions.booleanValue();
} }
/** /**
* Gets the current node permissions * Gets the current node permissions
* *
* @return the permissions * @return the permissions
*/ */
public DataModel getPermissions() public DataModel getPermissions()
{ {
@@ -393,11 +394,35 @@ 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
* *
* @return node children * @return node children
*/ */
public DataModel getChildren() public DataModel getChildren()
{ {
@@ -412,7 +437,7 @@ public class AdminNodeBrowseBean implements Serializable
/** /**
* Gets the current node associations * Gets the current node associations
* *
* @return associations * @return associations
*/ */
public DataModel getAssocs() public DataModel getAssocs()
{ {
@@ -423,12 +448,12 @@ public class AdminNodeBrowseBean implements Serializable
} }
return assocs; return assocs;
} }
public boolean getInAVMStore() public boolean getInAVMStore()
{ {
return nodeRef.getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_AVM); return nodeRef.getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_AVM);
} }
public DataModel getAVMStoreProperties() public DataModel getAVMStoreProperties()
{ {
if (avmStoreProps == null) if (avmStoreProps == null)
@@ -437,32 +462,32 @@ public class AdminNodeBrowseBean implements Serializable
String store = nodeRef.getStoreRef().getIdentifier(); String store = nodeRef.getStoreRef().getIdentifier();
Map<QName, PropertyValue> props = getAVMService().getStoreProperties(store); Map<QName, PropertyValue> props = getAVMService().getStoreProperties(store);
List<Map<String, String>> storeProperties = new ArrayList<Map<String, String>>(); List<Map<String, String>> storeProperties = new ArrayList<Map<String, String>>();
for (Map.Entry<QName, PropertyValue> property : props.entrySet()) for (Map.Entry<QName, PropertyValue> property : props.entrySet())
{ {
Map<String, String> map = new HashMap<String, String>(2); Map<String, String> map = new HashMap<String, String>(2);
map.put("name", property.getKey().toString()); map.put("name", property.getKey().toString());
map.put("type", property.getValue().getActualTypeString()); map.put("type", property.getValue().getActualTypeString());
String val = property.getValue().getStringValue(); String val = property.getValue().getStringValue();
if (val == null) if (val == null)
{ {
val = "null"; val = "null";
} }
map.put("value", val); map.put("value", val);
storeProperties.add(map); storeProperties.add(map);
} }
avmStoreProps = new ListDataModel(storeProperties); avmStoreProps = new ListDataModel(storeProperties);
} }
return avmStoreProps; return avmStoreProps;
} }
/** /**
* Gets the current query language * Gets the current query language
* *
* @return query language * @return query language
*/ */
public String getQueryLanguage() public String getQueryLanguage()
{ {
@@ -472,37 +497,37 @@ public class AdminNodeBrowseBean implements Serializable
/** /**
* Sets the current query language * Sets the current query language
* *
* @param queryLanguage query language * @param queryLanguage query language
*/ */
public void setQueryLanguage(String queryLanguage) public void setQueryLanguage(String queryLanguage)
{ {
this.queryLanguage = queryLanguage; this.queryLanguage = queryLanguage;
} }
/** /**
* Gets the current query * Gets the current query
* *
* @return query statement * @return query statement
*/ */
public String getQuery() public String getQuery()
{ {
return query; return query;
} }
/** /**
* Set the current query * Set the current query
* *
* @param query query statement * @param query query statement
*/ */
public void setQuery(String query) public void setQuery(String query)
{ {
this.query = query; this.query = query;
} }
/** /**
* Gets the list of available query languages * Gets the list of available query languages
* *
* @return query languages * @return query languages
*/ */
public List getQueryLanguages() public List getQueryLanguages()
{ {
@@ -512,33 +537,33 @@ public class AdminNodeBrowseBean implements Serializable
/** /**
* Gets the current search results * Gets the current search results
* *
* @return search results * @return search results
*/ */
public SearchResults getSearchResults() public SearchResults getSearchResults()
{ {
return searchResults; return searchResults;
} }
/** /**
* Action to select a store * Action to select a store
* *
* @return next action * @return next action
*/ */
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);
this.avmStoreProps = null; this.avmStoreProps = null;
return "success"; return "success";
} }
/** /**
* Action to select stores list * Action to select stores list
* *
* @return next action * @return next action
*/ */
public String selectStores() public String selectStores()
{ {
@@ -549,7 +574,7 @@ public class AdminNodeBrowseBean implements Serializable
/** /**
* Action to select primary path * Action to select primary path
* *
* @return next action * @return next action
*/ */
public String selectPrimaryPath() public String selectPrimaryPath()
{ {
@@ -557,26 +582,26 @@ public class AdminNodeBrowseBean implements Serializable
setNodeRef(nodeRef); setNodeRef(nodeRef);
return "success"; return "success";
} }
/** /**
* Action to select primary parent * Action to select primary parent
* *
* @return next action * @return next action
*/ */
public String selectPrimaryParent() public String selectPrimaryParent()
{ {
setNodeRef(getPrimaryParent()); setNodeRef(getPrimaryParent());
return "success"; return "success";
} }
/** /**
* Action to select parent * Action to select parent
* *
* @return next action * @return next action
*/ */
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";
@@ -585,11 +610,11 @@ public class AdminNodeBrowseBean implements Serializable
/** /**
* Action to select association To node * Action to select association To node
* *
* @return next action * @return next action
*/ */
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";
@@ -598,38 +623,38 @@ public class AdminNodeBrowseBean implements Serializable
/** /**
* Action to select node property * Action to select node property
* *
* @return next action * @return next action
*/ */
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";
} }
/** /**
* Action to select child * Action to select child
* *
* @return next action * @return next action
*/ */
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";
} }
/** /**
* Action to select search result node * Action to select search result node
* *
* @return next action * @return next action
*/ */
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";
@@ -638,7 +663,7 @@ public class AdminNodeBrowseBean implements Serializable
/** /**
* Action to submit search * Action to submit search
* *
* @return next action * @return next action
*/ */
public String submitSearch() public String submitSearch()
{ {
@@ -662,12 +687,12 @@ public class AdminNodeBrowseBean implements Serializable
searchResults = new SearchResults(nodes); searchResults = new SearchResults(nodes);
return "search"; return "search";
} }
// perform search // perform search
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();
@@ -677,28 +702,32 @@ public class AdminNodeBrowseBean implements Serializable
return "error"; return "error";
} }
} }
/** /**
* Property wrapper class * Property wrapper class
*/ */
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;
/** /**
* Construct * Construct
* *
* @param name property name * @param name property name
* @param value property values * @param value property values
*/ */
public Property(QName name, Serializable value) public Property(QName name, Serializable value)
{ {
this.name = name; this.name = name;
PropertyDefinition propDef = getDictionaryService().getProperty(name); PropertyDefinition propDef = getDictionaryService().getProperty(name);
if (propDef != null) if (propDef != null)
{ {
@@ -709,14 +738,14 @@ public class AdminNodeBrowseBean implements Serializable
{ {
residual = "true"; residual = "true";
} }
// handle multi/single values // handle multi/single values
// TODO: perhaps this is not the most efficient way - lots of list creations // TODO: perhaps this is not the most efficient way - lots of list creations
List<Value> values = new ArrayList<Value>(); List<Value> values = new ArrayList<Value>();
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));
} }
@@ -727,31 +756,31 @@ public class AdminNodeBrowseBean implements Serializable
} }
this.values = new ListDataModel(values); this.values = new ListDataModel(values);
} }
/** /**
* Gets the property name * Gets the property name
* *
* @return name * @return name
*/ */
public QName getName() public QName getName()
{ {
return name; return name;
} }
/** /**
* Gets the property data type * Gets the property data type
* *
* @return data type * @return data type
*/ */
public String getDataType() public String getDataType()
{ {
return datatype; return datatype;
} }
/** /**
* Gets the property value * Gets the property value
* *
* @return value * @return value
*/ */
public DataModel getValues() public DataModel getValues()
{ {
@@ -761,34 +790,33 @@ public class AdminNodeBrowseBean implements Serializable
/** /**
* Determines whether the property is residual * Determines whether the property is residual
* *
* @return true => property is not defined in dictionary * @return true => property is not defined in dictionary
*/ */
public String getResidual() public String getResidual()
{ {
return residual; return residual;
} }
/** /**
* Determines whether the property is of ANY type * Determines whether the property is of ANY type
* *
* @return true => is any * @return true => is any
*/ */
public boolean isAny() public boolean isAny()
{ {
return (datatype == null) ? false : datatype.equals(DataTypeDefinition.ANY.toString()); return (datatype == null) ? false : datatype.equals(DataTypeDefinition.ANY.toString());
} }
/** /**
* Determines whether the property is a collection * Determines whether the property is a collection
* *
* @return true => is collection * @return true => is collection
*/ */
public boolean isCollection() public boolean isCollection()
{ {
return isCollection; return isCollection;
} }
/** /**
* Value wrapper * Value wrapper
*/ */
@@ -799,27 +827,27 @@ public class AdminNodeBrowseBean implements Serializable
/** /**
* Construct * Construct
* *
* @param value value * @param value value
*/ */
public Value(Serializable value) public Value(Serializable value)
{ {
this.value = value; this.value = value;
} }
/** /**
* Gets the value * Gets the value
* *
* @return the value * @return the value
*/ */
public Serializable getValue() public Serializable getValue()
{ {
return value; return value;
} }
/** /**
* Gets the value datatype * Gets the value datatype
* *
* @return the value datatype * @return the value datatype
*/ */
public String getDataType() public String getDataType()
{ {
@@ -837,11 +865,11 @@ public class AdminNodeBrowseBean implements Serializable
} }
return datatype; return datatype;
} }
/** /**
* Gets the download url (for content properties) * Gets the download url (for content properties)
* *
* @return url * @return url
*/ */
public String getUrl() public String getUrl()
{ {
@@ -850,33 +878,33 @@ public class AdminNodeBrowseBean implements Serializable
url += "?property=" + name; url += "?property=" + name;
return url; return url;
} }
/** /**
* Determines whether the value is content * Determines whether the value is content
* *
* @return true => is content * @return true => is content
*/ */
public boolean isContent() public boolean isContent()
{ {
String datatype = getDataType(); String datatype = getDataType();
return (datatype == null) ? false : datatype.equals(DataTypeDefinition.CONTENT.toString()); return (datatype == null) ? false : datatype.equals(DataTypeDefinition.CONTENT.toString());
} }
/** /**
* Determines whether the value is a node ref * Determines whether the value is a node ref
* *
* @return true => is node ref * @return true => is node ref
*/ */
public boolean isNodeRef() public boolean isNodeRef()
{ {
String datatype = getDataType(); String datatype = getDataType();
return (datatype == null) ? false : datatype.equals(DataTypeDefinition.NODE_REF.toString()) || datatype.equals(DataTypeDefinition.CATEGORY.toString()); return (datatype == null) ? false : datatype.equals(DataTypeDefinition.NODE_REF.toString()) || datatype.equals(DataTypeDefinition.CATEGORY.toString());
} }
/** /**
* Determines whether the value is null * Determines whether the value is null
* *
* @return true => value is null * @return true => value is null
*/ */
public boolean isNullValue() public boolean isNullValue()
{ {
@@ -889,39 +917,59 @@ public class AdminNodeBrowseBean implements Serializable
* Permission representing the fact that "Read Permissions" has not been granted * Permission representing the fact that "Read Permissions" has not been granted
*/ */
public static class NoReadPermissionGranted implements Serializable public static class NoReadPermissionGranted implements Serializable
{ {
private static final long serialVersionUID = -6256369557521402921L; private static final long serialVersionUID = -6256369557521402921L;
public String getPermission() public String getPermission()
{ {
return PermissionService.READ_PERMISSIONS; return PermissionService.READ_PERMISSIONS;
} }
public String getAuthority() public String getAuthority()
{ {
return "[Current Authority]"; return "[Current Authority]";
} }
public String getAccessStatus() public String getAccessStatus()
{ {
return "Not Granted"; return "Not Granted";
} }
} }
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
*/ */
public class SearchResults implements Serializable public class SearchResults implements Serializable
{ {
private static final long serialVersionUID = 7402906720039176001L; private static final long serialVersionUID = 7402906720039176001L;
private int length = 0; private int length = 0;
private SerialListDataModel rows; private SerialListDataModel rows;
/** /**
* Construct * Construct
* *
* @param resultSet query result set * @param resultSet query result set
*/ */
public SearchResults(ResultSet resultSet) public SearchResults(ResultSet resultSet)
{ {
@@ -932,11 +980,11 @@ public class AdminNodeBrowseBean implements Serializable
length = resultSet.length(); length = resultSet.length();
} }
} }
/** /**
* Construct * Construct
* *
* @param resultSet query result set * @param resultSet query result set
*/ */
public SearchResults(List<NodeRef> resultSet) public SearchResults(List<NodeRef> resultSet)
{ {
@@ -957,7 +1005,7 @@ public class AdminNodeBrowseBean implements Serializable
/** /**
* Gets the row count * Gets the row count
* *
* @return count of rows * @return count of rows
*/ */
public int getLength() public int getLength()
{ {
@@ -967,17 +1015,16 @@ public class AdminNodeBrowseBean implements Serializable
/** /**
* Gets the rows * Gets the rows
* *
* @return the rows * @return the rows
*/ */
public DataModel getRows() public DataModel getRows()
{ {
return rows; return rows;
} }
private class SerialListDataModel extends ListDataModel implements Serializable private class SerialListDataModel extends ListDataModel 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

@@ -192,6 +192,27 @@
<h:outputText value="#{permission.accessStatus}"/> <h:outputText value="#{permission.accessStatus}"/>
</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"/>