From a223f603f95ad14d66226118b597bb1c97a1d1da Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Thu, 5 Nov 2020 13:21:19 +0100 Subject: [PATCH] Simplify the check if admin can change password based on encryption status Found by Psalm: ``` /home/runner/work/server/server/apps/settings/lib/Controller/UsersController.php:324:8:error - RedundantCondition: Type true for $isEncryptionModuleLoaded is never falsy ``` Signed-off-by: Morris Jobke --- apps/settings/lib/Controller/UsersController.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/settings/lib/Controller/UsersController.php b/apps/settings/lib/Controller/UsersController.php index b9d20f5c0d..cad21c5f3b 100644 --- a/apps/settings/lib/Controller/UsersController.php +++ b/apps/settings/lib/Controller/UsersController.php @@ -318,10 +318,8 @@ class UsersController extends Controller { $noUserSpecificEncryptionKeys = true; $isEncryptionModuleLoaded = false; } - - $canChangePassword = ($isEncryptionEnabled && $isEncryptionModuleLoaded && $noUserSpecificEncryptionKeys) - || (!$isEncryptionEnabled && !$isEncryptionModuleLoaded) - || (!$isEncryptionEnabled && $isEncryptionModuleLoaded && $noUserSpecificEncryptionKeys); + $canChangePassword = ($isEncryptionModuleLoaded && $noUserSpecificEncryptionKeys) + || (!$isEncryptionModuleLoaded && !$isEncryptionEnabled); return $canChangePassword; }