Skip to content

Send email notification when PAT is revoked

Arpit Gogia requested to merge arpit-patch-371911 into master

What does this MR do and why?

Currently, revocation of a PAT happens silently. This patch adds an email notification to be triggered when a PAT is revoked.

Relevant discussion: #371911 (closed)

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

image

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Create a new personal access token.
  2. Revoke the access token by:
    1. Rails Console:
      user = User.find_by_username "<username>"
      token = PersonalAccessToken.find(<id>)
      token.revoked = false
      group = user.groups[0]
      service = PersonalAccessTokens::RevokeService.new(current_user = user, token: token, group: group)
      service.execute
    2. PAT API: Reference
  3. Check for notification email

Note: The token id can be found by running user.personal_access_token_ids in Rails console

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Arpit Gogia

Merge request reports