Add ability to require 2FA for specific roles (including Everybody) (#37701)
This commit is contained in:
1 parent
3e1127d27b
commit
dfe44bcaef
23 files changed
+184
-15
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user