Skip to content
Snippets Groups Projects

ISTWCMS-5254: Use mb_strtolower() in AD group name comparison

Merged Liam Morland requested to merge feature/ISTWCMS-5254-lkmorlan-use-mb_strtolower into 1.0.x
1 file
+ 3
3
Compare changes
  • Side-by-side
  • Inline
+ 3
3
@@ -982,16 +982,16 @@ function uw_cfg_common_webform_access(WebformInterface $webform, string $operati
@@ -982,16 +982,16 @@ function uw_cfg_common_webform_access(WebformInterface $webform, string $operati
// Access control by Active Directory group.
// Access control by Active Directory group.
// Convert all groups to lowercase for case-insensitive matching.
// Convert all groups to lowercase for case-insensitive matching.
$user_ad_groups = uw_cfg_common_get_user_ad_groups() ?: [];
$user_ad_groups = uw_cfg_common_get_user_ad_groups() ?: [];
$user_ad_groups = array_map('strtolower', $user_ad_groups);
$user_ad_groups = array_map('mb_strtolower', $user_ad_groups);
// Required group. If at least one is provided, the user must be in it.
// Required group. If at least one is provided, the user must be in it.
$ad_require_groups = $webform->getThirdPartySetting('uw_cfg_common', 'ad_require_groups');
$ad_require_groups = $webform->getThirdPartySetting('uw_cfg_common', 'ad_require_groups');
$ad_require_groups = array_map('strtolower', $ad_require_groups);
$ad_require_groups = array_map('mb_strtolower', $ad_require_groups);
if ($ad_require_groups && !array_intersect($ad_require_groups, $user_ad_groups)) {
if ($ad_require_groups && !array_intersect($ad_require_groups, $user_ad_groups)) {
return AccessResult::forbidden();
return AccessResult::forbidden();
}
}
// Deny group. If at least one is provided, the user must not be in it.
// Deny group. If at least one is provided, the user must not be in it.
$ad_deny_groups = $webform->getThirdPartySetting('uw_cfg_common', 'ad_deny_groups');
$ad_deny_groups = $webform->getThirdPartySetting('uw_cfg_common', 'ad_deny_groups');
$ad_deny_groups = array_map('strtolower', $ad_deny_groups);
$ad_deny_groups = array_map('mb_strtolower', $ad_deny_groups);
if ($ad_deny_groups && array_intersect($ad_deny_groups, $user_ad_groups)) {
if ($ad_deny_groups && array_intersect($ad_deny_groups, $user_ad_groups)) {
return AccessResult::forbidden();
return AccessResult::forbidden();
}
}
Loading