Skip to content

Commit

Permalink
Fix password module index entry (puzzle#124)
Browse files Browse the repository at this point in the history
* update module_index entry password so that it matches the structure

* updated dict access in order to accept new structure

* added fragments
  • Loading branch information
KiLLuuuhh authored May 6, 2024
1 parent 8a0a23b commit 1386cf9
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 28 deletions.
4 changes: 4 additions & 0 deletions changelogs/fragments/124-fix-password-module-index-entry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
bugfixes:
- module_index - Password entry now matches configure_function structure.
- system_access_users - Updated set_user_password dict calls in order to work with the newly introduced structure
56 changes: 32 additions & 24 deletions plugins/module_utils/module_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,14 @@
"/usr/local/etc/inc/auth.inc",
],
"configure_functions": {
"name": "echo password_hash",
"configure_params": [
"'password'",
"PASSWORD_BCRYPT",
"[ 'cost' => 11 ]",
],
"password": {
"name": "echo password_hash",
"configure_params": [
"'password'",
"PASSWORD_BCRYPT",
"[ 'cost' => 11 ]",
],
},
},
},
"firewall_rules": {
Expand Down Expand Up @@ -232,12 +234,14 @@
"/usr/local/etc/inc/auth.inc",
],
"configure_functions": {
"name": "echo password_hash",
"configure_params": [
"'password'",
"PASSWORD_BCRYPT",
"[ 'cost' => 11 ]",
],
"password": {
"name": "echo password_hash",
"configure_params": [
"'password'",
"PASSWORD_BCRYPT",
"[ 'cost' => 11 ]",
],
},
},
},
"firewall_rules": {
Expand Down Expand Up @@ -357,12 +361,14 @@
"/usr/local/etc/inc/auth.inc",
],
"configure_functions": {
"name": "echo password_hash",
"configure_params": [
"'password'",
"PASSWORD_BCRYPT",
"[ 'cost' => 11 ]",
],
"password": {
"name": "echo password_hash",
"configure_params": [
"'password'",
"PASSWORD_BCRYPT",
"[ 'cost' => 11 ]",
],
},
},
},
"firewall_rules": {
Expand Down Expand Up @@ -483,12 +489,14 @@
"/usr/local/etc/inc/auth.inc",
],
"configure_functions": {
"name": "echo password_hash",
"configure_params": [
"'password'",
"PASSWORD_BCRYPT",
"[ 'cost' => 11 ]",
],
"password": {
"name": "echo password_hash",
"configure_params": [
"'password'",
"PASSWORD_BCRYPT",
"[ 'cost' => 11 ]",
],
},
},
},
"firewall_rules": {
Expand Down
12 changes: 8 additions & 4 deletions plugins/module_utils/system_access_users_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,10 +775,14 @@ def set_user_password(self, user: User) -> None:

# load requirements
php_requirements = self._config_maps["password"]["php_requirements"]
configure_function = self._config_maps["password"]["configure_functions"][
"name"
]
configure_params = self._config_maps["password"]["configure_functions"][

# load requirements
configure_function_dict = self._config_maps["password"]["configure_functions"]
configure_function_key = next(
(key for key in configure_function_dict if key != "name"), None
)
configure_function = configure_function_dict[configure_function_key]["name"]
configure_params = configure_function_dict[configure_function_key][
"configure_params"
]

Expand Down

0 comments on commit 1386cf9

Please sign in to comment.