Skip to content

Commit

Permalink
[SD-421] turn off tfa for previewer and secure file role by default.
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Md Nadim Hossain <[email protected]>

---------

Co-authored-by: Md Nadim Hossain <[email protected]>
  • Loading branch information
MdNadimHossain committed Oct 29, 2024
1 parent 08395fa commit 9be573a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modules/tide_site/src/AliasManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class AliasManager extends CoreAliasManager {
/**
* {@inheritdoc}
*/
public function __construct(AliasRepositoryInterface $repository, AliasWhitelistInterface $whitelist, LanguageManagerInterface $language_manager, CacheBackendInterface $cache, protected ?TimeInterface $time = NULL, AliasStorageHelper $alias_helper) {
public function __construct(AliasRepositoryInterface $repository, AliasWhitelistInterface $whitelist, LanguageManagerInterface $language_manager, CacheBackendInterface $cache, protected ?TimeInterface $time, AliasStorageHelper $alias_helper) {
parent::__construct($repository, $whitelist, $language_manager, $cache, $time);
$this->aliasHelper = $alias_helper;
}
Expand Down
6 changes: 5 additions & 1 deletion modules/tide_tfa/src/TideTfaOperation.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,13 @@ public static function setupTfaSettings() {
$roles = Role::loadMultiple();
// Initialize the $tfa_required_roles array.
$tfa_required_roles = [];
// Define the roles to exclude in a variable.
$excluded_roles = ['authenticated', 'previewer', 'secure_file_user'];

// Iterate through the roles and map the role IDs.
foreach ($roles as $role) {
if ($role->id() !== 'authenticated') {
// Check if the current role is not in the excluded roles.
if (!in_array($role->id(), $excluded_roles)) {
// Map the role ID to itself.
$tfa_required_roles[$role->id()] = $role->id();
}
Expand Down
2 changes: 1 addition & 1 deletion modules/tide_webform/tide_webform.module
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function tide_webform_form_alter(&$form, FormStateInterface $form_state, $form_i
if ($form_id == 'webform_ui_element_form') {
$form['#after_build'][] = 'tide_webform_webform_ui_element_form_after_build';
$form['#attached']['library'][] = 'tide_webform/webform';
if (isset($form['properties']['form']['length_container']['maxlength']) && array_key_exists('#default_value', $form['properties']['form']['length_container']['maxlength'])) {
if (isset($form['properties']['form']['length_container']['maxlength']) && array_key_exists('#default_value', $form['properties']['form']['length_container']['maxlength']) && $form['properties']['type']['#value'] === 'textfield') {
$default_value = NestedArray::getValue($form,
[
'properties',
Expand Down

0 comments on commit 9be573a

Please sign in to comment.