Skip to content

Commit

Permalink
[TASK] Use strict comparison in BackendUserRepository
Browse files Browse the repository at this point in the history
Since the demand object already uses strict types, it
is safe to use strict comparison when properties of the
demand object are used as operand.

Resolves: #98141
Releases: main
Change-Id: I6741c022f9d382416be6cab034d793fedfa35477
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/75441
Tested-by: core-ci <[email protected]>
Tested-by: Christian Kuhn <[email protected]>
Tested-by: Benni Mack <[email protected]>
Reviewed-by: Oliver Klee <[email protected]>
Reviewed-by: Christian Kuhn <[email protected]>
Reviewed-by: Benni Mack <[email protected]>
  • Loading branch information
derhansen authored and bmack committed Aug 17, 2022
1 parent ed9d222 commit f9fa86a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Classes/Domain/Repository/BackendUserRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,27 +77,27 @@ public function findDemanded(Demand $demand)
}
}
// Only display admin users
if ($demand->getUserType() == Demand::USERTYPE_ADMINONLY) {
if ($demand->getUserType() === Demand::USERTYPE_ADMINONLY) {
$constraints[] = $query->equals('admin', 1);
}
// Only display non-admin users
if ($demand->getUserType() == Demand::USERTYPE_USERONLY) {
if ($demand->getUserType() === Demand::USERTYPE_USERONLY) {
$constraints[] = $query->equals('admin', 0);
}
// Only display active users
if ($demand->getStatus() == Demand::STATUS_ACTIVE) {
if ($demand->getStatus() === Demand::STATUS_ACTIVE) {
$constraints[] = $query->equals('disable', 0);
}
// Only display in-active users
if ($demand->getStatus() == Demand::STATUS_INACTIVE) {
if ($demand->getStatus() === Demand::STATUS_INACTIVE) {
$constraints[] = $query->equals('disable', 1);
}
// Not logged in before
if ($demand->getLogins() == Demand::LOGIN_NONE) {
if ($demand->getLogins() === Demand::LOGIN_NONE) {
$constraints[] = $query->equals('lastlogin', 0);
}
// At least one login
if ($demand->getLogins() == Demand::LOGIN_SOME) {
if ($demand->getLogins() === Demand::LOGIN_SOME) {
$constraints[] = $query->logicalNot($query->equals('lastlogin', 0));
}
// In backend user group
Expand Down

0 comments on commit f9fa86a

Please sign in to comment.