-
Notifications
You must be signed in to change notification settings - Fork 26
Added create audit log test in printer.js #1869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
54b0782 to
330defb
Compare
api/main_endpoints/routes/Printer.js
Outdated
| const { totalChunks, chunkIdx } = req.body; | ||
| const details = { | ||
| copies: parseInt(copies), | ||
| sides: sides, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| sides: sides, | |
| sides, |
when key = value we only need to write it once
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
api/main_endpoints/routes/Printer.js
Outdated
| router.post('/sendPrintRequest', upload.single('chunk'), async (req, res) => { | ||
| let totalFileSize = 0; | ||
| const { copies, sides, id } = req.body; | ||
| const action = AuditLogActions.PRINT_PAGE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's just remove this and specify what the AuditLog action is when we create the AuditLog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
| if (!PRINTING.ENABLED) { | ||
| details.status = 'mocked'; | ||
| // create audit log on print | ||
| await createAuditLog({ | ||
| user, | ||
| action, | ||
| details | ||
| }); | ||
| logger.warn('Printing is disabled, returning 200 to mock the printing server'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this creating an audit log when we're running Clark on local? if so, i don't think we need this, we can find a way to write unit tests around this specific case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! This block is removed.
| } else { | ||
| return { | ||
| status: SERVER_ERROR, | ||
| error: 'Failed to create audit log in cleezyHelpers' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we only using this for cleezy? if not then we should change this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch! My poor copy and paste mistakes!
Done! Removed the helper for now and waiting for the Audit team's idea!
| } | ||
|
|
||
| }; | ||
| module.exports = { createAuditLog }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we are creating a helper function to create Audit logs, we need to notify the Audit Log team so that this can be used everywhere Audit Logs are being created across Clark
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Removed the helper for now and waiting for the Audit team's idea!
7046dc5 to
8bb4568
Compare
…Clean up all test data after completing User.js and ShortcutSearch.js tests.
Co-authored-by: adarsh <[email protected]>
…g and skip the test if config/json.PRINTING is false.
8bb4568 to
d539165
Compare
This PR is in sync with PR # https://github.com/pxtrickhoxng/Clark/commits/audit-on-print/
Screenshot:
