moodle-tool_mfa icon indicating copy to clipboard operation
moodle-tool_mfa copied to clipboard

Plugin set up page broken if one of the configured roles is deleted

Open dmitriim opened this issue 1 year ago • 0 comments

Steps to replicate:

  1. Create a dummy role.
  2. Navigate to /admin/settings.php?section=managemfa and enable Role factor
  3. Configure role factor by selecting role created on step 1 and save settings.
  4. Delete the role from step 1.
  5. Navigate to /admin/settings.php?section=managemfa and you will see below error.
Exception - Argument 1 passed to role_get_name() must be an instance of stdClass, bool given, called in [dirroot]/admin/tool/mfa/factor/role/classes/factor.php on line 156

More information about this error

error

Error
Debug info:
Error code: generalexceptionmessage
error

Error
Stack trace:
line 4469 of /lib/accesslib.php: TypeError thrown
line 156 of /admin/tool/mfa/factor/role/classes/factor.php: call to role_get_name()
line 206 of /admin/tool/mfa/classes/local/admin_setting_managemfa.php: call to factor_role\factor->get_summary_condition()
line 81 of /admin/tool/mfa/classes/local/admin_setting_managemfa.php: call to tool_mfa\local\admin_setting_managemfa->define_factor_combinations_table()
line 1657 of /lib/adminlib.php: call to tool_mfa\local\admin_setting_managemfa->output_html()
line 159 of /admin/settings.php: call to admin_settingpage->output_html()

dmitriim avatar May 03 '23 01:05 dmitriim