From f08babfa8aef29fe840f8dbbf7836e92c87b6443 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 17 Jan 2023 17:22:03 -0800 Subject: [PATCH] Just moved some stuff around - no actual meaningful code changes Signed-off-by: snipe --- app/Models/User.php | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/app/Models/User.php b/app/Models/User.php index c3f7f80b94..399008430b 100755 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -586,6 +586,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo if ((Setting::getSettings()->two_factor_enabled == '1') && ($this->two_factor_optin == '1')) { return true; } + // If the 2FA is required for everyone so is implicitly active elseif (Setting::getSettings()->two_factor_enabled == '2') { return true; @@ -594,18 +595,6 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo return false; } - /** - * Get the admin user who created this user - * - * @author [A. Gianotto] [] - * @since [v6.0.5] - * @return \Illuminate\Database\Eloquent\Relations\Relation - */ - public function createdBy() - { - return $this->belongsTo(\App\Models\User::class, 'created_by')->withTrashed(); - } - /** * Check whether two-factor authorization is required and the user has activated it * and enrolled a device @@ -634,6 +623,19 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo } + /** + * Get the admin user who created this user + * + * @author [A. Gianotto] [] + * @since [v6.0.5] + * @return \Illuminate\Database\Eloquent\Relations\Relation + */ + public function createdBy() + { + return $this->belongsTo(\App\Models\User::class, 'created_by')->withTrashed(); + } + + public function decodePermissions() {