AWC-458; new collaborator role and new checkin permission check

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2380 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2006-02-15 08:41:57 +00:00
parent 9079ce1aac
commit 9b8466cad7
2 changed files with 29 additions and 2 deletions

View File

@@ -191,6 +191,7 @@ Administrator=Administrator
Guest=Guest
Read=Guest
Coordinator=Coordinator
Collaborator=Collaborator
Contributor=Contributor
Editor=Editor
All=All

View File

@@ -741,8 +741,34 @@ public class BrowseBean implements IContextListener
};
public NodePropertyResolver resolverCheckIn = new NodePropertyResolver() {
public Object get(Node node) {
return node.hasAspect(ContentModel.ASPECT_WORKING_COPY) && node.hasPermission(PermissionService.CHECK_IN);
public Object get(Node node)
{
boolean canCheckin = false;
// if the working copy has a discussion the user will also need to have
// contributor permission on the locked node
if (node.hasAspect(ContentModel.ASPECT_WORKING_COPY))
{
if (node.hasAspect(ForumModel.ASPECT_DISCUSSABLE))
{
// get the original locked node (via the copiedfrom aspect)
NodeRef lockedNodeRef = (NodeRef)nodeService.getProperty(node.getNodeRef(), ContentModel.PROP_COPY_REFERENCE);
if (lockedNodeRef != null)
{
Node lockedNode = new Node(lockedNodeRef);
canCheckin = node.hasPermission(PermissionService.CHECK_IN) &&
lockedNode.hasPermission(PermissionService.CONTRIBUTOR);
}
}
else
{
// there is no discussion so just check they have checkin permission
// for the node
canCheckin = node.hasPermission(PermissionService.CHECK_IN);
}
}
return canCheckin;
}
};