diff --git a/config/alfresco/web-client-config-wcm-actions.xml b/config/alfresco/web-client-config-wcm-actions.xml
index e6144bba33..6b5b9bc489 100644
--- a/config/alfresco/web-client-config-wcm-actions.xml
+++ b/config/alfresco/web-client-config-wcm-actions.xml
@@ -164,6 +164,7 @@
CreateChildren
+ org.alfresco.web.action.evaluator.WCMContentManagerEvaluatorcreate_webapp/images/icons/create_webapp.gifdialog:createWebappFolder
diff --git a/source/java/org/alfresco/web/action/evaluator/WCMContentManagerEvaluator.java b/source/java/org/alfresco/web/action/evaluator/WCMContentManagerEvaluator.java
new file mode 100644
index 0000000000..4dd3573044
--- /dev/null
+++ b/source/java/org/alfresco/web/action/evaluator/WCMContentManagerEvaluator.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2005-2007 Alfresco Software Limited.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ * As a special exception to the terms and conditions of version 2.0 of
+ * the GPL, you may redistribute this Program in connection with Free/Libre
+ * and Open Source Software ("FLOSS") applications as described in Alfresco's
+ * FLOSS exception. You should have recieved a copy of the text describing
+ * the FLOSS exception, and it is also available here:
+ * http://www.alfresco.com/legal/licensing
+ */
+package org.alfresco.web.action.evaluator;
+
+import javax.faces.context.FacesContext;
+
+import org.alfresco.model.WCMAppModel;
+import org.alfresco.service.cmr.repository.NodeService;
+import org.alfresco.web.action.ActionEvaluator;
+import org.alfresco.web.bean.repository.Node;
+import org.alfresco.web.bean.repository.Repository;
+import org.alfresco.web.bean.wcm.SandboxFactory;
+
+/**
+ * Evaluator to return true if the current user is a content manager for the current website.
+ *
+ * @author Gavin Cornwell
+ */
+public class WCMContentManagerEvaluator extends BaseActionEvaluator
+{
+ private static final long serialVersionUID = 2588681368739253602L;
+
+ /**
+ * @return true if the item is not locked by another user
+ */
+ public boolean evaluate(final Node node)
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ NodeService nodeService = Repository.getServiceRegistry(facesContext).getNodeService();
+
+ String storeId = (String)nodeService.getProperty(node.getNodeRef(), WCMAppModel.PROP_AVMSTORE);
+
+ return SandboxFactory.isContentManager(storeId);
+ }
+}
diff --git a/source/java/org/alfresco/web/bean/wcm/CreateWebappDialog.java b/source/java/org/alfresco/web/bean/wcm/CreateWebappDialog.java
index 35772fc17c..58a7283cee 100644
--- a/source/java/org/alfresco/web/bean/wcm/CreateWebappDialog.java
+++ b/source/java/org/alfresco/web/bean/wcm/CreateWebappDialog.java
@@ -30,8 +30,11 @@ import org.alfresco.model.ApplicationModel;
import org.alfresco.model.ContentModel;
import org.alfresco.model.WCMAppModel;
import org.alfresco.repo.avm.AVMNodeConverter;
-import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.repo.domain.PropertyValue;
+import org.alfresco.repo.security.authentication.AuthenticationUtil;
+import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
+import org.alfresco.repo.security.permissions.AccessDeniedException;
+import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
/**
* Bean implementation for the AVM "Create Webapp Folder" dialog.
@@ -54,22 +57,37 @@ public class CreateWebappDialog extends CreateFolderDialog
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
final String stagingStore = this.avmBrowseBean.getStagingStore();
- final String parent = AVMUtil.buildSandboxRootPath( stagingStore );
- this.getAvmService().createDirectory(parent, this.name);
- this.path = AVMNodeConverter.ExtendAVMPath(parent, this.name);
- this.getAvmService().addAspect(this.path, ApplicationModel.ASPECT_UIFACETS);
- this.getAvmService().addAspect(this.path, WCMAppModel.ASPECT_WEBAPP);
- if (this.description != null && this.description.length() != 0)
+ if (SandboxFactory.isContentManager(stagingStore))
{
- this.getAvmService().setNodeProperty(path,
- ContentModel.PROP_DESCRIPTION,
- new PropertyValue(DataTypeDefinition.TEXT,
- this.description));
- }
+ AuthenticationUtil.runAs(new RunAsWork