enonic / xp

Enonic XP
https://enonic.com
GNU General Public License v3.0
201 stars 34 forks source link

Audit Log Usage - Content API - Improvement Batch 1 #7616

Closed GlennRicaud closed 4 years ago

GlennRicaud commented 4 years ago

The purpose of the Content API audit logging has changed:

Actions:

Example before:

{
  //...
  "type": "system.content.publish",
  "time": "2019-11-08T13:44:51.557064Z",
  "source": "com.enonic.xp.core-content",
  "user": "user:system:su",
  "message": "Publish the content [251e6b26-5d9d-4337-981c-bc440e4076aa]",
  "objects": "com.enonic.cms.default:draft:251e6b26-5d9d-4337-981c-bc440e4076aa",
  "data": {
    "contentIds": "251e6b26-5d9d-4337-981c-bc440e4076aa",
    "excludeChildrenIds": "251e6b26-5d9d-4337-981c-bc440e4076aa",
    "target": "master",
    "includeDependencies": true
  }
}

Same example after:

{
  //...
  "type": "system.content.publish",
  "time": "2019-11-08T13:44:51.557064Z",
  "source": "com.enonic.xp.core-content",
  "user": "user:system:su",
  "message": "Published the content [251e6b26-5d9d-4337-981c-bc440e4076aa]",
  "objects": ["com.enonic.cms.default:draft:251e6b26-5d9d-4337-981c-bc440e4076aa", "com.enonic.cms.default:draft:64f66a5c-b933-410c-a24c-a1192b4a0c49", "com.enonic.cms.default:draft:45939e50-afb5-4f02-9fee-66489c74475e"],
  "data": {
    "params" {
      "contentIds": "251e6b26-5d9d-4337-981c-bc440e4076aa",
      "excludeChildrenIds": "251e6b26-5d9d-4337-981c-bc440e4076aa",
      "target": "master",
      "includeDependencies": true
    },
    "result": {
      pushedContents: ["251e6b26-5d9d-4337-981c-bc440e4076aa", "64f66a5c-b933-410c-a24c-a1192b4a0c49"],
      deletedContents: ["45939e50-afb5-4f02-9fee-66489c74475e"],
      failedContents: []
    }    
  }
}
GlennRicaud commented 4 years ago

Messages template:

Message If ids.length > 1
Created a new site  
Created a new content  
Created a new media  
Updated the content [%s]  
Updated the media [%s]  
Deleted the content [%s]  
Undone the deletion of the content [%s] Undone the deletion of %d contents
Published the content [%s] Published %d contents
Unpublished the content [%s] Unpublished %d contents
Duplicated the content [%s]  
Moved the content [%s] under parent with path [%s]  
Renamed the content [%s]  
Set active the content version [%s][%s]  
Set the child order for the content [%s]  
Reordered the children of the content [%s]  
Applied permissions for the content [%s]  
Reprocessed the content [%s]  
sigdestad commented 4 years ago

I'm thinking maybe we can drop message alltogether? A client can create relevant message itself?

GlennRicaud commented 4 years ago

Well I was already against and that was exactly my point when we designed AuditLog. But you wanted a message in addition. I let you decide.

sigdestad commented 4 years ago

Ok then, let's drop the message part :)