Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between cm:workingCopyOwner and cm:lockOwner

When I trace code in alfresce, I found following code in node-header.get.html.ftl

<#if item.workingCopy??>
    <#if item.workingCopy.isWorkingCopy??>
        <#assign lockUser = node.properties["cm:workingCopyOwner"]>
    <#else>
        <#assign lockUser = node.properties["cm:lockOwner"]>
    </#if>
......
<#elseif>

My understanding is

When a user click "Edit Offline", working copy of document is created and workingCopyOwner is same as lockOwner.

If so, why do we need to write like this? Is my understanding wrong???

like image 797
swemon Avatar asked Feb 17 '23 21:02

swemon


2 Answers

The property cm:workingCopyOwner belongs to the aspect cm:workingCopy and cm:lockOwner belongs to cm:lockable.

When you click "Edit offline" a copy of the node is created and assigned the aspect cm:workingCopy, cm:workingCopyOwner is set to your user. The original node is assigned the aspect cm:lockable and this one gets the property cm:lockOwner. So yes, the two properties get the same user, but those are assigned on different nodes.

/Erik

like image 163
billerby Avatar answered Mar 12 '23 15:03

billerby


Next to what already explained by @billerby, the main difference is that a node can be locked without having been checked out (e.g. by explicit locking calls), while it can't happen that a document is checked out BUT not locked.

Thus, cm:workingCopy and cm:lockable capture two different, albeit somehow related, lifecycle phases of a document, and the use of the respective properties to declare the lock ownership is simply made consistent when checking out documents.

like image 34
skuro Avatar answered Mar 12 '23 15:03

skuro