Skip to content
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

Implement logging for user actions #605

Merged
merged 13 commits into from
Sep 27, 2024
Merged

Implement logging for user actions #605

merged 13 commits into from
Sep 27, 2024

Conversation

jayjaybunce
Copy link
Collaborator

@jayjaybunce jayjaybunce commented Sep 10, 2024

🗣 Description

  • Adds logging to several backend routes via Homebrew Logger class to allow traceback of user activities: adding user to an organization, inviting a user, removing a user or updating a user.

💭 Motivation and context

Resolves CRASM-569

🧪 Testing

  1. Create temporary table for the log record
    sql CREATE TABLE public.log ( "id" SERIAL PRIMARY KEY, "payload" json NOT NULL, "createdAt" timestamptz NOT NULL DEFAULT now(), "eventType" varchar NOT NULL, "result" varchar NOT NULL );
  2. Invite a user and assign them to an organization
  3. Deny a user's request
  4. Approve a user's request
  5. View User Logs by going to Admin Tools => Select the User Logs tab

Filters implemented:

  1. Result => Either 'success' or 'fail'
  2. Payload => JSON object you can search with this format: createdUserPayload.id: a23das12312n-asda912-asd
  3. Timestamp
  4. EventType

✅ Pre-approval checklist

  • This PR has an informative and human-readable title.
  • Changes are limited to a single goal - eschew scope creep!
  • All future TODOs are captured in issues, which are referenced
    in code comments.
  • All relevant type-of-change labels have been added.
  • I have read the CONTRIBUTING document.
  • These code changes follow cisagov code standards.
  • All relevant repo and/or project documentation has been updated
    to reflect the changes in this PR.
  • Tests have been added and/or modified to cover the changes in this PR.
  • All new and existing tests pass.

✅ Pre-merge checklist

  • Revert dependencies to default branches.
  • Finalize version.

✅ Post-merge checklist

  • Create a release.

backend/src/api/logs.ts Fixed Show fixed Hide fixed
@jayjaybunce jayjaybunce marked this pull request as ready for review September 26, 2024 18:36
@jayjaybunce jayjaybunce changed the title [DNM] - Logging Implementation Implement logging for user actions Sep 26, 2024
@ameliav ameliav self-requested a review September 27, 2024 16:14
Copy link
Contributor

@ameliav ameliav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me after adding the log table :)

image

@schmelz21 schmelz21 merged commit c82ff3b into develop Sep 27, 2024
18 of 22 checks passed
@schmelz21 schmelz21 deleted the implement-logging branch September 27, 2024 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants