Uploaded image for project: 'Service Packs and Hot Fixes'
  1. Service Packs and Hot Fixes
  2. MNT-7152

service/api/audit/clear/ webscript not working properly if auditFromTime parameter is null

    Details

    • Type: Service Pack Request
    • Status: Closed (View Workflow)
    • Resolution: Fixed
    • Affects Version/s: 3.4.2, 3.4.3
    • Fix Version/s: 4.0
    • Component/s: Auditing
    • Labels:
      None
    • Bug Priority:
      Category 3
    • ACT Numbers:

      15024-32624

      Description

      [ Steps to reproduce]
      1. Make sure to have some audit applications entries
      2. Check the number of entries for a certain audit application
      3. Use the webscript to clear the entries of that application using a null fromTime parameter
      E.g.
      curl -u admin:admin -d "fromTime=&toTime=" http://localhost:8080/alfresco/service/api/audit/clear/AuditExampleLogin1
      [ Actual Result]
      All the entries of all the applications are deleted
      [ Expected Result]
      All the entries of the specified applicacion should be deleted
      [ Notes ]
      Checked on Alfresco 3.4.2 and 3.4.3
      audit-common-SqlMap.xml -->

      <delete id="delete_AuditEntries" parameterClass="AuditDeleteParameters">
      delete
      from
      alf_audit_entry
      <dynamic prepend="where">
      <isNotNull property="auditFromTime" prepend="and">
      audit_app_id = #auditApplicationId#
      </isNotNull>
      <isNotNull property="auditFromTime" prepend="and">
      <![CDATAaudit_time >= #auditFromTime#]>
      </isNotNull>
      <isNotNull property="auditFromTime" prepend="and">
      <![CDATAaudit_time < #auditToTime#]>
      </isNotNull>
      <isNotNull property="auditEntryIds" prepend="and">
      id in <iterate property="auditEntryIds" open="(" close=")" conjunction=", ">#auditEntryIds[]#</iterate>
      </isNotNull>
      </dynamic>
      </delete>

      The first and the third isNotNull controls don't seems to be correct -->

      <delete id="delete_AuditEntries" parameterClass="AuditDeleteParameters">
      delete
      from
      alf_audit_entry
      <dynamic prepend="where">
      <isNotNull property="auditApplicationId" prepend="and">
      audit_app_id = #auditApplicationId#
      </isNotNull>
      <isNotNull property="auditFromTime" prepend="and">
      <![CDATAaudit_time >= #auditFromTime#]>
      </isNotNull>
      <isNotNull property="auditToTime" prepend="and">
      <![CDATAaudit_time < #auditToTime#]>
      </isNotNull>
      <isNotNull property="auditEntryIds" prepend="and">
      id in <iterate property="auditEntryIds" open="(" close=")" conjunction=", ">#auditEntryIds[]#</iterate>
      </isNotNull>
      </dynamic>
      </delete>

      Workaround: using not null fromTime parameter, for istance url -u admin:admin -d "fromTime=0&toTime=" http://localhost:8080/alfresco/service/api/audit/clear/AuditExampleLogin1

        Attachments

          Structure

            Activity

              People

              • Assignee:
                closedbugs Closed Bugs
                Reporter:
                mmancuso Marco Mancuso [X] (Inactive)
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Structure Helper Panel