Fixes for AWC-1160 and AWC-1161

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5389 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2007-03-15 11:34:20 +00:00
parent 0ceb9065ea
commit bc055cc60e
2 changed files with 7 additions and 24 deletions

View File

@@ -49,7 +49,7 @@ public class CheckoutDocEvaluator implements ActionEvaluator
FacesContext.getCurrentInstance()).getDictionaryService();
return dd.isSubClass(node.getType(), ContentModel.TYPE_CONTENT) &&
((node.hasPermission(PermissionService.CHECK_OUT) &&
((node.hasPermission(PermissionService.CHECK_OUT) && node.hasPermission(PermissionService.CREATE_CHILDREN) &&
(node.isLocked() == false &&
node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false)));
}

View File

@@ -31,8 +31,6 @@ import javax.faces.context.ResponseWriter;
import javax.faces.el.ValueBinding;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.lock.LockService;
import org.alfresco.service.cmr.lock.LockStatus;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.web.app.Application;
@@ -117,9 +115,12 @@ public class UILockIcon extends SelfRenderingComponent
ref = (NodeRef)val;
if (nodeService.exists(ref) && nodeService.hasAspect(ref, ContentModel.ASPECT_LOCKABLE) == true)
{
LockStatus lockStatus = getLockService(context).getLockStatus(ref);
locked = (lockStatus == LockStatus.LOCKED || lockStatus == LockStatus.LOCK_OWNER);
lockedOwner = (lockStatus == LockStatus.LOCK_OWNER);
String lockerUser = (String)nodeService.getProperty(ref, ContentModel.PROP_LOCK_OWNER);
if (lockerUser != null)
{
locked = true;
lockedOwner = (lockerUser.equals(Application.getCurrentUser(context).getUserName()));
}
}
}
@@ -195,24 +196,6 @@ public class UILockIcon extends SelfRenderingComponent
return service;
}
/**
* Use Spring JSF integration to return the Lock Service bean instance
*
* @param context FacesContext
*
* @return Lock Service bean instance or throws exception if not found
*/
private static LockService getLockService(FacesContext context)
{
LockService service = Repository.getServiceRegistry(context).getLockService();
if (service == null)
{
throw new IllegalStateException("Unable to obtain LockService bean reference.");
}
return service;
}
// ------------------------------------------------------------------------------
// Strongly typed component property accessors