mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
. UI action evaluators for Create Web Project and Create Form actions
- permissions are check for Write access to appropriate folders - The Create Web Project action is now only available when the current folder context is the "Websites" folder . NavigationBean bean name constant added git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4452 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -374,6 +374,7 @@
|
|||||||
|
|
||||||
<!-- Create XML content type -->
|
<!-- Create XML content type -->
|
||||||
<action id="create_form">
|
<action id="create_form">
|
||||||
|
<evaluator>org.alfresco.web.action.evaluator.CreateFormEvaluator</evaluator>
|
||||||
<label-id>create_form</label-id>
|
<label-id>create_form</label-id>
|
||||||
<image>/images/icons/new_content.gif</image>
|
<image>/images/icons/new_content.gif</image>
|
||||||
<action>wizard:createForm</action>
|
<action>wizard:createForm</action>
|
||||||
@@ -401,7 +402,7 @@
|
|||||||
|
|
||||||
<!-- Create Website Wizard -->
|
<!-- Create Website Wizard -->
|
||||||
<action id="create_website_wizard">
|
<action id="create_website_wizard">
|
||||||
<!-- TODO: check for role and in Websites folder -->
|
<evaluator>org.alfresco.web.action.evaluator.CreateWebProjectEvaluator</evaluator>
|
||||||
<label-id>create_website</label-id>
|
<label-id>create_website</label-id>
|
||||||
<image>/images/icons/create_website.gif</image>
|
<image>/images/icons/create_website.gif</image>
|
||||||
<action>wizard:createWebsite</action>
|
<action>wizard:createWebsite</action>
|
||||||
@@ -609,10 +610,10 @@
|
|||||||
<show-link>false</show-link>
|
<show-link>false</show-link>
|
||||||
<style-class>inlineAction</style-class>
|
<style-class>inlineAction</style-class>
|
||||||
|
|
||||||
<action idref="delete_space" />
|
|
||||||
<action idref="cut_node" />
|
<action idref="cut_node" />
|
||||||
<action idref="copy_node" />
|
<action idref="copy_node" />
|
||||||
<action idref="details_space" />
|
<action idref="details_space" />
|
||||||
|
<action idref="delete_space" />
|
||||||
</action-group>
|
</action-group>
|
||||||
|
|
||||||
<!-- Actions Menu for a space in the Browse screen -->
|
<!-- Actions Menu for a space in the Browse screen -->
|
||||||
|
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005 Alfresco, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Mozilla Public License version 1.1
|
||||||
|
* with a permitted attribution clause. You may obtain a
|
||||||
|
* copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.alfresco.org/legal/license.txt
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific
|
||||||
|
* language governing permissions and limitations under the
|
||||||
|
* License.
|
||||||
|
*/
|
||||||
|
package org.alfresco.web.action.evaluator;
|
||||||
|
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
|
||||||
|
import org.alfresco.service.cmr.security.AccessStatus;
|
||||||
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
|
import org.alfresco.web.action.ActionEvaluator;
|
||||||
|
import org.alfresco.web.bean.repository.Node;
|
||||||
|
import org.alfresco.web.bean.repository.Repository;
|
||||||
|
import org.alfresco.web.forms.FormsService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UI Action Evaluator - Create Web Form in the Forms DataDictionary folder
|
||||||
|
*
|
||||||
|
* @author Kevin Roast
|
||||||
|
*/
|
||||||
|
public class CreateFormEvaluator implements ActionEvaluator
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
|
||||||
|
*/
|
||||||
|
public boolean evaluate(Node node)
|
||||||
|
{
|
||||||
|
PermissionService service =
|
||||||
|
Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService();
|
||||||
|
return service.hasPermission(
|
||||||
|
FormsService.getInstance().getContentFormsNodeRef(),
|
||||||
|
PermissionService.ADD_CHILDREN) == AccessStatus.ALLOWED;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005 Alfresco, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Mozilla Public License version 1.1
|
||||||
|
* with a permitted attribution clause. You may obtain a
|
||||||
|
* copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.alfresco.org/legal/license.txt
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific
|
||||||
|
* language governing permissions and limitations under the
|
||||||
|
* License.
|
||||||
|
*/
|
||||||
|
package org.alfresco.web.action.evaluator;
|
||||||
|
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
|
||||||
|
import org.alfresco.service.ServiceRegistry;
|
||||||
|
import org.alfresco.service.cmr.repository.Path;
|
||||||
|
import org.alfresco.service.cmr.security.AccessStatus;
|
||||||
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
|
import org.alfresco.web.action.ActionEvaluator;
|
||||||
|
import org.alfresco.web.app.Application;
|
||||||
|
import org.alfresco.web.app.servlet.FacesHelper;
|
||||||
|
import org.alfresco.web.bean.NavigationBean;
|
||||||
|
import org.alfresco.web.bean.repository.Node;
|
||||||
|
import org.alfresco.web.bean.repository.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UI Action Evaluator - Create Web Project in the Websites folders
|
||||||
|
*
|
||||||
|
* @author Kevin Roast
|
||||||
|
*/
|
||||||
|
public class CreateWebProjectEvaluator implements ActionEvaluator
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
|
||||||
|
*/
|
||||||
|
public boolean evaluate(Node node)
|
||||||
|
{
|
||||||
|
FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
|
ServiceRegistry services = Repository.getServiceRegistry(fc);
|
||||||
|
NavigationBean navigator = (NavigationBean)FacesHelper.getManagedBean(fc, NavigationBean.BEAN_NAME);
|
||||||
|
// get the path to the current name - compare last element with the Website folder assoc name
|
||||||
|
Path path = services.getNodeService().getPath(navigator.getCurrentNode().getNodeRef());
|
||||||
|
Path.Element element = path.get(path.size() - 1);
|
||||||
|
String endPath = element.getPrefixedString(services.getNamespaceService());
|
||||||
|
if (Application.getWebsitesFolderName(fc).equals(endPath))
|
||||||
|
{
|
||||||
|
// check we have the permission to create nodes in that Website folder
|
||||||
|
return navigator.getCurrentNode().hasPermission(PermissionService.ADD_CHILDREN);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@@ -36,7 +36,7 @@ public class ShortcutNodeEvaluator implements ActionEvaluator
|
|||||||
public boolean evaluate(Node node)
|
public boolean evaluate(Node node)
|
||||||
{
|
{
|
||||||
NavigationBean nav =
|
NavigationBean nav =
|
||||||
(NavigationBean)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "NavigationBean");
|
(NavigationBean)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), NavigationBean.BEAN_NAME);
|
||||||
return (nav.getIsGuest() == false);
|
return (nav.getIsGuest() == false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,7 @@ public class StartWorkflowEvaluator implements ActionEvaluator
|
|||||||
public boolean evaluate(Node node)
|
public boolean evaluate(Node node)
|
||||||
{
|
{
|
||||||
NavigationBean nav =
|
NavigationBean nav =
|
||||||
(NavigationBean)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "NavigationBean");
|
(NavigationBean)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), NavigationBean.BEAN_NAME);
|
||||||
return (nav.getIsGuest() == false);
|
return (nav.getIsGuest() == false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -54,8 +54,6 @@ public class AlfrescoNavigationHandler extends NavigationHandler
|
|||||||
public final static String CLOSE_DIALOG_OUTCOME = DIALOG_PREFIX + "close";
|
public final static String CLOSE_DIALOG_OUTCOME = DIALOG_PREFIX + "close";
|
||||||
public final static String CLOSE_WIZARD_OUTCOME = WIZARD_PREFIX + "close";
|
public final static String CLOSE_WIZARD_OUTCOME = WIZARD_PREFIX + "close";
|
||||||
|
|
||||||
protected final static String CONFIG_NAV_BEAN = "NavigationBean";
|
|
||||||
|
|
||||||
protected String dialogContainer = null;
|
protected String dialogContainer = null;
|
||||||
protected String wizardContainer = null;
|
protected String wizardContainer = null;
|
||||||
|
|
||||||
@@ -400,7 +398,7 @@ public class AlfrescoNavigationHandler extends NavigationHandler
|
|||||||
Node dispatchNode = null;
|
Node dispatchNode = null;
|
||||||
|
|
||||||
NavigationBean navBean = (NavigationBean)context.getExternalContext().
|
NavigationBean navBean = (NavigationBean)context.getExternalContext().
|
||||||
getSessionMap().get(CONFIG_NAV_BEAN);
|
getSessionMap().get(NavigationBean.BEAN_NAME);
|
||||||
|
|
||||||
if (navBean != null)
|
if (navBean != null)
|
||||||
{
|
{
|
||||||
@@ -488,7 +486,7 @@ public class AlfrescoNavigationHandler extends NavigationHandler
|
|||||||
|
|
||||||
// reset the dispatch context
|
// reset the dispatch context
|
||||||
((NavigationBean)context.getExternalContext().getSessionMap().
|
((NavigationBean)context.getExternalContext().getSessionMap().
|
||||||
get(CONFIG_NAV_BEAN)).resetDispatchContext();
|
get(NavigationBean.BEAN_NAME)).resetDispatchContext();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -62,8 +62,10 @@ import org.apache.log4j.Logger;
|
|||||||
*/
|
*/
|
||||||
public class NavigationBean
|
public class NavigationBean
|
||||||
{
|
{
|
||||||
|
/** Public JSF Bean name */
|
||||||
|
public static final String BEAN_NAME = "NavigationBean";
|
||||||
|
|
||||||
private static final String OUTCOME_MYALFRESCO = "myalfresco";
|
private static final String OUTCOME_MYALFRESCO = "myalfresco";
|
||||||
|
|
||||||
private static final String OUTCOME_BROWSE = "browse";
|
private static final String OUTCOME_BROWSE = "browse";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -583,7 +583,7 @@ public final class Utils
|
|||||||
// get hold of the node service, cifsServer and navigation bean
|
// get hold of the node service, cifsServer and navigation bean
|
||||||
NodeService nodeService = Repository.getServiceRegistry(context).getNodeService();
|
NodeService nodeService = Repository.getServiceRegistry(context).getNodeService();
|
||||||
NavigationBean navBean = (NavigationBean)context.getExternalContext().
|
NavigationBean navBean = (NavigationBean)context.getExternalContext().
|
||||||
getSessionMap().get("NavigationBean");
|
getSessionMap().get(NavigationBean.BEAN_NAME);
|
||||||
CIFSServer cifsServer = (CIFSServer)FacesContextUtils.getRequiredWebApplicationContext(
|
CIFSServer cifsServer = (CIFSServer)FacesContextUtils.getRequiredWebApplicationContext(
|
||||||
context).getBean("cifsServer");
|
context).getBean("cifsServer");
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user