Skip to content

Improve Higlight-MFA Module notice to specify the affected roles #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 9, 2025

Conversation

andrea-sdl
Copy link
Contributor

@andrea-sdl andrea-sdl commented Jun 6, 2025

Description

When using the default config, the Highlight MFA module will create a notice saying that there are users without MFA.
That was considered too broad and would not represent the actual config which is based on the administrators and editors who do not have MFA active.

In this PR we're introducing a change in the messaging so that whenever we're using the default config, we're exposing the fact that administrators and editors are the one affected by this notice.
At the same time if the module is set up to use a different set of roles, we will also support those by having a more generic yet less broad definition which uses the term "high privileges" to indicate that the affected users are relevant when managing the site.

CleanShot 2025-06-06 at 16 44 09@2x
CleanShot 2025-06-06 at 16 44 26@2x

Pre-review checklist

Please make sure the items below have been covered before requesting a review:

  • This change works and has been tested locally or in Codespaces (or has an appropriate fallback).
  • This change has relevant unit tests (if applicable).
  • This change has relevant documentation additions / updates (if applicable).
  • I've created a changelog description that aligns with the provided examples.

Pre-deploy checklist

  • VIP staff: Ensure any alerts added/updated conform to internal standards (see internal documentation).

Steps to Test

  1. Check out PR.
  2. Go to wp-admin > Users list and check the two new messages, click on the filter link and check that the message is consistent.

@andrea-sdl andrea-sdl requested review from Copilot and a team June 6, 2025 14:58
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refines the Highlight MFA module's notice messaging to explicitly reference affected high-privilege roles, either “Administrator or Editor” for the default configuration or a customizable set of roles. The changes include updating translation strings in the PHPUnit tests and refactoring the module's logic by introducing a default role constant and helper methods for generating the notice messages.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/phpunit/test-highlight-mfa-users.php Updates to translation strings and tests to support role-specific notices.
modules/highlight-mfa-users/class-highlight-mfa-users.php Refactored default role configuration and message generation logic.

@andrea-sdl andrea-sdl changed the title Improve Higligh-MFA Module notice to specify the affected roles Improve Higlight-MFA Module notice to specify the affected roles Jun 6, 2025
@daniel-ayvar daniel-ayvar self-assigned this Jun 6, 2025
$notice_message_text = '';
if ( $is_default_config ) {
$notice_message_text = sprintf(
/* Translators: %d is the number of users with Administrator or Editor roles and 2FA disabled. */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: Indentation looks off here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brunobasto Agree. I wonder why it wasn't caught by the linting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed indentation in cf48a0d

Copy link
Contributor

@brunobasto brunobasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and looks good! Thank you for the quick fix!

@andrea-sdl andrea-sdl added this pull request to the merge queue Jun 9, 2025
Merged via the queue into production with commit c8c9488 Jun 9, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants