cancel
Showing results for 
Search instead for 
Did you mean: 

Audit log when Document access is forbidden (User Cannot Read the Document)

Klyff_Harlley1
Champ on-the-rise
Champ on-the-rise

How to create a Audit Log (or even a History line of Document) in Nuxeo when a User that don't have permission to read the , but try to access with a permalink?

That are some way to do by extension point?

I know is possible to do by listening events on document. (https://doc.nuxeo.com/display/NXDOC/Audit#Audit-Event)

But dont exists any event like “no_access_granted_for_document” or some other way to do?

-I think the Access Check (hasPermission) happens before the Audit be available for. I'm wrong?

1 ACCEPTED ANSWER

Florent_Guillau
World-Class Innovator
World-Class Innovator

You're right, there's no event sent when permissions checks failed and access to a document is denied. So what you're trying to do is not currently possible without changing some code inside Nuxeo.

View answer in original post

6 REPLIES 6

Florent_Guillau
World-Class Innovator
World-Class Innovator

You're right, there's no event sent when permissions checks failed and access to a document is denied. So what you're trying to do is not currently possible without changing some code inside Nuxeo.

Klyff_Harlley1
Champ on-the-rise
Champ on-the-rise

Hi Florent.

Yes, I thought about it. So, I'll try doing it inside AbstractSession.java (hasPermission methods), for having the event fired and a simple contrib to handle that event. It's be a good way? What do you think?

Thanks!

It will mostly work but please be aware that there are a number of places where DocumentException is caught and ignored, so you'll get spurious logs. For instance CoreSession.getDocuments does this, or Nuxeo Drive. Maybe DefaultNuxeoExceptionHandler or a subclass, when calling ExceptionHelper.isSecurityError, would be a better location.

Note that if you modify Nuxeo code you're on your own for future upgrades, it's very likely that this area of the code will change in future releases.

Sounds Good! I think ExceptionHelper.isSecurityError should work.

Klyff_Harlley1
Champ on-the-rise
Champ on-the-rise

Yes, I know that.

Thank you very much Florent!