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

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?

0 votes

1 answers

787 views

ANSWER



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
            }
1 votes



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

Indeed! Updated
06/21/2020