cancel
Showing results for 
Search instead for 
Did you mean: 

Lock/unlock a file

anshu_kumar
Star Contributor
Star Contributor

Hi,

I am using ADF 2.3.0 and ACS 5.2.1 and using built-in lock handler in content actions like below

<content-action
title="{{'DOCUMENT_LIST.ACTIONS.DOCUMENT.LOCK' | translate}}"
[icon]="'lock'"
[target]="'document'"
[handler]="'lock'">
</content-action>

In Release Note 2.3.0, it is mentioned "you can lock or unlock a file". However, when a file is locked, I don't see any option to unlock it. How does it work?

3 REPLIES 3

eugenio_romano
Elite Collaborator
Elite Collaborator

If you reopen the lock dialog and  click on the checkbox the file is unlock 

Hi Eugenio,

Since there is a handler available for lock/unlock functionality, I added few other properties and events of content actions to it.

<content-action
title="{{'DOCUMENT_LIST.ACTIONS.DOCUMENT.LOCK' | translate}}"
[icon]="'lock'"
[target]="'document'"
[handler]="'lock'"
[permission]="'update'"
[disableWithNoPermission]="true"
(permissionEvent)="onLockActionPermissionError($event)"
(success)="onLockActionSuccess($event)">
</content-action>

The (permissionEvent) and (success) events does not seems to work. I added these so I could show a pop-up on permission failure and reload the document list respectively. Ideally, Lock action should be made available to the owner only. I am sure Alfresco has plans to enhance the feature in coming releases. In the meantime, we were looking for a workaround to work best for our client.

Hi, note that the success action works only: 

Emitted when the action succeeds with the success string message. Applies to copy, move and delete actions.

So it is not goign to work with the unlock or lock. This is the link to the documentation:

alfresco-ng2-components/content-action.component.md at afa298060a62b57c0fde1e5606f02f67d29b20a3 · Al... 

If there is an error about the permissionEvent you can open a bug on the  GitHub repository explaining how to reproduce the problem

Thanks