I know this can be accomplished via hook_audit_log_it, but it seems like it would be a nice feature for audit_log_filter as well. Can we have the ability to allow logging of specific actions by entity? example, Since Audit log is such a hog on the DB when using db logging... I would like to limit logging to deletions only... I suspect that others out there would like to make this granular to content type as well, so I propose going ahead and adding an interface like that.

Comments

generalredneck created an issue. See original summary.

attiks’s picture

We can change the admin page to do this, can you upload a patch?

generalredneck’s picture

Version: 7.x-1.2 » 7.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new10.81 KB
new43.31 KB

Ok, I've got something...

I changed the administrative user internface to accomidate the data stricture a little better as the fieldsets were getting out of control, but you are welcome to adapt what i have however you want. I added some javascript to make the checkbox tree work out..

I removed the bundles variable because I just store everything in a tree now in the entity_type variable. Also I created and update hook to move data over and combine the two variables into the new format. Lastly, I updated the "log_it" hook to respond to the new format as well.

Let me know what you think.
screenshot

attiks’s picture

I had a quick look, it looks good, just wondering if we can do the same for other entities like users?

generalredneck’s picture

Ah I see what I did there... yeah... totally. This late night programming thing got me...

I have some logic in there that says "if it has <=1 bundle, just show the entity". I will have to work around that a bit or just take it out completely.

kmajzlik’s picture

This code should use new hook instead of hard defining view/edit/delete.
https://www.drupal.org/node/2636916

generalredneck’s picture

Will do. Thanks.

attiks’s picture

Status: Needs review » Needs work
generalredneck’s picture

Status: Needs work » Needs review
StatusFileSize
new10.76 KB

Ok So I removed the logic that tries to be smart about bundles and entities when there is only one bundle and just show everything anyway.

Example, User will only ever have 1 bundle, and probably the same with File... but I'm showing the bundle and the actions anyway. I think it's ok though, because if you click the "entity checkbox" it will select every bundle and action that belongs to it anyway, so usability it shouldn't suffer too much.

With that said I also added the options code per @karlos007 in #6 since it's been committed. Lastly, I changed it just a hair by calling ucwords on drupal_map_assoc so that the labels would be "nicer". Fixed some translation issues that may have occurred as well in the interface I created.

Rolled this patch against 564409242c9a72107e36b3ffb5363ae496f465f5

Status: Needs review » Needs work

The last submitted patch, 9: audit_log-add_actions_to_filter_module-2596565-9.patch, failed testing.

generalredneck’s picture

are you expecting us to write tests for our features now? or is this something D.O added? as it seems, seems there are no tests in the project.

attiks’s picture

Status: Needs work » Fixed

#11 Tests would be nice, but i committed it anyways

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

kmajzlik’s picture

Status: Closed (fixed) » Needs work

@generalredneck - please add comment in code for function audit_log_filter_update_7001().

  • attiks committed 049bdfe on 7.x-1.x authored by generalredneck
    Issue #2596565 by generalredneck, attiks: Setting for more granular...
attiks’s picture

Status: Needs work » Fixed

Comment to update function added

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.