Add ability to require 2FA for specific roles (including Everybody) (#37701)

This commit is contained in:
Claire authored and GitHub committed 2026-02-11 14:34:09 +00:00
1 parent 3e1127d27b
commit dfe44bcaef
23 files changed
+184 -15

No files matched your search

+11
View File
@@ -47,6 +47,17 @@ RSpec.describe UserRole do
it { is_expected.to_not allow_value(100).for(:permissions).against(:permissions_as_keys).with_message(:own_role) }
it { is_expected.to_not allow_value(100).for(:position).with_message(:own_role) }
it { is_expected.to_not allow_value(true).for(:require_2fa).with_message(:own_role) }
end
context 'when current_account is changing their own role and is an admin' do
subject { Fabricate(:user_role, permissions: UserRole::FLAGS[:administrator]) }
let(:account) { Fabricate :account, user: Fabricate(:user, role: subject) }
it { is_expected.to_not allow_value(100).for(:permissions).against(:permissions_as_keys).with_message(:own_role) }
it { is_expected.to_not allow_value(100).for(:position).with_message(:own_role) }
it { is_expected.to allow_value(true).for(:require_2fa) }
end
end
end