|
@ -131,28 +131,28 @@ class AuditlogRule(models.Model): |
|
|
if getattr(rule, 'log_create') \ |
|
|
if getattr(rule, 'log_create') \ |
|
|
and not hasattr(model_model, check_attr): |
|
|
and not hasattr(model_model, check_attr): |
|
|
model_model._patch_method('create', rule._make_create()) |
|
|
model_model._patch_method('create', rule._make_create()) |
|
|
setattr(model_model, check_attr, True) |
|
|
|
|
|
|
|
|
setattr(type(model_model), check_attr, True) |
|
|
updated = True |
|
|
updated = True |
|
|
# -> read |
|
|
# -> read |
|
|
check_attr = 'auditlog_ruled_read' |
|
|
check_attr = 'auditlog_ruled_read' |
|
|
if getattr(rule, 'log_read') \ |
|
|
if getattr(rule, 'log_read') \ |
|
|
and not hasattr(model_model, check_attr): |
|
|
and not hasattr(model_model, check_attr): |
|
|
model_model._patch_method('read', rule._make_read()) |
|
|
model_model._patch_method('read', rule._make_read()) |
|
|
setattr(model_model, check_attr, True) |
|
|
|
|
|
|
|
|
setattr(type(model_model), check_attr, True) |
|
|
updated = True |
|
|
updated = True |
|
|
# -> write |
|
|
# -> write |
|
|
check_attr = 'auditlog_ruled_write' |
|
|
check_attr = 'auditlog_ruled_write' |
|
|
if getattr(rule, 'log_write') \ |
|
|
if getattr(rule, 'log_write') \ |
|
|
and not hasattr(model_model, check_attr): |
|
|
and not hasattr(model_model, check_attr): |
|
|
model_model._patch_method('write', rule._make_write()) |
|
|
model_model._patch_method('write', rule._make_write()) |
|
|
setattr(model_model, check_attr, True) |
|
|
|
|
|
|
|
|
setattr(type(model_model), check_attr, True) |
|
|
updated = True |
|
|
updated = True |
|
|
# -> unlink |
|
|
# -> unlink |
|
|
check_attr = 'auditlog_ruled_unlink' |
|
|
check_attr = 'auditlog_ruled_unlink' |
|
|
if getattr(rule, 'log_unlink') \ |
|
|
if getattr(rule, 'log_unlink') \ |
|
|
and not hasattr(model_model, check_attr): |
|
|
and not hasattr(model_model, check_attr): |
|
|
model_model._patch_method('unlink', rule._make_unlink()) |
|
|
model_model._patch_method('unlink', rule._make_unlink()) |
|
|
setattr(model_model, check_attr, True) |
|
|
|
|
|
|
|
|
setattr(type(model_model), check_attr, True) |
|
|
updated = True |
|
|
updated = True |
|
|
return updated |
|
|
return updated |
|
|
|
|
|
|
|
@ -166,6 +166,7 @@ class AuditlogRule(models.Model): |
|
|
if getattr(rule, 'log_%s' % method) and hasattr( |
|
|
if getattr(rule, 'log_%s' % method) and hasattr( |
|
|
getattr(model_model, method), 'origin'): |
|
|
getattr(model_model, method), 'origin'): |
|
|
model_model._revert_method(method) |
|
|
model_model._revert_method(method) |
|
|
|
|
|
delattr(type(model_model), 'auditlog_ruled_%s' % method) |
|
|
updated = True |
|
|
updated = True |
|
|
if updated: |
|
|
if updated: |
|
|
modules.registry.RegistryManager.signal_registry_change( |
|
|
modules.registry.RegistryManager.signal_registry_change( |
|
|