Handler for logging user operations


#1

Hi guys! I’m camunda newbie and I hope you can help me a little. My problem is that i want save logs from user operations. Like for example: creating, edit, delete new users or groups by another user.
I tried to extend HistoryEventHandler (https://docs.camunda.org/manual/7.5/user-guide/process-engine/history/#user-operation-log) and i can catch process events but not events from admin panel. Is there some solution for my problem? Thanks in advance. :slight_smile:


#2

Hi @milunas,

User/group changes are not forwarded as history events to history handlers. I doubt there is a straightforward solution to this. Here’s the rough way how to build this with internal API:

  1. Subclass org.camunda.bpm.engine.impl.identity.db.DbIdentityServiceProvider
  2. Override methods like #saveUser and do your thing
  3. Plug the custom identity service provider into the engine by setting the configuration property identityProviderSessionFactory to instance of org.camunda.bpm.engine.impl.persistence.GenericManagerFactory like here for the default factory: https://github.com/camunda/camunda-bpm-platform/blob/7.10.0-alpha5/engine/src/main/java/org/camunda/bpm/engine/impl/cfg/ProcessEngineConfigurationImpl.java#L1443

Cheers,
Thorben


#3

Hi! Thank you for answer. Its great idea and it looks like it’s workings. But in meantime i tried extend this:
https://docs.camunda.org/manual/7.7/user-guide/process-engine/authorization-service/
and this:

I extended authorization service but couldnt inject this in Process Engine Configuration.
And with second option - i dont know how to configure angularjs :slight_smile:

But the second option definetly have potential, i can filter requests and log a lot informations, so i want to try this.
I will report my successes and failures. :stuck_out_tongue: