diff options
author | stfwi <cerberos@atwillys.de> | 2011-07-05 22:38:30 +0100 |
---|---|---|
committer | stfwi <cerberos@atwillys.de> | 2011-07-05 22:38:30 +0100 |
commit | 3e08bdba4f3f2061d25946ab30f83077bfa14db9 (patch) | |
tree | dff06922d6796433c1d49c711547c11718a0bb7c | |
parent | 95c6ce268f486ceca7628b378ee17414a7708e0e (diff) | |
download | drupal_htpasswdsync-3e08bdba4f3f2061d25946ab30f83077bfa14db9.tar.gz drupal_htpasswdsync-3e08bdba4f3f2061d25946ab30f83077bfa14db9.tar.bz2 drupal_htpasswdsync-3e08bdba4f3f2061d25946ab30f83077bfa14db9.zip |
Group file is now updated when the group file name is set to an empty string in the config form
-rw-r--r-- | HTPasswdSync.module | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/HTPasswdSync.module b/HTPasswdSync.module index 4c65b21..43bd347 100644 --- a/HTPasswdSync.module +++ b/HTPasswdSync.module @@ -598,12 +598,20 @@ function htpasswdsync_admin_form_validate($form, &$form_state) { // Directly apply changes if no validation errors if($error == false) { - // A workaround to update the files directly after saving the config form - variable_set('htpasswdsync_flag_needs_rebuild', true); - foreach(_htpasswdsync_roles() as $role) { - if($role > 0 && !in_array($role, $form_state['values']['htpasswdsync_roles'])) { + if($form_state['values']['htpasswdsync_htgroup'] == '' && _htpasswdsync_grpfilename() != '') { + // Group file was unset, so the groups shpuld be all deleted + foreach(_htpasswdsync_roles() as $role) { _htpasswdsync_remove_role($role); } + } else { + // Check which roles have to be removed + // A workaround to update the files directly after saving the config form + variable_set('htpasswdsync_flag_needs_rebuild', true); + foreach(_htpasswdsync_roles() as $role) { + if($role > 0 && !in_array($role, $form_state['values']['htpasswdsync_roles'])) { + _htpasswdsync_remove_role($role); + } + } } } } |