. 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
This commit is contained in:
Kevin Roast
2006-10-06 14:44:52 +00:00
parent 1ee6e16326
commit 96654d4dd4
4 changed files with 39 additions and 4 deletions

View File

@@ -148,6 +148,9 @@
<!-- View File details -->
<action id="file_details">
<permissions>
<permission allow="true">Read</permission>
</permissions>
<label-id>view_details</label-id>
<image>/images/icons/View_details.gif</image>
<action-listener>#{AVMBrowseBean.setupContentAction}</action-listener>
@@ -159,6 +162,9 @@
<!-- View Folder details -->
<action id="folder_details">
<permissions>
<permission allow="true">Read</permission>
</permissions>
<label-id>view_details</label-id>
<image>/images/icons/View_details.gif</image>
<action-listener>#{AVMBrowseBean.setupContentAction}</action-listener>

View File

@@ -67,7 +67,7 @@
<from-email-address>alfresco@alfresco.org</from-email-address>
<!-- WCM domain and port for virtualisation server -->
<wcm-domain>127-0-0-1.ipaddr.alfresco-software.com</wcm-domain>
<wcm-domain>127-0-0-1.ip.alfrescodemo.net</wcm-domain>
<wcm-port>8180</wcm-port>
</client>
</config>

View File

@@ -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<ChildAssociationRef> 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
*/

View File

@@ -76,9 +76,7 @@
</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>
<a:actionLink value="#{msg.import_website_content}" rendered="#{AVMBrowseBean.isManagerRole}" image="/images/icons/import_website.gif" padding="2" action="dialog:importContent" actionListener="#{ImportWebsiteDialog.start}" />
</td>
</tr>
</table>