summaryrefslogtreecommitdiff
path: root/app/models/user.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-04-20 12:25:22 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-05-10 13:02:56 +0300
commit61e9a3dcc4d8d33ab2a5c2773acfce03db08a039 (patch)
treedd76390fdad5e0b3a97b97c3f083b3cc185dc0fd /app/models/user.rb
parent533593e95cd3a922a2ec2ea43b345862361dfd67 (diff)
downloadgitlab-ce-61e9a3dcc4d8d33ab2a5c2773acfce03db08a039.tar.gz
Add 2FA filter to group members page
* Show 2fa badge on a group members page * Make group members page UI consistent with project members page * Fix ambiguous sql in User.with/without_two_factor methods Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index a9cfd39f604..d74d5aade5a 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -237,14 +237,18 @@ class User < ActiveRecord::Base
scope :order_recent_sign_in, -> { reorder(Gitlab::Database.nulls_last_order('current_sign_in_at', 'DESC')) }
scope :order_oldest_sign_in, -> { reorder(Gitlab::Database.nulls_last_order('current_sign_in_at', 'ASC')) }
- def self.with_two_factor
+ def self.with_two_factor_indistinct
joins("LEFT OUTER JOIN u2f_registrations AS u2f ON u2f.user_id = users.id")
- .where("u2f.id IS NOT NULL OR otp_required_for_login = ?", true).distinct(arel_table[:id])
+ .where("u2f.id IS NOT NULL OR users.otp_required_for_login = ?", true)
+ end
+
+ def self.with_two_factor
+ with_two_factor_indistinct.distinct(arel_table[:id])
end
def self.without_two_factor
joins("LEFT OUTER JOIN u2f_registrations AS u2f ON u2f.user_id = users.id")
- .where("u2f.id IS NULL AND otp_required_for_login = ?", false)
+ .where("u2f.id IS NULL AND users.otp_required_for_login = ?", false)
end
#