fix(admincenter): admincenter_users_admins_reduced_license_footprint logic (#7779)

Co-authored-by: Andoni A. <14891798+andoniaf@users.noreply.github.com>
This commit is contained in:
Hugo Pereira Brito
2025-05-21 12:46:35 +02:00
committed by GitHub
parent 118f3d163d
commit 6e184dae93
3 changed files with 4 additions and 3 deletions
+1
View File
@@ -14,6 +14,7 @@ All notable changes to the **Prowler SDK** are documented in this file.
### Fixed
- Fix `m365_powershell test_credentials` to use sanitized credentials. [(#7761)](https://github.com/prowler-cloud/prowler/pull/7761)
- Fix `admincenter_users_admins_reduced_license_footprint` check logic to pass when admin user has no license. [(#7779)](https://github.com/prowler-cloud/prowler/pull/7779)
---
@@ -21,7 +21,7 @@ class admincenter_users_admins_reduced_license_footprint(Check):
"""Execute the check for users with administrative roles and their licenses.
This method iterates over all users and checks if those with administrative roles
have an allowed license. If a user has a valid license (AAD_PREMIUM or AAD_PREMIUM_P2),
have an allowed license. If a user has a valid license (AAD_PREMIUM or AAD_PREMIUM_P2) or no license,
the check passes; otherwise, it fails.
Returns:
@@ -45,7 +45,7 @@ class admincenter_users_admins_reduced_license_footprint(Check):
resource_name=user.name,
resource_id=user.id,
)
report.status = "FAIL"
report.status = "PASS"
report.status_extended = f"User {user.name} has administrative roles {admin_roles} and does not have a license."
if user.license:
@@ -210,7 +210,7 @@ class Test_admincenter_users_admins_reduced_license_footprint:
check = admincenter_users_admins_reduced_license_footprint()
result = check.execute()
assert len(result) == 1
assert result[0].status == "FAIL"
assert result[0].status == "PASS"
assert (
result[0].status_extended
== "User User1 has administrative roles Global Administrator and does not have a license."