How to schedule Login Audit Report
Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com

How to schedule Login Audit Report

Important

The below wiki-page is outdated. This can be done via UI (from v5.2) please follow this wiki-page ('Scheduling Jobs' section) for instructions to do this via UI.



Login Audit Report job can be scheduled using the REST API.

Please refer document REST API Invoker to use the REST API invoker plugin in OpenSpecimen.

Steps to change the schedule of Login Audit Report:

           Resource URI: rest/ng/scheduled-jobs?query=Monthly Login Audit Report

  1.  Get the details of the report job by the GET request method.

  2. The output of will of the GET request will be in JSON format as shown below

    [ { "id": 11, "name": "Monthly Login Audit Report", "createdBy": { "id": 2, "firstName": "System", "lastName": null, "loginName": "$system", "domain": "openspecimen", "emailAddress": "$system", "instituteName": null, "admin": true, "instituteAdmin": false, "manageForms": false, "cpCount": 0, "creationDate": null }, "startDate": 1500540722000, "endDate": null, "scheduledHour": 0, "scheduledMinute": 40, "scheduledDayOfWeek": "SATURDAY", "scheduledDayOfMonth": null, "nextRunOn": 1514785200786, "activityStatus": "Active", "repeatSchedule": "WEEKLY", "type": "INTERNAL", "taskImplFqn": "com.krishagni.openspecimen.audit.service.impl.LoginAuditReportGenerator", "command": null, "recipients": [], "isActiveJob": true, "lastRunOn": null, "rtArgsProvided": false, "rtArgsHelpText": null } ]
  3. Below are the attributes which need to be sent in the request body:

  4. To set the desired schedule of the job, change the above fields in JSON  and use the PUT method request using resource URI: rest/ng/scheduled-jobs/{id of job} and send the changed JSON in the request body. 



Example:

Resource URL: http[s]://<host>:<port>/openspecimen/rest/ng/scheduled-jobs/{id}

URL

http[s]://<host>:<port>/openspecimen/rest/ng/scheduled-jobs/20

Method

PUT

Request

application/json

JSON

{ "id": 20, "name": "Daily Login Audit Report", "createdBy": { "id": 1, "type": "SUPER", "firstName": "System", "lastName": null, "loginName": "$system", "domain": "openspecimen", "emailAddress": "$system", "instituteName": null, "primarySite": null, "admin": true, "instituteAdmin": false, "manageForms": false, "cpCount": 0, "creationDate": null, "activityStatus": "Active" }, "startDate": 1576736725000, "endDate": null, "scheduledHour": 0, "scheduledMinute": 45, "scheduledDayOfWeek": null, "scheduledDayOfMonth": null, "hourlyInterval": 1, "minutelyInterval": 1, "nextRunOn": 1590952540274, "activityStatus": "Active", "repeatSchedule": "DAILY", "type": "INTERNAL", "taskImplFqn": "com.krishagni.openspecimen.audit.service.impl.LoginAuditReportGenerator", "command": null, "fixedArgs": null, "savedQuery": null, "runAs": null, "recipients": [ { "id": 5, "type": "NONE", "firstName": "Barney", "lastName": "Stinson", "loginName": "BarneyS", "domain": "openspecimen", "emailAddress": "Barney@Stinsons.com", "instituteName": "Biobank Institute", "primarySite": null, "admin": false, "instituteAdmin": false, "manageForms": false, "cpCount": 0, "creationDate": 1576780200000, "activityStatus": "Expired" } ], "sharedWith": [ { "id": 6, "type": "NONE", "firstName": "Barnabus", "lastName": "Stinson", "loginName": "Barnacle", "domain": "openspecimen", "emailAddress": "BarnabusStins@Stins.com", "instituteName": "Biobank Institute", "primarySite": null, "admin": false, "instituteAdmin": false, "manageForms": false, "cpCount": 0, "creationDate": 1576780200000, "activityStatus": "Locked" } ], "isActiveJob": true, "lastRunOn": 1588317031000, "rtArgsProvided": false, "rtArgsHelpText": null }

Note: This will edit the ‘Monthly Login Audit Report’ to ‘Daily Login Audit Report’ and will run daily at 00:45 (scheduledHour:scheduledMinute) hours.



Error cases :

Status code

Applies to 

Status messages

Status code

Applies to 

Status messages

200

All resources

Job has been updated successfully

400

All requests

Invalid parameters, e.g  duplicate institute name, blank institute name, etc

401

All requests

Authorization failed, the user doesn’t have authority

404

All requests

Job not found, institute with given details not present in the system

500

All requests

Internal server error, encountered server error while performing operations

               

     

                







Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com