From 96654d4dd4fe10c8cbb1ddc81cb54ac2fc1d0241 Mon Sep 17 00:00:00 2001 From: Kevin Roast Date: Fri, 6 Oct 2006 14:44:52 +0000 Subject: [PATCH] . Added permission evaluators to View File/Folder Details actions . Import Website Content now only accessable by Content Manger role users git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4050 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../web-client-config-wcm-actions.xml | 6 ++++ config/alfresco/web-client-config.xml | 2 +- .../alfresco/web/bean/wcm/AVMBrowseBean.java | 31 +++++++++++++++++++ source/web/jsp/wcm/browse-website.jsp | 4 +-- 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/config/alfresco/web-client-config-wcm-actions.xml b/config/alfresco/web-client-config-wcm-actions.xml index e2b1dc754b..89738a5fdf 100644 --- a/config/alfresco/web-client-config-wcm-actions.xml +++ b/config/alfresco/web-client-config-wcm-actions.xml @@ -148,6 +148,9 @@ + + Read + view_details /images/icons/View_details.gif #{AVMBrowseBean.setupContentAction} @@ -159,6 +162,9 @@ + + Read + view_details /images/icons/View_details.gif #{AVMBrowseBean.setupContentAction} diff --git a/config/alfresco/web-client-config.xml b/config/alfresco/web-client-config.xml index 888ad45e14..9e5ffd48c4 100644 --- a/config/alfresco/web-client-config.xml +++ b/config/alfresco/web-client-config.xml @@ -67,7 +67,7 @@ alfresco@alfresco.org - 127-0-0-1.ipaddr.alfresco-software.com + 127-0-0-1.ip.alfrescodemo.net 8180 diff --git a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java index 81a06ebbdc..c5892ee48d 100644 --- a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java +++ b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java @@ -39,11 +39,13 @@ import org.alfresco.service.cmr.avm.AVMNodeDescriptor; import org.alfresco.service.cmr.avm.AVMService; import org.alfresco.service.cmr.avm.AVMStoreDescriptor; import org.alfresco.service.cmr.dictionary.DictionaryService; +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.search.SearchService; import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; +import org.alfresco.service.namespace.RegexQNamePattern; import org.alfresco.web.app.Application; import org.alfresco.web.app.context.IContextListener; import org.alfresco.web.app.context.UIContextService; @@ -86,6 +88,9 @@ public class AVMBrowseBean implements IContextListener /** Action bean Id for the AVM Submit action*/ private static final String ACTION_AVM_SUBMIT = "simple-avm-submit"; + /** Content Manager role name */ + private static final String ROLE_CONTENT_MANAGER = "ContentManager"; + private String sandbox; private String username; private String sandboxTitle = null; @@ -468,6 +473,32 @@ public class AVMBrowseBean implements IContextListener UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans(); } + /** + * @return true if the current user has the manager role in the current website + */ + public boolean getIsManagerRole() + { + boolean isManager = false; + + String currentUser = Application.getCurrentUser(FacesContext.getCurrentInstance()).getUserName(); + Node websiteNode = this.navigator.getCurrentNode(); + List userInfoRefs = this.nodeService.getChildAssocs( + websiteNode.getNodeRef(), ContentModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL); + for (ChildAssociationRef ref : userInfoRefs) + { + NodeRef userInfoRef = ref.getChildRef(); + String username = (String)nodeService.getProperty(userInfoRef, ContentModel.PROP_WEBUSERNAME); + String userrole = (String)nodeService.getProperty(userInfoRef, ContentModel.PROP_WEBUSERROLE); + if (currentUser.equals(username) && ROLE_CONTENT_MANAGER.equals(userrole)) + { + isManager = true; + break; + } + } + + return isManager; + } + /** * @return the AVMNode that represents the current browsing path */ diff --git a/source/web/jsp/wcm/browse-website.jsp b/source/web/jsp/wcm/browse-website.jsp index a173b1c4e5..fe83033cbc 100644 --- a/source/web/jsp/wcm/browse-website.jsp +++ b/source/web/jsp/wcm/browse-website.jsp @@ -76,9 +76,7 @@ <%-- Import website content action --%> - - - +