commit ae9553ca1cdbf78877e9a9f1e8115dd927a317b0
parent b7cbca590c6fb2e35ba33fafdead37bf14672b0e
Author: Daniel GarcĂa <dani-garcia@users.noreply.github.com>
Date: Thu, 12 Jan 2023 19:16:16 +0100
Merge branch 'BlackDex-add-mfa-icon-to-orgs'
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/db/models/organization.rs b/src/db/models/organization.rs
@@ -2,7 +2,7 @@ use num_traits::FromPrimitive;
use serde_json::Value;
use std::cmp::Ordering;
-use super::{CollectionUser, GroupUser, OrgPolicy, OrgPolicyType, User};
+use super::{CollectionUser, GroupUser, OrgPolicy, OrgPolicyType, TwoFactor, User};
use crate::CONFIG;
db_object! {
@@ -365,6 +365,8 @@ impl UserOrganization {
self.status
};
+ let twofactor_enabled = !TwoFactor::find_by_user(&user.uuid, conn).await.is_empty();
+
json!({
"Id": self.uuid,
"UserId": self.user_uuid,
@@ -374,6 +376,7 @@ impl UserOrganization {
"Status": status,
"Type": self.atype,
"AccessAll": self.access_all,
+ "TwoFactorEnabled": twofactor_enabled,
"Object": "organizationUserUserDetails",
})