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() {