Send email notification when PAT is revoked
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.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Create a new personal access token.
- Revoke the access token by:
- 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
- PAT API: Reference
- Rails Console:
- 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.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Arpit Gogia