Commit 5e408ae0 authored by Aishwarya Subramanian's avatar Aishwarya Subramanian Committed by drew cimino

Remove expired_pat_email_notification feature flag

The flag was introduced in 13.3 and has been stable
for a release.
parent 4af7218d
...@@ -8,8 +8,6 @@ module PersonalAccessTokens ...@@ -8,8 +8,6 @@ module PersonalAccessTokens
feature_category :authentication_and_authorization feature_category :authentication_and_authorization
def perform(*args) def perform(*args)
return unless Feature.enabled?(:expired_pat_email_notification)
notification_service = NotificationService.new notification_service = NotificationService.new
User.with_personal_access_tokens_expired_today.find_each do |user| 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. ...@@ -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 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. - 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 [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). - 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. ...@@ -42,23 +41,6 @@ profile.
1. Save the personal access token somewhere safe. If you navigate away or refresh 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. 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 ### Revoking a personal access token
At any time, you can revoke any personal access token by clicking the At any time, you can revoke any personal access token by clicking the
......
...@@ -9,32 +9,16 @@ RSpec.describe PersonalAccessTokens::ExpiredNotificationWorker, type: :worker do ...@@ -9,32 +9,16 @@ RSpec.describe PersonalAccessTokens::ExpiredNotificationWorker, type: :worker do
context 'when a token has expired' do context 'when a token has expired' do
let(:expired_today) { create(:personal_access_token, expires_at: Date.current) } 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
it 'uses notification service to send email to the user' do expect_next_instance_of(NotificationService) do |notification_service|
expect_next_instance_of(NotificationService) do |notification_service| expect(notification_service).to receive(:access_token_expired).with(expired_today.user)
expect(notification_service).to receive(:access_token_expired).with(expired_today.user)
end
worker.perform
end end
it 'updates notified column' do worker.perform
expect { worker.perform }.to change { expired_today.reload.after_expiry_notification_delivered }.from(false).to(true)
end
end end
context 'when feature is disabled' do it 'updates notified column' do
before do expect { worker.perform }.to change { expired_today.reload.after_expiry_notification_delivered }.from(false).to(true)
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
end end
......
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