Commit 63a26d47 authored by Vitali Tatarintev's avatar Vitali Tatarintev

Merge branch 'deprecate_expired_pat_email_notification' into 'master'

Remove expired_pat_email_notification feature flag

See merge request gitlab-org/gitlab!41166
parents 7f5519a8 5e408ae0
......@@ -8,8 +8,6 @@ module PersonalAccessTokens
feature_category :authentication_and_authorization
def perform(*args)
return unless Feature.enabled?(:expired_pat_email_notification)
notification_service = NotificationService.new
User.with_personal_access_tokens_expired_today.find_each do |user|
......
---
title: Remove expired_pat_email_notification feature flag
merge_request: 41166
author:
type: changed
......@@ -20,7 +20,6 @@ Personal access tokens expire on the date you define, at midnight UTC.
- GitLab runs a check at 01:00 AM UTC every day to identify personal access tokens that expire in under seven days. The owners of these tokens are notified by email.
- GitLab runs a check at 02:00 AM UTC every day to identify personal access tokens that expired on the current date. The owners of these tokens are notified by email.
To turn on the notification for expired personal access tokens in GitLab self-managed instances, ask a GitLab administrator to [enable it](#enable-or-disable-notification-for-expired-personal-access-token). **(CORE ONLY)**
- In GitLab Ultimate, administrators may [limit the lifetime of personal access tokens](../admin_area/settings/account_and_limit_settings.md#limiting-lifetime-of-personal-access-tokens).
- In GitLab Ultimate, administrators may [toggle enforcement of personal access token expiry](../admin_area/settings/account_and_limit_settings.md#optional-enforcement-of-personal-access-token-expiry).
......@@ -42,23 +41,6 @@ profile.
1. Save the personal access token somewhere safe. If you navigate away or refresh
your page, and you did not save the token, you must create a new one.
## Enable or disable notification for Expired personal access token **(CORE ONLY)**
[GitLab administrators with access to the GitLab Rails console](../../administration/feature_flags.md)
can enable it for your instance.
To enable it:
```ruby
Feature.enable(:expired_pat_email_notification)
```
To disable it:
```ruby
Feature.disable(:expired_pat_email_notification)
```
### Revoking a personal access token
At any time, you can revoke any personal access token by clicking the
......
......@@ -9,7 +9,6 @@ RSpec.describe PersonalAccessTokens::ExpiredNotificationWorker, type: :worker do
context 'when a token has expired' do
let(:expired_today) { create(:personal_access_token, expires_at: Date.current) }
context 'when feature is enabled' do
it 'uses notification service to send email to the user' do
expect_next_instance_of(NotificationService) do |notification_service|
expect(notification_service).to receive(:access_token_expired).with(expired_today.user)
......@@ -23,21 +22,6 @@ RSpec.describe PersonalAccessTokens::ExpiredNotificationWorker, type: :worker do
end
end
context 'when feature is disabled' do
before do
stub_feature_flags(expired_pat_email_notification: false)
end
it 'does not update notified column' do
expect { worker.perform }.not_to change { expired_today.reload.after_expiry_notification_delivered }
end
it 'does not trigger email' do
expect { worker.perform }.not_to change { ActionMailer::Base.deliveries.count }
end
end
end
shared_examples 'expiry notification is not required to be sent for the token' do
it do
expect_next_instance_of(NotificationService) do |notification_service|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment