mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
. Refactored client AVM Node class to extend existing Node class - allows the use of existing PermissionEvaluators etc. for a node action
. Permission evaluators added to AVM browse screen top-level actions and file/folder actions . Permission evaluators added to Edit Details action in File/Folder Details screens . Each user sandbox is now only visible to the assigned user and all Content Managers . Import Website Content action hidden unless user has appropriate Write permissions to the main staging area (Content Managers only) . Added Titled aspect to shtml content created through the XML Templating Service. . Remove Create Content action from sandbox screen - makes no sense here until we can create via workflow or destination folder . Fix nasty bug in Create Form Wizard where no default extension would be specified - this led to the XForms generating files such as "myfile.xml" and "myfile." - the generated HTML did not have a file extension... git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4048 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -642,7 +642,7 @@ text_content=Plain Text Content
|
||||
html_content=HTML Content
|
||||
xml_content=XML Content
|
||||
create_form_title=Create Form Wizard
|
||||
create_form_desc=Create Form
|
||||
create_form_desc=Create an XML Form definition from XML Schema and Templates
|
||||
create_form_step1_title=Upload an XML Schema
|
||||
create_form_step1_desc=Upload an XML Schema
|
||||
create_form_step2_title=Edit the XML Schema
|
||||
|
@@ -10,7 +10,7 @@
|
||||
<!-- a list of permissions to evaluate action against before checking other preconditions -->
|
||||
<permissions>
|
||||
<!-- each permission can be an Allow or Deny check -->
|
||||
<permission allow="te">Write</permission>
|
||||
<permission allow="true">Write</permission>
|
||||
<permission allow="false">AddChildren</permission>
|
||||
</permissions>
|
||||
<!-- the evaluator is a class implementing the org.alfresco.web.action.ActionEvaluator contract,
|
||||
@@ -326,9 +326,6 @@
|
||||
|
||||
<!-- Create XML content type -->
|
||||
<action id="create_form">
|
||||
<permissions>
|
||||
<permission allow="true">CreateChildren</permission>
|
||||
</permissions>
|
||||
<label-id>create_form</label-id>
|
||||
<image>/images/icons/new_content.gif</image>
|
||||
<action>wizard:createForm</action>
|
||||
@@ -356,9 +353,6 @@
|
||||
|
||||
<!-- Create Website Wizard -->
|
||||
<action id="create_website_wizard">
|
||||
<permissions>
|
||||
<permission allow="true">CreateChildren</permission>
|
||||
</permissions>
|
||||
<!-- TODO: check for role and in Websites folder -->
|
||||
<label-id>create_website</label-id>
|
||||
<image>/images/icons/create_website.gif</image>
|
||||
|
@@ -5,6 +5,9 @@
|
||||
|
||||
<!-- Edit WCM document -->
|
||||
<action id="edit_file">
|
||||
<permissions>
|
||||
<permission allow="true">Write</permission>
|
||||
</permissions>
|
||||
<label-id>edit</label-id>
|
||||
<image>/images/icons/edit_icon.gif</image>
|
||||
<action-listener>#{AVMEditBean.setupEditAction}</action-listener>
|
||||
@@ -15,6 +18,9 @@
|
||||
|
||||
<!-- Delete AVM file -->
|
||||
<action id="delete_file">
|
||||
<permissions>
|
||||
<permission allow="true">Delete</permission>
|
||||
</permissions>
|
||||
<label-id>delete</label-id>
|
||||
<image>/images/icons/delete.gif</image>
|
||||
<action-listener>#{AVMBrowseBean.setupContentAction}</action-listener>
|
||||
@@ -26,6 +32,9 @@
|
||||
|
||||
<!-- Delete AVM file, with a return navigation outcome parameter -->
|
||||
<action id="delete_file_browse">
|
||||
<permissions>
|
||||
<permission allow="true">Delete</permission>
|
||||
</permissions>
|
||||
<label-id>delete</label-id>
|
||||
<image>/images/icons/delete.gif</image>
|
||||
<action-listener>#{AVMBrowseBean.setupContentAction}</action-listener>
|
||||
@@ -37,6 +46,9 @@
|
||||
|
||||
<!-- Delete AVM folder -->
|
||||
<action id="delete_folder">
|
||||
<permissions>
|
||||
<permission allow="true">Delete</permission>
|
||||
</permissions>
|
||||
<label-id>delete</label-id>
|
||||
<image>/images/icons/delete.gif</image>
|
||||
<action-listener>#{AVMBrowseBean.setupContentAction}</action-listener>
|
||||
@@ -48,6 +60,9 @@
|
||||
|
||||
<!-- Delete AVM folder, with a return navigation outcome parameter -->
|
||||
<action id="delete_folder_browse">
|
||||
<permissions>
|
||||
<permission allow="true">Delete</permission>
|
||||
</permissions>
|
||||
<label-id>delete</label-id>
|
||||
<image>/images/icons/delete.gif</image>
|
||||
<action-listener>#{AVMBrowseBean.setupContentAction}</action-listener>
|
||||
@@ -59,6 +74,9 @@
|
||||
|
||||
<!-- Submit AVM node -->
|
||||
<action id="submit">
|
||||
<permissions>
|
||||
<permission allow="true">Read</permission>
|
||||
</permissions>
|
||||
<label-id>submit</label-id>
|
||||
<image>/images/icons/submit.gif</image>
|
||||
<action-listener>#{AVMBrowseBean.submitNode}</action-listener>
|
||||
@@ -85,6 +103,9 @@
|
||||
|
||||
<!-- Create AVM Content -->
|
||||
<action id="create_content">
|
||||
<permissions>
|
||||
<permission allow="true">CreateChildren</permission>
|
||||
</permissions>
|
||||
<label-id>sandbox_create</label-id>
|
||||
<image>/images/icons/new_content.gif</image>
|
||||
<action>wizard:createWebContent</action>
|
||||
@@ -92,6 +113,9 @@
|
||||
|
||||
<!-- Create AVM folder -->
|
||||
<action id="create_folder">
|
||||
<permissions>
|
||||
<permission allow="true">CreateChildren</permission>
|
||||
</permissions>
|
||||
<label-id>create_folder</label-id>
|
||||
<image>/images/icons/create_space.gif</image>
|
||||
<action>dialog:createAvmFolder</action>
|
||||
@@ -99,6 +123,9 @@
|
||||
|
||||
<!-- Upload Content -->
|
||||
<action id="add_content">
|
||||
<permissions>
|
||||
<permission allow="true">CreateChildren</permission>
|
||||
</permissions>
|
||||
<label-id>add_content</label-id>
|
||||
<image>/images/icons/add.gif</image>
|
||||
<action>addAvmContent</action>
|
||||
@@ -107,6 +134,9 @@
|
||||
|
||||
<!-- Update document -->
|
||||
<action id="update_file">
|
||||
<permissions>
|
||||
<permission allow="true">Write</permission>
|
||||
</permissions>
|
||||
<label-id>update</label-id>
|
||||
<image>/images/icons/update.gif</image>
|
||||
<action-listener>#{AVMBrowseBean.setupContentAction}</action-listener>
|
||||
|
@@ -66,6 +66,11 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private static final String FILE_TEMPLATEOUTPUT = "template-output-method";
|
||||
|
||||
private static final String FILE_SCHEMA = "schema";
|
||||
|
||||
|
||||
/**
|
||||
* Simple wrapper class to represent a template output method
|
||||
*/
|
||||
@@ -204,8 +209,6 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean
|
||||
this.schemaRootTagName = null;
|
||||
this.templateName = null;
|
||||
this.templateOutputMethods = new ArrayList<TemplateOutputMethodData>();
|
||||
clearUpload("schema");
|
||||
clearUpload("template-output-method");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -275,7 +278,7 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean
|
||||
*/
|
||||
public String removeUploadedSchemaFile()
|
||||
{
|
||||
clearUpload("schema");
|
||||
clearUpload(FILE_SCHEMA);
|
||||
|
||||
// refresh the current page
|
||||
return null;
|
||||
@@ -286,7 +289,7 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean
|
||||
*/
|
||||
public String removeUploadedTemplateOutputMethodFile()
|
||||
{
|
||||
clearUpload("template-output-method");
|
||||
clearUpload(FILE_TEMPLATEOUTPUT);
|
||||
|
||||
// refresh the current page
|
||||
return null;
|
||||
@@ -369,7 +372,7 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean
|
||||
*/
|
||||
public File getSchemaFile()
|
||||
{
|
||||
return this.getFile("schema");
|
||||
return this.getFile(FILE_SCHEMA);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -379,7 +382,7 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean
|
||||
{
|
||||
// try and retrieve the file and filename from the file upload bean
|
||||
// representing the file we previously uploaded.
|
||||
return this.getFileName("schema");
|
||||
return this.getFileName(FILE_SCHEMA);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -387,7 +390,7 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean
|
||||
*/
|
||||
public String getTemplateOutputMethodFileName()
|
||||
{
|
||||
return this.getFileName("template-output-method");
|
||||
return this.getFileName(FILE_TEMPLATEOUTPUT);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -395,7 +398,7 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean
|
||||
*/
|
||||
public File getTemplateOutputMethodFile()
|
||||
{
|
||||
return this.getFile("template-output-method");
|
||||
return this.getFile(FILE_TEMPLATEOUTPUT);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -490,12 +493,12 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean
|
||||
{
|
||||
// remove the file upload bean from the session
|
||||
FacesContext ctx = FacesContext.getCurrentInstance();
|
||||
FileUploadBean fileBean = (FileUploadBean)
|
||||
ctx.getExternalContext().getSessionMap().
|
||||
get(FileUploadBean.getKey(id));
|
||||
FileUploadBean fileBean =
|
||||
(FileUploadBean)ctx.getExternalContext().getSessionMap().get(FileUploadBean.getKey(id));
|
||||
if (fileBean != null)
|
||||
{
|
||||
fileBean.setFile(null);
|
||||
fileBean.setFileName(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -89,7 +89,7 @@ public class Node implements Serializable
|
||||
/**
|
||||
* @return All the properties known about this node.
|
||||
*/
|
||||
public final Map<String, Object> getProperties()
|
||||
public Map<String, Object> getProperties()
|
||||
{
|
||||
if (this.propsRetrieved == false)
|
||||
{
|
||||
@@ -289,7 +289,7 @@ public class Node implements Serializable
|
||||
/**
|
||||
* @return The display name for the node
|
||||
*/
|
||||
public final String getName()
|
||||
public String getName()
|
||||
{
|
||||
if (this.name == null)
|
||||
{
|
||||
@@ -339,20 +339,20 @@ public class Node implements Serializable
|
||||
public boolean hasPermission(String permission)
|
||||
{
|
||||
Boolean valid = null;
|
||||
if (permissions != null)
|
||||
if (this.permissions != null)
|
||||
{
|
||||
valid = permissions.get(permission);
|
||||
valid = this.permissions.get(permission);
|
||||
}
|
||||
else
|
||||
{
|
||||
permissions = new HashMap<String, Boolean>(5, 1.0f);
|
||||
this.permissions = new HashMap<String, Boolean>(8, 1.0f);
|
||||
}
|
||||
|
||||
if (valid == null)
|
||||
{
|
||||
PermissionService service = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService();
|
||||
valid = Boolean.valueOf(service.hasPermission(this.nodeRef, permission) == AccessStatus.ALLOWED);
|
||||
permissions.put(permission, valid);
|
||||
this.permissions.put(permission, valid);
|
||||
}
|
||||
|
||||
return valid.booleanValue();
|
||||
@@ -369,7 +369,7 @@ public class Node implements Serializable
|
||||
/**
|
||||
* @return The path for the node
|
||||
*/
|
||||
public final String getPath()
|
||||
public String getPath()
|
||||
{
|
||||
if (this.path == null)
|
||||
{
|
||||
|
@@ -90,6 +90,7 @@ public class AVMBrowseBean implements IContextListener
|
||||
private String username;
|
||||
private String sandboxTitle = null;
|
||||
private String currentPath = null;
|
||||
private AVMNode currentPathNode = null;
|
||||
|
||||
/* component references */
|
||||
private UIRichList foldersRichList;
|
||||
@@ -100,7 +101,7 @@ public class AVMBrowseBean implements IContextListener
|
||||
private List<Map> files = null;
|
||||
private List<Map> folders = null;
|
||||
|
||||
/** Current AVM Node context*/
|
||||
/** Current AVM Node action context */
|
||||
private AVMNode avmNode = null;
|
||||
|
||||
private String wcmDomain;
|
||||
@@ -415,25 +416,25 @@ public class AVMBrowseBean implements IContextListener
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the current AVM node context.
|
||||
* @return Returns the current AVM node action context.
|
||||
*/
|
||||
public AVMNode getAvmNode()
|
||||
public AVMNode getAvmActionNode()
|
||||
{
|
||||
return this.avmNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param avmNode The AVM node context to set.
|
||||
* @param avmNode The AVM node action context to set.
|
||||
*/
|
||||
public void setAvmNode(AVMNode avmNode)
|
||||
public void setAvmActionNode(AVMNode avmNode)
|
||||
{
|
||||
this.avmNode = avmNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param avmRef The AVMNodeDescriptor context to set.
|
||||
* @param avmRef The AVMNodeDescriptor action context to set.
|
||||
*/
|
||||
public void setAVMNodeDescriptor(AVMNodeDescriptor avmRef)
|
||||
public void setAVMActionNodeDescriptor(AVMNodeDescriptor avmRef)
|
||||
{
|
||||
AVMNode avmNode = new AVMNode(avmRef);
|
||||
this.avmNode = avmNode;
|
||||
@@ -457,11 +458,29 @@ public class AVMBrowseBean implements IContextListener
|
||||
public void setCurrentPath(String path)
|
||||
{
|
||||
this.currentPath = path;
|
||||
if (path == null)
|
||||
{
|
||||
// clear dependant objects (recreated when the path is reinitialised)
|
||||
this.currentPathNode = null;
|
||||
}
|
||||
|
||||
// update UI state ready for screen refresh
|
||||
UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the AVMNode that represents the current browsing path
|
||||
*/
|
||||
public AVMNode getCurrentPathNode()
|
||||
{
|
||||
if (this.currentPathNode == null)
|
||||
{
|
||||
AVMNodeDescriptor node = this.avmService.lookup(-1, getCurrentPath(), true);
|
||||
this.currentPathNode = new AVMNode(node);
|
||||
}
|
||||
return this.currentPathNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Breadcrumb location list
|
||||
*/
|
||||
@@ -638,11 +657,11 @@ public class AVMBrowseBean implements IContextListener
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Setup content action for path: " + path);
|
||||
AVMNodeDescriptor node = avmService.lookup(-1, path, true);
|
||||
setAVMNodeDescriptor(node);
|
||||
setAVMActionNodeDescriptor(node);
|
||||
}
|
||||
else
|
||||
{
|
||||
setAvmNode(null);
|
||||
setAvmActionNode(null);
|
||||
}
|
||||
|
||||
// update UI state ready for return after dialog close
|
||||
@@ -667,14 +686,14 @@ public class AVMBrowseBean implements IContextListener
|
||||
tx.begin();
|
||||
|
||||
Action action = this.actionService.createAction(ACTION_AVM_SUBMIT);
|
||||
this.actionService.executeAction(action, getAvmNode().getNodeRef());
|
||||
this.actionService.executeAction(action, getAvmActionNode().getNodeRef());
|
||||
|
||||
// commit the transaction
|
||||
tx.commit();
|
||||
|
||||
// if we get here, all was well - output friendly status message to the user
|
||||
String msg = MessageFormat.format(Application.getMessage(
|
||||
context, MSG_SUBMIT_SUCCESS), getAvmNode().getName());
|
||||
context, MSG_SUBMIT_SUCCESS), getAvmActionNode().getName());
|
||||
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
|
||||
String formId = Utils.getParentForm(context, event.getComponent()).getClientId(context);
|
||||
context.addMessage(formId + ':' + COMPONENT_SANDBOXESPANEL, facesMsg);
|
||||
|
@@ -116,7 +116,7 @@ public class AVMEditBean
|
||||
*/
|
||||
public AVMNode getAvmNode()
|
||||
{
|
||||
return this.avmBrowseBean.getAvmNode();
|
||||
return this.avmBrowseBean.getAvmActionNode();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -20,25 +20,23 @@ import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||
import org.alfresco.repo.domain.PropertyValue;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.namespace.QNameMap;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
|
||||
/**
|
||||
* Node class representing an AVM specific Node.
|
||||
*
|
||||
* Handles AVM related notions such as Path and Version. Provides the usual properties and
|
||||
* property resolving functions, and appropriate method overrides for the AVM world.
|
||||
*
|
||||
* @author Kevin Roast
|
||||
*/
|
||||
public class AVMNode implements Map<String, Object>
|
||||
public class AVMNode extends Node implements Map<String, Object>
|
||||
{
|
||||
private QNameMap<String, Object> properties = null;
|
||||
private ServiceRegistry services = null;
|
||||
private AVMNodeDescriptor avmRef;
|
||||
private String path;
|
||||
private int version;
|
||||
@@ -47,46 +45,51 @@ public class AVMNode implements Map<String, Object>
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param avmRef The AVMNodeDescriptor that describes this node
|
||||
*/
|
||||
public AVMNode(AVMNodeDescriptor avmRef)
|
||||
{
|
||||
super(AVMNodeConverter.ToNodeRef(-1, avmRef.getPath()));
|
||||
this.avmRef = avmRef;
|
||||
this.version = -1; // TODO: always -1 for now...
|
||||
this.path = avmRef.getPath();
|
||||
this.id = this.path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param avmRef The AVMNodeDescriptor that describes this node
|
||||
* @param deleted True if the node represents a ghosted deleted node
|
||||
*/
|
||||
public AVMNode(AVMNodeDescriptor avmRef, boolean deleted)
|
||||
{
|
||||
this(avmRef);
|
||||
this.deleted = deleted;
|
||||
}
|
||||
|
||||
public String getPath()
|
||||
public final String getPath()
|
||||
{
|
||||
return this.path;
|
||||
}
|
||||
|
||||
public int getVersion()
|
||||
public final int getVersion()
|
||||
{
|
||||
return this.version;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
public final String getName()
|
||||
{
|
||||
return this.avmRef.getName();
|
||||
}
|
||||
|
||||
public NodeRef getNodeRef()
|
||||
{
|
||||
return AVMNodeConverter.ToNodeRef(this.version, this.path);
|
||||
}
|
||||
|
||||
public boolean isDirectory()
|
||||
public final boolean isDirectory()
|
||||
{
|
||||
return this.avmRef.isDirectory();
|
||||
}
|
||||
|
||||
public boolean isFile()
|
||||
public final boolean isFile()
|
||||
{
|
||||
return this.avmRef.isFile();
|
||||
}
|
||||
@@ -96,10 +99,8 @@ public class AVMNode implements Map<String, Object>
|
||||
*/
|
||||
public final Map<String, Object> getProperties()
|
||||
{
|
||||
if (this.properties == null)
|
||||
if (this.propsRetrieved == false)
|
||||
{
|
||||
this.properties = new QNameMap<String, Object>(getServiceRegistry().getNamespaceService());
|
||||
|
||||
if (this.deleted == false)
|
||||
{
|
||||
Map<QName, PropertyValue> props = getServiceRegistry().getAVMService().getNodeProperties(this.version, this.path);
|
||||
@@ -117,31 +118,13 @@ public class AVMNode implements Map<String, Object>
|
||||
this.properties.put("created", this.avmRef.getCreateDate());
|
||||
this.properties.put("modified", this.avmRef.getModDate());
|
||||
this.properties.put("creator", this.avmRef.getCreator());
|
||||
|
||||
this.propsRetrieved = true;
|
||||
}
|
||||
|
||||
return this.properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the given property name is held by this node
|
||||
*
|
||||
* @param propertyName Property to test existence of
|
||||
* @return true if property exists, false otherwise
|
||||
*/
|
||||
public final boolean hasProperty(String propertyName)
|
||||
{
|
||||
return getProperties().containsKey(propertyName);
|
||||
}
|
||||
|
||||
private ServiceRegistry getServiceRegistry()
|
||||
{
|
||||
if (this.services == null)
|
||||
{
|
||||
this.services = Repository.getServiceRegistry(FacesContext.getCurrentInstance());
|
||||
}
|
||||
return this.services;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------
|
||||
// Map implementation - allows the Node bean to be accessed using JSF expression syntax
|
||||
|
@@ -131,7 +131,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
{
|
||||
foundCurrentUser = true;
|
||||
}
|
||||
if (ROLE_CONTENT_MANAGER.equals(userRole))
|
||||
if (ROLE_CONTENT_MANAGER.equals(userRole.getRole()))
|
||||
{
|
||||
managers.add(authority);
|
||||
}
|
||||
|
@@ -49,7 +49,7 @@ public class DeleteFileDialog extends BaseDialogBean
|
||||
throws Exception
|
||||
{
|
||||
// get the content to delete
|
||||
AVMNode node = this.avmBrowseBean.getAvmNode();
|
||||
AVMNode node = this.avmBrowseBean.getAvmActionNode();
|
||||
if (node != null)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
@@ -101,6 +101,6 @@ public class DeleteFileDialog extends BaseDialogBean
|
||||
"delete_avm_file_confirm");
|
||||
|
||||
return MessageFormat.format(fileConfirmMsg,
|
||||
new Object[] {this.avmBrowseBean.getAvmNode().getName()});
|
||||
new Object[] {this.avmBrowseBean.getAvmActionNode().getName()});
|
||||
}
|
||||
}
|
||||
|
@@ -49,7 +49,7 @@ public class DeleteFolderDialog extends BaseDialogBean
|
||||
throws Exception
|
||||
{
|
||||
// get the content to delete
|
||||
AVMNode node = this.avmBrowseBean.getAvmNode();
|
||||
AVMNode node = this.avmBrowseBean.getAvmActionNode();
|
||||
if (node != null)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
@@ -101,6 +101,6 @@ public class DeleteFolderDialog extends BaseDialogBean
|
||||
"delete_avm_folder_confirm");
|
||||
|
||||
return MessageFormat.format(fileConfirmMsg,
|
||||
new Object[] {this.avmBrowseBean.getAvmNode().getName()});
|
||||
new Object[] {this.avmBrowseBean.getAvmActionNode().getName()});
|
||||
}
|
||||
}
|
||||
|
@@ -78,7 +78,7 @@ public class EditFilePropertiesDialog extends EditContentPropertiesDialog
|
||||
@Override
|
||||
protected Node initEditableNode()
|
||||
{
|
||||
return new Node(this.avmBrowseBean.getAvmNode().getNodeRef());
|
||||
return new Node(this.avmBrowseBean.getAvmActionNode().getNodeRef());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -170,7 +170,7 @@ public class EditFilePropertiesDialog extends EditContentPropertiesDialog
|
||||
String name = this.editableNode.getName();
|
||||
String oldPath = AVMNodeConverter.ToAVMVersionPath(this.editableNode.getNodeRef()).getSecond();
|
||||
String newPath = oldPath.substring(0, oldPath.lastIndexOf('/') + 1) + name;
|
||||
this.avmBrowseBean.setAvmNode(new AVMNode(this.avmService.lookup(-1, newPath)));
|
||||
this.avmBrowseBean.setAvmActionNode(new AVMNode(this.avmService.lookup(-1, newPath)));
|
||||
|
||||
return outcome;
|
||||
}
|
||||
@@ -194,7 +194,7 @@ public class EditFilePropertiesDialog extends EditContentPropertiesDialog
|
||||
{
|
||||
return MessageFormat.format(Application.getMessage(
|
||||
FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF),
|
||||
new Object[] {this.avmBrowseBean.getAvmNode().getPath()});
|
||||
new Object[] {this.avmBrowseBean.getAvmActionNode().getPath()});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -77,7 +77,7 @@ public class EditFolderPropertiesDialog extends EditSpaceDialog
|
||||
@Override
|
||||
protected Node initEditableNode()
|
||||
{
|
||||
return new Node(this.avmBrowseBean.getAvmNode().getNodeRef());
|
||||
return new Node(this.avmBrowseBean.getAvmActionNode().getNodeRef());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -154,7 +154,7 @@ public class EditFolderPropertiesDialog extends EditSpaceDialog
|
||||
String name = this.editableNode.getName();
|
||||
String oldPath = AVMNodeConverter.ToAVMVersionPath(this.editableNode.getNodeRef()).getSecond();
|
||||
String newPath = oldPath.substring(0, oldPath.lastIndexOf('/') + 1) + name;
|
||||
this.avmBrowseBean.setAvmNode(new AVMNode(this.avmService.lookup(-1, newPath)));
|
||||
this.avmBrowseBean.setAvmActionNode(new AVMNode(this.avmService.lookup(-1, newPath)));
|
||||
|
||||
return outcome;
|
||||
}
|
||||
|
@@ -35,7 +35,7 @@ public class FileDetailsBean extends AVMDetailsBean
|
||||
@Override
|
||||
public AVMNode getAvmNode()
|
||||
{
|
||||
return this.avmBrowseBean.getAvmNode();
|
||||
return this.avmBrowseBean.getAvmActionNode();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -35,7 +35,7 @@ public class FolderDetailsBean extends AVMDetailsBean
|
||||
@Override
|
||||
public AVMNode getAvmNode()
|
||||
{
|
||||
return this.avmBrowseBean.getAvmNode();
|
||||
return this.avmBrowseBean.getAvmActionNode();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -18,6 +18,7 @@ package org.alfresco.web.templating;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -30,6 +31,7 @@ import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.web.bean.wcm.AVMConstants;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -83,6 +85,9 @@ public class OutputUtil
|
||||
nodeService.setProperty(outputNodeRef,
|
||||
TemplatingService.TT_QNAME,
|
||||
tt.getName());
|
||||
Map<QName, Serializable> titledProps = new HashMap<QName, Serializable>(1, 1.0f);
|
||||
titledProps.put(ContentModel.PROP_TITLE, fileName);
|
||||
nodeService.addAspect(outputNodeRef, ContentModel.ASPECT_TITLED, titledProps);
|
||||
|
||||
LOGGER.debug("generated " + generatedFileName + " using " + tom);
|
||||
|
||||
|
@@ -42,6 +42,8 @@ import org.alfresco.service.cmr.avmsync.AVMSyncService;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
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.RegexQNamePattern;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.app.servlet.DownloadContentServlet;
|
||||
@@ -184,6 +186,7 @@ public class UIUserSandboxes extends SelfRenderingComponent
|
||||
ResourceBundle bundle = Application.getBundle(context);
|
||||
AVMService avmService = getAVMService(context);
|
||||
NodeService nodeService = getNodeService(context);
|
||||
PermissionService permissionService = getPermissionService(context);
|
||||
UserTransaction tx = null;
|
||||
try
|
||||
{
|
||||
@@ -191,13 +194,14 @@ public class UIUserSandboxes extends SelfRenderingComponent
|
||||
tx.begin();
|
||||
|
||||
NodeRef websiteRef = getValue();
|
||||
if (value == null)
|
||||
if (websiteRef == null)
|
||||
{
|
||||
throw new IllegalArgumentException("Website NodeRef must be specified.");
|
||||
}
|
||||
String storeRoot = (String)nodeService.getProperty(websiteRef, ContentModel.PROP_AVMSTORE);
|
||||
|
||||
// get the list of users who have a sandbox in the website
|
||||
String currentUser = Application.getCurrentUser(context).getUserName();
|
||||
int index = 0;
|
||||
List<ChildAssociationRef> userInfoRefs = nodeService.getChildAssocs(
|
||||
websiteRef, ContentModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
|
||||
@@ -212,6 +216,13 @@ public class UIUserSandboxes extends SelfRenderingComponent
|
||||
|
||||
// check it exists before we render the view
|
||||
if (avmService.getAVMStore(mainStore) != null)
|
||||
{
|
||||
// check the permissions on this store for the current user
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Checking user permissions for store: " + mainStore);
|
||||
if (permissionService.hasPermission(
|
||||
AVMNodeConverter.ToNodeRef(-1, AVMConstants.buildAVMStoreRootPath(mainStore)),
|
||||
PermissionService.READ) == AccessStatus.ALLOWED)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Building sandbox view for user store: " + mainStore);
|
||||
@@ -245,10 +256,11 @@ public class UIUserSandboxes extends SelfRenderingComponent
|
||||
null, null, sandboxUrl));
|
||||
out.write(" ");
|
||||
|
||||
Utils.encodeRecursive(context, aquireAction(
|
||||
// TODO: add this action back once we can create in a specific sub-folder
|
||||
/*Utils.encodeRecursive(context, aquireAction(
|
||||
context, mainStore, username, "sandbox_create", "/images/icons/new_content.gif",
|
||||
"#{AVMBrowseBean.setupSandboxAction}", "wizard:createWebContent", null));
|
||||
out.write(" ");
|
||||
out.write(" ");*/
|
||||
|
||||
Utils.encodeRecursive(context, aquireAction(
|
||||
context, mainStore, username, "sandbox_submitall", "/images/icons/submit.gif",
|
||||
@@ -293,6 +305,7 @@ public class UIUserSandboxes extends SelfRenderingComponent
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tx.commit();
|
||||
}
|
||||
@@ -664,6 +677,11 @@ public class UIUserSandboxes extends SelfRenderingComponent
|
||||
return (AVMSyncService)FacesContextUtils.getRequiredWebApplicationContext(fc).getBean("AVMSyncService");
|
||||
}
|
||||
|
||||
private PermissionService getPermissionService(FacesContext fc)
|
||||
{
|
||||
return Repository.getServiceRegistry(fc).getPermissionService();
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Strongly typed component property accessors
|
||||
|
@@ -79,14 +79,16 @@
|
||||
</td>
|
||||
<td style="padding-left:4px" width=52>
|
||||
<%-- Create actions menu --%>
|
||||
<r:permissionEvaluator value="#{AVMBrowseBean.currentPathNode}" allow="CreateChildren" id="eval1">
|
||||
<a:menu id="createMenu" itemSpacing="4" label="#{msg.create_options}" image="/images/icons/menu.gif" menuStyleClass="moreActionsMenu" style="white-space:nowrap">
|
||||
<r:actions id="acts_create" value="avm_create_menu" context="#{AVMBrowseBean.avmNode}" />
|
||||
<r:actions id="acts_create" value="avm_create_menu" context="#{AVMBrowseBean.currentPathNode}" />
|
||||
</a:menu>
|
||||
</r:permissionEvaluator>
|
||||
</td>
|
||||
<td style="padding-left:4px" width=80>
|
||||
<%-- More actions menu --%>
|
||||
<a:menu id="actionsMenu" itemSpacing="4" label="#{msg.more_actions}" image="/images/icons/menu.gif" menuStyleClass="moreActionsMenu" style="white-space:nowrap">
|
||||
<r:actions id="acts_more" value="avm_more_menu" context="#{AVMBrowseBean.avmNode}" />
|
||||
<r:actions id="acts_more" value="avm_more_menu" context="#{AVMBrowseBean.currentPathNode}" />
|
||||
</a:menu>
|
||||
</td>
|
||||
</tr>
|
||||
|
@@ -76,7 +76,9 @@
|
||||
</td>
|
||||
<td align=right>
|
||||
<%-- Import website content action --%>
|
||||
<r:permissionEvaluator value="#{NavigationBean.currentNode}" allow="CreateChildren" id="eval1">
|
||||
<a:actionLink value="#{msg.import_website_content}" image="/images/icons/import_website.gif" padding="2" action="dialog:importContent" actionListener="#{ImportWebsiteDialog.start}" />
|
||||
</r:permissionEvaluator>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -106,7 +108,8 @@
|
||||
<td align=left><h:outputText value="#{msg.staging_sandbox}" styleClass="mainSubTitle" /></td>
|
||||
<td align=right>
|
||||
<a:actionLink id="actPreview" value="#{msg.sandbox_preview}" image="/images/icons/preview_website.gif" showLink="false" href="#{AVMBrowseBean.stagingPreviewUrl}" target="new" />
|
||||
<a:actionLink id="actCreate" value="#{msg.sandbox_create}" image="/images/icons/new_content.gif" showLink="false" actionListener="#{AVMBrowseBean.setupSandboxAction}" action="wizard:createWebContent" />
|
||||
<%-- TODO: add this action back once we can create in a specific sub-folder --%>
|
||||
<%--<a:actionLink id="actCreate" value="#{msg.sandbox_create}" image="/images/icons/new_content.gif" showLink="false" actionListener="#{AVMBrowseBean.setupSandboxAction}" action="wizard:createWebContent" />--%>
|
||||
<a:actionLink id="actBrowse" value="#{msg.sandbox_browse}" image="/images/icons/space_small.gif" showLink="false" actionListener="#{AVMBrowseBean.setupSandboxAction}" action="browseSandbox" />
|
||||
</td>
|
||||
</tr>
|
||||
|
@@ -82,14 +82,13 @@ if (upload == null || upload.getFile() == null)
|
||||
value="/images/icons/required_field.gif" alt="Required Field" />
|
||||
<h:outputText id="file_extension_output_text"
|
||||
value="#{msg.extension_for_generated_assets}:"/>
|
||||
<h:inputText id="file-extension" value=""
|
||||
<h:inputText id="file-extension" value="shtml"
|
||||
maxlength="10" size="10"/>
|
||||
</h:panelGrid>
|
||||
|
||||
<h:panelGroup id="step-2-panel-group" styleClass="mainSubText">
|
||||
<h:outputText id="step-2-output-text" value="2." />
|
||||
<h:commandButton id="add-to-list-button"
|
||||
value="#{msg.add_to_list_button}"
|
||||
<h:commandButton id="add-to-list-button" value="#{msg.add_to_list_button}"
|
||||
actionListener="#{CreateXmlContentTypeWizard.addSelectedTemplateOutputMethod}"
|
||||
styleClass="wizardButton" />
|
||||
</h:panelGroup>
|
||||
|
@@ -132,9 +132,9 @@
|
||||
|
||||
<h:panelGroup id="props-panel-facets">
|
||||
<f:facet name="title">
|
||||
<%--<r:permissionEvaluator value="#{FileDetailsBean.document}" allow="Write">--%>
|
||||
<r:permissionEvaluator value="#{FileDetailsBean.document}" allow="Write">
|
||||
<a:actionLink id="titleLink1" value="#{msg.modify}" showLink="false" image="/images/icons/Change_details.gif" action="dialog:editAvmFileProperties" />
|
||||
<%--</r:permissionEvaluator>--%>
|
||||
</r:permissionEvaluator>
|
||||
</f:facet>
|
||||
</h:panelGroup>
|
||||
<a:panel label="#{msg.properties}" id="properties-panel" facetsId="props-panel-facets" progressive="true"
|
||||
|
@@ -125,9 +125,9 @@
|
||||
|
||||
<h:panelGroup id="props-panel-facets">
|
||||
<f:facet name="title">
|
||||
<%--<r:permissionEvaluator value="#{FolderDetailsBean.folder}" allow="Write">--%>
|
||||
<r:permissionEvaluator value="#{FolderDetailsBean.folder}" allow="Write">
|
||||
<a:actionLink id="titleLink1" value="#{msg.modify}" showLink="false" image="/images/icons/Change_details.gif" action="dialog:editAvmFolderProperties" />
|
||||
<%--</r:permissionEvaluator>--%>
|
||||
</r:permissionEvaluator>
|
||||
</f:facet>
|
||||
</h:panelGroup>
|
||||
<a:panel label="#{msg.properties}" id="properties-panel" facetsId="props-panel-facets" progressive="true"
|
||||
|
Reference in New Issue
Block a user