cancel
Showing results for 
Search instead for 
Did you mean: 

How to disable document's link generated by Nuxeo after document gets trashed?

Ankush_Bandil
Confirmed Champ
Confirmed Champ

I have uploaded a document in Nuxeo and got a link. I can download my document accessing that link. Now, I trashed my document and got "isTrashed": true as well but still I can download my document using the link which is generated by Nuxeo. Is there any way by which I can restrict access to that URL after a document is trashed?

3 REPLIES 3

Gregory_Carlin
Elite Collaborator
Elite Collaborator

Hello,

Settting a document to trash only update the ecm:isTrashed propertty value but doesn't have an impact on the URL. This allows you to easily untrash a documentt (and consequenttly, not ot regenerate an URL). For this use case, it probably needs to implement a custom secutiry policy (https://doc.nuxeo.com/nxdoc/security-policy-service/ ).

With something like this in your checkPermission method:

Boolean isTrashed = Optional.ofNullable((Boolean) doc.getValue("ecm:isTrashed"))
                    .orElse(Boolean.FALSE);
            if (isTrashed) {
                return Access.DENY;
            }
	     else {
		 return Access.UNKNOWN
            }

	

Hi. I think you wanted to put "isConfidential" in the "if" condition; or to call the Boolean "isTrashed"! Regards.

Indeed! Updated